epygram.formats — Formats

Module contains:

  • all formats classes.
  • utilities to play with resource formats:
    • guess the format of an existing resource in a given container;
    • create a Resource instance with a generic function, eventually (if already existing) without knowing its format a priori;
    • some catalogs of GRIB numbers
    • ...


Returns the name of the format of the resource located at a given filename, if succeeded.

epygram.formats.resource(filename, openmode, fmt=None, **kwargs)[source]

Returns an instance of Resource of the requested fmt format, located at the given filename, open with the given openmode.

  • filename – name (path) of the file to open
  • openmode – opening mode (‘r’, ‘a’, ‘w’)
  • fmt – format of the resource; with openmode ‘r’ or ‘a’, fmt is optional and can be guessed from the existing resource

Other kwargs are passed to the resource constructor.