epygram.formats.GeoPoints
— Interface-Class to the GeoPoints format¶
Contains the class for GeoPoints format.
- class epygram.formats.GeoPoints.GeoPoints(*args, **kwargs)[source]¶
Bases:
epygram.resources.FileResource.FileResource
Class implementing all specificities for GeoPoints resource format.
Format:
<beginning of file> #GEO #PARAMETER = any name or character string #LAT LON DATE TIME VALUE #DATA 32.2671 -12.5501 20140417 21 2.269112E+02 … <till end of file> The set of keys describing each point is defined in its ‘columns’ attribute.
Note
This class is managed by footprint.
info: Not documented
priority: PriorityLevel::DEFAULT (rank=1)
Automatic parameters from the footprint:
columns (
footprints.stdtypes.FPList
) - rxx - The columns of the geopoints, i.e. the set of keys describing each point.Optional. Default is None.
filename (
builtins.str
) - rxx - File name (absolute or relative) of the resource.fmtdelayedopen (
builtins.bool
) - rxx - Opening of the resource delayed (not at time of construction).Optional. Default is False.
format (
builtins.str
) - rxx - Format of the resource.Optional. Default is ‘GeoPoints’.
Values: set([‘GeoPoints’])
no_header (
builtins.bool
) - rxx - If True, do not write header (openmode=’w’).Optional. Default is False.
openmode (
builtins.str
) - rxx - Opening mode.Values: set([‘append’, ‘r’, ‘read’, ‘w’, ‘a’, ‘write’])
Remap: dict(append = ‘a’, read = ‘r’, write = ‘w’,)
other_attributes (
footprints.stdtypes.FPDict
) - rxx - other key:value pairs in header.Optional. Default is FPDict::<<as_dict:: dict()>>.
parameter (
builtins.str
) - rxx - The name of the parameter whose data is in the value field.Optional. Default is None.
Constructor. See its footprint for arguments.
- columns¶
The columns of the geopoints, i.e. the set of keys describing each point (see the documentation above for more details).
- filename¶
File name (absolute or relative) of the resource (see the documentation above for more details).
- fmtdelayedopen¶
Opening of the resource delayed (not at time of construction) (see the documentation above for more details).
- format¶
Format of the resource (see the documentation above for more details).
- listfields(**kwargs)[source]¶
Returns a list containing the LFI identifiers of all the fields of the resource.
- no_header¶
If True, do not write header (openmode=’w’) (see the documentation above for more details).
- open(parameter=None, columns=None, openmode=None, other_attributes=None)[source]¶
Opens a GeoPoint.
- Parameters
parameter – name of the parameter in header (openmode=’w’).
columns – list of all the items to be written for each point (openmode=’w’).
openmode – optional, to open with a specific openmode, eventually different from the one specified at initialization.
other_attributes – other key:value pairs to be written in header (openmode=’w’).
- openmode¶
Opening mode (see the documentation above for more details).
- other_attributes¶
other key:value pairs in header (see the documentation above for more details).
- parameter¶
The name of the parameter whose data is in the value field (see the documentation above for more details).
- readfield(*args, **kwargs)¶
Reads the GeoPoints.
- Parameters
parameter – is the name of the parameter to read (it exists only for compatibility with other formats)
footprints_builder – if True, uses footprints.proxy to build fields. Defaults to False for performance reasons.
as_points – if True, returns a collection of points instead of a single field.
- what(*args, **kwargs)¶
Writes in file-like a summary of the contents of the GeoPoints.
- Parameters
out – the output open file-like object.
- writefield(field, parameter='UNKNOWN', fidkey_for_parameter=None, order='C', llprecision=4, precision=6, col_width=12, subzone=None)[source]¶
Write a field in the resource.
- Parameters
field – a
epygram.fields.D3Field
or aepygram.base.FieldSet
ofepygram.fields.PointField
, or a dict {‘lon’:[…], ‘lat’:[…], ‘value’:[…], …}. The keys of field that are not in the columns are ignored. The keys of the columns that are not in the field are filled by zeros. At least ‘lon’ and ‘lat’ are necessary.parameter – the name of the parameter, to be given if field is a dict and if it has not been given at opening.
order – optional, for a rectangular D3Field, whether to flatten 2D arrays in ‘C’ (row-major) or ‘F’ (Fortran, column-major) order.
llprecision – precision (number of digits) in write for lon/lat.
precision – precision (number of digits) in write for other floats.
subzone – optional, among (‘C’, ‘CI’). Only if field is a LAM
epygram.fields.H2DField
, extracts the points of the resp. C or C+I zone. Default is no subzone, i.e. the whole field.