cpc.geofiles.conversion Module

Contains methods for converting between different file formats

Functions

fcst_bin_to_txt(bin_file, grid, fcst_ptiles, desired_output_thresholds, txt_file, output_threshold_type=’ptile’, terciles=False, output_grid=None)

Converts a forecast binary file to a text file

The forecast binary file must contain probabilities of exceeding certain percentiles (AKA a POE file), where the percentiles are ascending in the file. The dimensions of the file should be (P x L), where:

If output_threshold_type is set to ‘ptile’ (‘raw’), then the probability of exceeding the given ptiles (raw values) will be written to the output file under the headers ptileXX, ptileYY (rawvalXX, rawvalYY), etc.

If terciles=True, then headers will be different (see the Parameters section below)

Parameters

Raises

obs_bin_to_txt(bin_file, grid, desired_output_thresholds, txt_file, output_threshold_type=’ptile’, climo_file=None, climo_ptiles=None, output_grid=None)

Converts an observation binary file to a text file

The observation binary file must contain raw values of the given variable. The file should be a single dimension (locations).

A climatology file is necessary if output_threshold_type=’ptile’, in which case the raw values in the observation file needs to first be converted to ptiles. The climatology file must have probabilities of exceeding a given set of percentiles, and be of dimensions (P x L) where:

climo_ptiles must also be provided specifying the percentiles in the file.

Parameters

Raises