epygram.formats.conversion.functions — Formats conversion functions (API)

Conversion functions (API).


epygram.formats.conversion.functions.fid_converter(initial_fid, initial_fmt, target_fmt, grib_short_fid=False)[source]

Creates and returns the fid in format target_fmt from an initial_fid in initial_fmt.

grib_short_fid condense GRIB fid in string.


epygram.formats.conversion.functions.convert(filename, output_format_suffix, get_write_kwargs=<function <lambda>>, fieldseed=None, subzone=None, grib_short_fid=False, progressmode=None, **kwargs)[source]

Conversion function.

Parameters:
  • filename – name of the file to be processed.

  • output_format_suffix – among ‘grb’ (GRIB2), ‘nc’ (netCDF4), ‘geo’ (GeoPoints)

  • get_write_kwargs – function that gives the necessary write options

  • fieldseed – either a fid or a list of fid, used as a seed for generating the list of fields to be processed.

  • subzone – LAM zone among (‘C’, ‘CI’, None).

  • grib_short_fid – condense GRIB fid as string, in case converting a GRIB file.

  • progressmode – among (‘verbose’, ‘percentage’, None)

Other kwargs are specific to output formats, and passed to

get_write_kwargs(), wherein they can be handled whatever for…


epygram.formats.conversion.functions.batch_convert(filenames, output_format_suffix, threads_number=1, progressmode=None, **kwargs)[source]

Converts a series of files to output_format_suffix in batch.

Mandatory arguments:

Parameters:
  • filenames – name(s) of the files to be processed

  • output_format_suffix – among ‘grb’ (GRIB2), ‘nc’ (netCDF4), ‘geo’ (GeoPoints)

Technical named (optional) arguments:

Parameters:
  • threads_number – parallelisation of files processing

  • progressmode – among (‘verbose’, ‘percentage’, None)

Other named arguments depend on the output format, and are defined in the Workers footprints attributes !