Contains classes for GRIB resource and GRIB individual message, editions 1 and 2.
Bases: epygram.resources.FileResource.FileResource
Class implementing all specificities for GRIB resource format.
Footprint:
dict(
attr = dict(
filename = dict(
access = 'rxx',
alias = set([]),
default = None,
info = 'File name (absolute or relative) of the resource.',
optional = False,
outcast = set([]),
remap = dict(),
values = set([]),
),
fmtdelayedopen = dict(
access = 'rxx',
alias = set([]),
default = False,
info = 'Opening of the resource delayed (not at time of construction).',
optional = True,
outcast = set([]),
remap = dict(),
type = bool,
values = set([]),
),
format = dict(
access = 'rxx',
alias = set([]),
default = 'GRIB',
info = 'Format of the resource.',
optional = True,
outcast = set([]),
remap = dict(),
values = set(['GRIB']),
),
openmode = dict(
access = 'rxx',
alias = set([]),
default = None,
info = 'Opening mode.',
optional = False,
outcast = set([]),
remap = dict(
append = 'a',
read = 'r',
write = 'w',
),
values = set(['a', 'write', 'r', 'w', 'read', 'append']),
),
),
bind = [],
info = 'Not documented',
only = dict(),
priority = dict(
level = footprints.priorities.PriorityLevel::DEFAULT,
),
)
Extracts a subdomain from the GRIB resource, given its handgrip and the geometry to use.
Args:
Extracts a vertical profile from the GRIB resource, given a handgrip and the geographic location (lon/lat) of the profile.
Args:
Extracts a vertical section from the GRIB resource, given its handgrip and the geographic (lon/lat) coordinates of its ends. The section is returned as a V2DField.
Args:
Returns a list of the fields from resource whose name match the given seed.
Args:
seed: might be - a ‘handgrip’, i.e. a dict where you can store all requested GRIB
- keys, e.g. {‘shortName’:’t’, ‘indicatorOfTypeOfLevel’:’pl’,
‘level’:850},
generic: if True, returns complete fid’s, union of {‘FORMATname’:fieldname} and the according generic fid of the fields.
Returns the message at position position, from 0 (first message) to messages_number-1 (last message). Negative position starts from the end: -1 is last message. Should not be used sequentially, probably very inefficient.
Iterates sequentially on messages, returning fields.
Iterates sequentially on messages, returning messages.
Returns a list containing the GRIB identifiers of all the fields of the resource.
Argument onlykey can be specified as a string or a tuple of strings, so that only specified keys of the fid will returned.
Argument select can be specified as a dict(key=value) to restrain the list of fields to those that match the key:value pairs.
Opens a GRIB and initializes some attributes.
Finds in GRIB the message that correspond to the handgrip, and returns it as a epygram.base.Field. If several messages meet the requirements, raises error (use readfields() method instead).
handgrip is a dict where you can store all requested GRIB keys... E.g. {‘shortName’:’t’, ‘indicatorOfTypeOfLevel’:’pl’, ‘level’:850} will return the Temperature at 850hPa field.
If getdata == False, the data is not read, the field consist in the meta-data only.
If footprints_builder == True, uses footprints.proxy to build fields. True decreases performance.
If get_info_as_json is not None, writes the keys given in get_info_as_json as json in field.comment.
Finds in GRIB the message(s) that correspond to the handgrip, and returns it as a epygram.base.FieldSet of epygram.base.Field.
handgrip is a dict where you can store all requested GRIB keys... E.g. {‘shortName’:’t’, ‘indicatorOfTypeOfLevel’:’pl’} will return all the Temperature fields on Pressure levels.
If getdata == False, the data is not read, the field(s) consist in the meta-data only.
If footprints_builder == True, uses footprints.proxy to build fields. True decreases performance.
If get_info_as_json is not None, writes the keys given in get_info_as_json as json in field.comment.
Returns a sorted list of fields with regards to the given sortingkey of their fid, as a dict of lists.
Argument onlykey can be specified as a string or a tuple of strings, so that only specified keys of the fid will returned.
Return two lists of fids corresponding respectively to U and V components of wind, given a fieldseed. Syntax example: ‘shortName’:’u+v’, or ‘indicatorOfParameter’:‘33+34’
Writes in file a summary of the contents of the GRIB.
Args:
Writes a Field as a GRIBmessage into the GRIB resource.
Args:
Bases: epygram.util.RecursiveObject, dict
Class implementing a GRIB message as an object.
Returns an epygram.base.Field made out from the GRIB message.
Generates and returns a GRIB-type epygram fid from the message.
Same as dict.get(), but try to read attribute first.
Reads and returns the available keys of the message.
Args:
Reads the meta-data of the message.
Args:
Wrapper to set values as a 2D array, in coherence with ordering parameters already set beforehand.
Specific method to set packing because the order of the elements is important. packing to be a dict.
Wrapper to set values as a 2D array if gridpoint or 1D if spectral.
If E present and has a .keys() method, does: for k in E: D[k] = E[k] If E present and lacks .keys() method, does: for (k, v) in E: D[k] = v In either case, this is followed by: for k in F: D[k] = F[k]