epygram.geometries.H2DGeometry — Horizontal 2-D Geometry class

Contains the classes for Horizontal 2D geometries of fields.



class epygram.geometries.H2DGeometry.H2DGeometry(*args, **kwargs)[source]

Bases: epygram.geometries.D3Geometry.D3Geometry

Handles the geometry for a Horizontal 2-Dimensions Field. Abstract mother class.

Note

This class is managed by footprint.

  • info: Not documented
  • priority: PriorityLevel::DEFAULT (rank=1)

Automatic parameters from the footprint:

  • dimensions (footprints.stdtypes.FPDict) - rxx - Handles grid dimensions.
  • geoid (footprints.stdtypes.FPDict) - rxx - To specify geoid shape; actually used in projected geometries only.
    • Optional. Default is FPDict::<<as_dict:: dict()>>.
  • grid (footprints.stdtypes.FPDict) - rxx - Handles description of the horizontal grid.
  • name (str) - rxx - Name of geometrical type of representation of points on the Globe.
    • Values: set([‘reduced_gauss’, ‘regular_lonlat’, ‘lambert’, ‘rotated_reduced_gauss’, ‘unstructured’, ‘regular_gauss’, ‘mercator’, ‘polar_stereographic’])
  • position_on_horizontal_grid (str) - rwx - Position of points w/r to the horizontal.
    • Optional. Default is ‘__unknown__’.
    • Values: set([‘center-left’, ‘lower-right’, ‘upper-right’, ‘lower-center’, ‘lower-left’, ‘center-right’, ‘upper-left’, ‘__unknown__’, ‘upper-center’, ‘center’])
  • structure (str) - rxx - Type of geometry.
    • Values: set([‘H2D’])
  • vcoordinate (epygram.geometries.VGeometry.VGeometry) - rwx - Handles vertical geometry parameters.

class epygram.geometries.H2DGeometry.H2DRectangularGridGeometry(*args, **kwargs)[source]

Bases: epygram.geometries.H2DGeometry.H2DGeometry, epygram.geometries.D3Geometry.D3RectangularGridGeometry

Handles the geometry for a rectangular Horizontal 2-Dimensions Field. Abstract.

Note

This class is managed by footprint.

  • info: Not documented
  • priority: PriorityLevel::DEFAULT (rank=1)

Automatic parameters from the footprint:

  • dimensions (footprints.stdtypes.FPDict) - rxx - Handles grid dimensions.
  • geoid (footprints.stdtypes.FPDict) - rxx - To specify geoid shape; actually used in projected geometries only.
    • Optional. Default is FPDict::<<as_dict:: dict()>>.
  • grid (footprints.stdtypes.FPDict) - rxx - Handles description of the horizontal grid.
  • name (str) - rxx - Name of geometrical type of representation of points on the Globe.
    • Values: set([‘unstructured’, ‘academic’, ‘regular_lonlat’, ‘mercator’, ‘lambert’, ‘polar_stereographic’])
  • position_on_horizontal_grid (str) - rwx - Position of points w/r to the horizontal.
    • Optional. Default is ‘__unknown__’.
    • Values: set([‘center-left’, ‘lower-right’, ‘upper-right’, ‘lower-center’, ‘lower-left’, ‘center-right’, ‘upper-left’, ‘__unknown__’, ‘upper-center’, ‘center’])
  • structure (str) - rxx - Type of geometry.
    • Values: set([‘H2D’])
  • vcoordinate (epygram.geometries.VGeometry.VGeometry) - rwx - Handles vertical geometry parameters.

class epygram.geometries.H2DGeometry.H2DUnstructuredGeometry(*args, **kwargs)[source]

Bases: epygram.geometries.H2DGeometry.H2DRectangularGridGeometry, epygram.geometries.D3Geometry.D3UnstructuredGeometry

Handles the geometry for an unstructured Horizontal 2-Dimensions Field.

Note

This class is managed by footprint.

  • info: Not documented
  • priority: PriorityLevel::DEFAULT (rank=1)

Automatic parameters from the footprint:

  • dimensions (footprints.stdtypes.FPDict) - rxx - Handles grid dimensions.
  • geoid (footprints.stdtypes.FPDict) - rxx - To specify geoid shape; actually used in projected geometries only.
    • Optional. Default is FPDict::<<as_dict:: dict()>>.
  • grid (footprints.stdtypes.FPDict) - rxx - Handles description of the horizontal grid.
  • name (str) - rxx - Name of geometrical type of representation of points on the Globe.
    • Values: set([‘unstructured’])
  • position_on_horizontal_grid (str) - rwx - Position of points w/r to the horizontal.
    • Optional. Default is ‘__unknown__’.
    • Values: set([‘center-left’, ‘lower-right’, ‘upper-right’, ‘lower-center’, ‘lower-left’, ‘center-right’, ‘upper-left’, ‘__unknown__’, ‘upper-center’, ‘center’])
  • structure (str) - rxx - Type of geometry.
    • Values: set([‘H2D’])
  • vcoordinate (epygram.geometries.VGeometry.VGeometry) - rwx - Handles vertical geometry parameters.

class epygram.geometries.H2DGeometry.H2DAcademicGeometry(*args, **kwargs)[source]

Bases: epygram.geometries.H2DGeometry.H2DRectangularGridGeometry, epygram.geometries.D3Geometry.D3AcademicGeometry

Handles the geometry for an academic Horizontal 2-Dimensions Field.

Note

This class is managed by footprint.

  • info: Not documented
  • priority: PriorityLevel::DEFAULT (rank=1)

Automatic parameters from the footprint:

  • dimensions (footprints.stdtypes.FPDict) - rxx - Handles grid dimensions.
  • geoid (footprints.stdtypes.FPDict) - rxx - To specify geoid shape; actually used in projected geometries only.
    • Optional. Default is FPDict::<<as_dict:: dict()>>.
  • grid (footprints.stdtypes.FPDict) - rxx - Handles description of the horizontal grid.
  • name (str) - rxx - Name of geometrical type of representation of points on the Globe.
    • Values: set([‘academic’])
  • position_on_horizontal_grid (str) - rwx - Position of points w/r to the horizontal.
    • Optional. Default is ‘__unknown__’.
    • Values: set([‘center-left’, ‘lower-right’, ‘upper-right’, ‘lower-center’, ‘lower-left’, ‘center-right’, ‘upper-left’, ‘__unknown__’, ‘upper-center’, ‘center’])
  • projection (footprints.stdtypes.FPDict) - rxx - Handles projection information.
  • structure (str) - rxx - Type of geometry.
    • Values: set([‘H2D’])
  • vcoordinate (epygram.geometries.VGeometry.VGeometry) - rwx - Handles vertical geometry parameters.

class epygram.geometries.H2DGeometry.H2DRegLLGeometry(*args, **kwargs)[source]

Bases: epygram.geometries.H2DGeometry.H2DRectangularGridGeometry, epygram.geometries.D3Geometry.D3RegLLGeometry

Handles the geometry for a Regular Lon/Lat Horizontal 2-Dimensions Field.

Note

This class is managed by footprint.

  • info: Not documented
  • priority: PriorityLevel::DEFAULT (rank=1)

Automatic parameters from the footprint:

  • dimensions (footprints.stdtypes.FPDict) - rxx - Handles grid dimensions.
  • geoid (footprints.stdtypes.FPDict) - rxx - To specify geoid shape; actually used in projected geometries only.
    • Optional. Default is FPDict::<<as_dict:: dict()>>.
  • grid (footprints.stdtypes.FPDict) - rxx - Handles description of the horizontal grid.
  • name (str) - rxx - Name of geometrical type of representation of points on the Globe.
    • Values: set([‘regular_lonlat’])
  • position_on_horizontal_grid (str) - rwx - Position of points w/r to the horizontal.
    • Optional. Default is ‘__unknown__’.
    • Values: set([‘center-left’, ‘lower-right’, ‘upper-right’, ‘lower-center’, ‘lower-left’, ‘center-right’, ‘upper-left’, ‘__unknown__’, ‘upper-center’, ‘center’])
  • structure (str) - rxx - Type of geometry.
    • Values: set([‘H2D’])
  • vcoordinate (epygram.geometries.VGeometry.VGeometry) - rwx - Handles vertical geometry parameters.

class epygram.geometries.H2DGeometry.H2DProjectedGeometry(*args, **kwargs)[source]

Bases: epygram.geometries.H2DGeometry.H2DRectangularGridGeometry, epygram.geometries.D3Geometry.D3ProjectedGeometry

Handles the geometry for a Projected Horizontal 2-Dimensions Field.

Note

This class is managed by footprint.

  • info: Not documented
  • priority: PriorityLevel::DEFAULT (rank=1)

Automatic parameters from the footprint:

  • dimensions (footprints.stdtypes.FPDict) - rxx - Handles grid dimensions.
  • geoid (footprints.stdtypes.FPDict) - rxx - To specify geoid shape; actually used in projected geometries only.
    • Optional. Default is FPDict::<<as_dict:: dict()>>.
  • grid (footprints.stdtypes.FPDict) - rxx - Handles description of the horizontal grid.
  • name (str) - rxx - Name of geometrical type of representation of points on the Globe.
    • Values: set([‘lambert’, ‘space_view’, ‘polar_stereographic’, ‘mercator’])
  • position_on_horizontal_grid (str) - rwx - Position of points w/r to the horizontal.
    • Optional. Default is ‘__unknown__’.
    • Values: set([‘center-left’, ‘lower-right’, ‘upper-right’, ‘lower-center’, ‘lower-left’, ‘center-right’, ‘upper-left’, ‘__unknown__’, ‘upper-center’, ‘center’])
  • projection (footprints.stdtypes.FPDict) - rxx - Handles projection information.
  • projtool (str) - rxx - To use pyproj or epygram.myproj.
    • Optional. Default is ‘pyproj’.
  • structure (str) - rxx - Type of geometry.
    • Values: set([‘H2D’])
  • vcoordinate (epygram.geometries.VGeometry.VGeometry) - rwx - Handles vertical geometry parameters.
SUPER()

A kind of shortcut to parent class. Warning: use with care.

azimuth(end1, end2)

Initial bearing from end1 to end2 points in geometry.

Parameters:
  • end1 – must be a tuple (lon, lat) in degrees.
  • end2 – must be a tuple (lon, lat) in degrees.
compass_grid(subzone=None, position=None)

Get the compass grid, i.e. the angle between Y-axis and North for each gridpoint.

Parameters:
  • subzone

    optional, among (‘C’, ‘CI’), for LAM grids only, returns the grid resp. for the C or C+I zone off the C+I+E zone.

    Default is no subzone, i.e. the whole field.

  • position – position of lonlat grid with respect to the model cell. Defaults to self.position_on_horizontal_grid.
copy()

Returns a copy of the object.

datashape

Returns the data shape requested by this geometry.

deepcopy()

Returns a deepcopy of the object.

distance(end1, end2)

Computes the distance between two points along a straight line in the geometry.

Parameters:
  • end1 – must be a tuple (lon, lat) in degrees.
  • end2 – must be a tuple (lon, lat) in degrees.
extract_subzone(data, subzone)

Extracts the subzone C or CI from a LAM field.

Parameters:
  • data – the data values with shape concording with geometry.
  • subzone – optional, among (‘C’, ‘CI’), for LAM grids only, extracts the data resp. from the C or C+I zone off the C+I(+E) zone.
fill_maskedvalues(data, fill_value=None)

Returns a copy of data with masked values filled with fill_value.

footprint

Footprint associated to current object’s class.

footprint_abstract()

Returns whether the current class could be instanciated or not.

footprint_access(attrname)

Return the access mode of a footprint attribute.

footprint_as_dict()

Returns a dictionary that contains a deepcopy of the current attributes.

footprint_as_shallow_dict()

Returns a dictionary that contains the current attributes (shallow copy).

footprint_attributes

Returns the list of current attributes.

footprint_attributes_values

Returns the list of current attributes values.

footprint_cleanup(rd)

Removes in the specified rd description the keys that are tracked as part of the footprint of the current object.

footprint_clone(full=False, extra=None)

Return a deep copy of the current object as a brand new one. Only footprint attributes are carried around. Attributes to be replaced or added can be specified in dict extra.

footprint_clskind()

Return a lower-case string of the name of the current footprint class.

footprint_clsname()

Returns the short name of the object’s class.

footprint_clsrealkind()

Return the realkind property value of the current class.

footprint_compatible(rd)

Resolve a subset of a description according to my footprint, and then compare to my actual values.

footprint_couldbe(rd, report=None, mkreport=False)

This is the heart of any selection purpose, particularly in relation with the find_all() mechanism of footprints.Collector classes. It returns the resolved form in which the current rd description could be recognized as a footprint of the current class, False otherwise.

footprint_delattr(attr, auth=None)

Delete actual attribute. Protected method.

footprint_export()

See the current footprint as a pure dictionary when exported.

footprint_getattr(attr, auth=None)

Return actual attribute value in internal storage. Protected method.

footprint_info

Information from the current footprint.

footprint_level()

Return the tag name of the priority level of the current class footprint object.

footprint_mandatory()

Returns the attributes that should be present in a description in order to be able to match the current object.

footprint_optional(a)

Returns whether the specified attribute a is optional or not.

footprint_pl()

Return the priority level of the current class footprint object.

footprint_retrieve(**kw)

Returns the internal checked footprint of the current class object.

footprint_reusable()

Returns whether the current class could be used for default loading.

footprint_riseup()

Things to do after new or init construction.

footprint_setattr(attr, value, auth=None)

Set actual attribute to the value specified. Protected method.

footprint_undefs()

Return list of attributes which are still None.

footprint_values(attrname)

Return the list of authorized values of a footprint attribute (if any).

footprint_weight(realinputs)

Tuple with ordered weights to make a choice possible between various electible footprints.

fullname()

Returns a nicely formatted name of the current class (dump usage).

get_datashape(dimT=1, force_dimZ=None, d4=False, subzone=None)

Returns the data shape according to the geometry.

Parameters:
  • force_dimZ – if supplied, force the Z dimension instead of that of the vertical geometry
  • dimT – if supplied, is the time dimension to be added to the data shape
  • d4
    • if True, shape is 4D
    • if False, shape has only those > 1
  • subzone – optional, among (‘C’, ‘CI’), for LAM grids only, informes that data is resp. on the C or C+I zone off the C+I(+E) zone.
get_levels(d4=False, nb_validities=0, subzone=None)

Returns an array containing the level for each data point.

Parameters:
  • d4
    • if True, returned values are shaped in a 4 dimensions array
    • if False, shape of returned values is determined with respect to geometry d4=True requires nb_validities > 0
  • nb_validities – the number of validities represented in data values
  • subzone – optional, among (‘C’, ‘CI’), for LAM grids only, extracts the levels resp. from the C or C+I zone off the C+I(+E) zone.

Levels are internally stored with the vertical dimension first whereas this method puts the time in first dimension.

get_lonlat_grid(subzone=None, position=None, d4=False, nb_validities=0)

Returns a tuple of two tables containing one the longitude of each point, the other the latitude, with 2D shape.

Parameters:
  • subzone

    optional, among (‘C’, ‘CI’), for LAM grids only, returns the grid resp. for the C or C+I zone off the C+I+E zone.

    Default is no subzone, i.e. the whole field.

  • position – position of lonlat grid with respect to the model cell. Defaults to self.position_on_horizontal_grid.
  • d4
    • if True, returned values are shaped in a 4 dimensions array
    • if False, shape of returned values is determined with respect to geometry. d4=True requires nb_validities > 0
  • nb_validities – number of validities represented in data values

Shape of 2D data on Rectangular grids:

  • grid[0,0] is SW, grid[-1,-1] is NE
  • grid[0,-1] is SE, grid[-1,0] is NW
getcenter()

Returns the coordinate of the grid center as a tuple (center_lon, center_lat).

gimme_corners_ij(subzone=None)

Returns the indices (i, j) of the four corners of a rectangular grid, as a dict(corner=(i, j)) with corner in:

ll = lower-left / lr = lower-right / ur = upper-right / ul = upper-left.

(0, 0) is always the lower-left corner of the grid.

Parameters:subzone – for LAM fields, returns the corners of the subzone.
gimme_corners_ll(subzone=None, position=None)

Returns the lon/lat of the four corners of a rectangular grid, as a dict(corner=(lon, lat)) with corner in:

ll = lower-left / lr = lower-right / ur = upper-right / ul = upper-left.

Parameters:
  • subzone – for LAM grids, returns the corners of the subzone.
  • position – position of corners with respect to the model cell. Defaults to self.position_on_horizontal_grid.
gridpoints_number

Returns the number of gridpoints of the grid.

Parameters:subzone

optional, among (‘C’, ‘CI’), for LAM grids only, returns the grid resp. for the C or C+I zone off the C+I+E zone.

Default is no subzone, i.e. the whole field.

horizontally_flattened(data)

Returns a copy of data with horizontal dimensions flattened. data must be 4D for simplicity reasons.

ij2ll(i, j, position=None)

Return the (lon, lat) coordinates of point (i,j), in degrees.

Parameters:
  • i – X index of point in the 2D matrix of gridpoints
  • j – Y index of point in the 2D matrix of gridpoints
  • position – lat lon position to return with respect to the model cell. Defaults to self.position_on_horizontal_grid.
ij2xy(i, j, position=None)

Return the (x, y) coordinates of point (i,j), in the projection.

Parameters:
  • i – X index of point in the 2D matrix of gridpoints
  • j – Y index of point in the 2D matrix of gridpoints
  • position – position to return with respect to the model cell. Defaults to self.position_on_horizontal_grid.

Note that origin of coordinates in projection is the center of the C+I domain.

linspace(end1, end2, num)

Returns evenly spaced points over the specified interval. Points are lined up in the geometry.

Parameters:
  • end1 – must be a tuple (lon, lat) in degrees.
  • end2 – must be a tuple (lon, lat) in degrees.
  • num – number of points, including point1 and point2.
ll2ij(lon, lat, position=None)

Return the (i, j) indexes of point (lon, lat) in degrees, in the 2D matrix of gridpoints.

Parameters:
  • lon – longitude of point in degrees
  • lat – latitude of point in degrees
  • position – lat lon position to return with respect to the model cell. Defaults to self.position_on_horizontal_grid.

Caution: (i,j) are float.

ll2xy(lon, lat)

Return the (x, y) coordinates of point (lon, lat) in degrees.

Parameters:
  • lon – longitude of point in degrees
  • lat – latitude of point in degrees

Note that origin of coordinates in projection is the center of the C+I domain.

make_basemap(gisquality=u'i', subzone=None, specificproj=None, zoom=None, ax=None)

Returns a matplotlib.basemap.Basemap object of the ‘ad hoc’ projection (if available). This is designed to avoid explicit handling of deep horizontal geometry attributes.

Parameters:
  • gisquality – defines the quality of GIS contours, cf. Basemap doc. Possible values (by increasing quality): ‘c’, ‘l’, ‘i’, ‘h’, ‘f’.
  • subzone – defines the LAM subzone to be included, in LAM case, among: ‘C’, ‘CI’.
  • specificproj

    enables to make basemap on the specified projection, among: ‘kav7’, ‘cyl’, ‘ortho’, (‘nsper’, {...}) (cf. Basemap doc).

    In ‘nsper’ case, the {} may contain:

    • ‘sat_height’ = satellite height in km;
    • ‘lon’ = longitude of nadir in degrees;
    • ‘lat’ = latitude of nadir in degrees.

    Overwritten by zoom.

  • zoom – specifies the lon/lat borders of the map, implying hereby a ‘cyl’ projection. Must be a dict(lonmin=, lonmax=, latmin=, latmax=). Overwrites specificproj.
  • ax – a matplotlib ax on which to plot; if None, plots will be done on matplotlib.pyplot.gca()
make_point_geometry(lon, lat)

Returns a PointGeometry at coordinates (lon,lat) in degrees.

make_profile_geometry(lon, lat)

Returns a V1DGeometry at coordinates (lon,lat) in degrees.

make_section_geometry(end1, end2, points_number=None, resolution=None, position=None)

Returns a projected V2DGeometry.

Parameters:
  • end1 – must be a tuple (lon, lat) in degrees.
  • end2 – must be a tuple (lon, lat) in degrees.
  • points_number – defines the total number of horizontal points of the section (including ends). If None, defaults to a number computed from the ends and the resolution.
  • resolution – defines the horizontal resolution to be given to the field. If None, defaults to the horizontal resolution of the field.
  • position – defines the position of data in the grid (defaults to ‘center’)
make_subarray_geometry(first_i, last_i, first_j, last_j)

Make a modified geometry consisting in a subarray of the grid, defined by the indexes given as argument.

map_factor(lat)

Returns the map factor at the given latitude(s) lat in degrees.

map_factor_field(position=None)

Returns a new field whose data is the map factor over the field.

Parameters:position – grid position with respect to the model cell. Defaults to self.position_on_horizontal_grid.
mesh_area(lat)

Compute the area of a mesh/gridpoint, given its latitude.

mesh_area_field(position=None)

Returns a new field whose data is the mesh area of gridpoints, i.e. X_resolution x Y_resolution / m^2, where m is the local map factor.

Parameters:position – grid position with respect to the model cell. Defaults to self.position_on_horizontal_grid.
nearest_points(lon, lat, request, position=None, external_distance=None)

Returns the (i, j) positions of the nearest points.

Parameters:
  • lon – longitude of point in degrees.
  • lat – latitude of point in degrees.
  • request

    criteria for selecting the points, among: * {‘n’:‘1’} - the nearest point * {‘n’:‘2*2’} - the 2*2 square points around the position * {‘n’:‘4*4’} - the 4*4 square points around the position * {‘n’:’N*N’} - the N*N square points around the position: N must be even * {‘radius’:xxxx, ‘shape’:’square’} - the points which are xxxx metres

    around the position in X or Y direction
    • {‘radius’:xxxx, ‘shape’:’circle’} - the points within xxxx metres around the position. (default shape == circle)
  • position – position in the model cell of the lat lon position. Defaults to self.position_on_horizontal_grid.
  • external_distance – can be a dict containing the target point value and an external field on the same grid as self, to which the distance is computed within the 4 horizontally nearest points; e.g. {‘target_value’:4810, ‘external_field’:a_3DField_with_same_geometry}. If so, the nearest point is selected with distance = |target_value - external_field.data| Only valid with request={‘n’:‘1’}
Return type:

list of (lon, lat) tuples, or (lon, lat) if one only point.

plotgeometry(color=u'blue', borderonly=True, **kwargs)

Makes a simple plot of the geometry, with a number of options.

Parameters:
  • color – color of the plotting.
  • borderonly – if True, only plot the border of the grid, else the whole grid. Ignored for global geometries.

For other options, cf. plotfield() method of epygram.fields.H2DField.

This method uses (hence requires) ‘matplotlib’ and ‘basemap’ libraries.

point_is_inside_domain_ij(i=None, j=None, margin=-0.1, subzone=None)

Returns True if the point(s) of i/j coordinates is(are) inside the field.

Parameters:
  • i – X index of point
  • j – Y index of point.
  • margin – considers the point inside if at least ‘margin’ points far from the border. The -0.1 default is a safety for precision errors.
  • subzone – considers only a subzone among (‘C’, ‘CI’) of the domain.
point_is_inside_domain_ll(lon, lat, margin=-0.1, subzone=None, position=None)

Returns True if the point(s) of lon/lat coordinates is(are) inside the field.

Parameters:
  • lon – longitude of point(s) in degrees.
  • lat – latitude of point(s) in degrees.
  • margin – considers the point inside if at least ‘margin’ points far from the border. The -0.1 default is a safety for precision errors.
  • subzone – considers only a subzone among (‘C’, ‘CI’) of the domain.
  • position – position of the grid with respect to the model cell. Defaults to self.position_on_horizontal_grid.
projected_geometry

Is the geometry a projection ?

realkind

Actual footprint kind, by default the clskind.

rectangular_grid

Is the grid rectangular ?

reproject_wind_on_lonlat(u, v, lon=None, lat=None, map_factor_correction=True, reverse=False)

Reprojects a wind vector (u, v) on the grid onto real axes, i.e. with components on true zonal/meridian axes.

Parameters:
  • u – the u == zonal-on-the-grid component of wind
  • v – the v == meridian-on-the-grid component of wind
  • lon – longitudes of points in degrees, if u/v are not vectors on the whole grid
  • lat – latitudes of points in degrees, if u/v are not vectors on the whole grid
:param map_factor_correction:, applies a correction of magnitude due
to map factor.
Parameters:reverse – if True, apply the reverse reprojection.
reshape_data(data, first_dimension=None, d4=False, subzone=None)

Returns a 2D data (horizontal dimensions) reshaped from 1D, according to geometry.

Parameters:
  • data – the 1D data (or 3D with a T and Z dimensions, or 2D with either a T/Z dimension, to be specified), of dimension concording with geometry. In case data is 3D, T must be first dimension and Z the second.
  • first_dimension – in case data is 2D, specify what is the first dimension of data among (‘T’, ‘Z’)
  • subzone – optional, among (‘C’, ‘CI’), for LAM grids only, informes that data is resp. on the C or C+I zone off the C+I(+E) zone.
  • d4
    • if True, returned values are shaped in a 4 dimensions array
    • if False, shape of returned values is determined with respect to geometry
resolution_ij(i, j)

Returns the distance to the nearest point of (i,j) point.

Parameters:
  • i – X index of point in the 2D matrix of gridpoints
  • j – Y index of point in the 2D matrix of gridpoints
resolution_ll(lon, lat)

Returns the local resolution at the nearest point of lon/lat. It’s the distance between this point and its closest neighbour.

Parameters:
  • lon – longitude of the point in degrees
  • lat – latitude of the point in degrees
secant_projection

Is the projection secant to the sphere ? (or tangent)

select_subzone(subzone)

If a LAMzone defines the geometry, select only the subzone from it and return a new geometry object.

Parameters:subzone – among (‘C’, ‘CI’).
what(out=<open file '<stdout>', mode 'w'>, vertical_geometry=True, arpifs_var_names=False, spectral_geometry=None)

Writes in file a summary of the geometry.

Parameters:
  • out – the output open file-like object (duck-typing: out.write() only is needed).
  • vertical_geometry – if True, writes the vertical geometry of the field.
  • arpifs_var_names – if True, prints the equivalent ‘arpifs’ variable names.
  • spectral_geometry – an optional dict containing the spectral truncatures {‘in_X’:, ‘in_Y’:} (LAM) or {‘max’:} (global).
xy2ij(x, y, position=None)

Return the (i, j) indexes of point (x, y), in the 2D matrix of gridpoints.

Parameters:
  • x – X coordinate of point in the projection
  • y – Y coordinate of point in the projection
  • position – position to return with respect to the model cell. Defaults to self.position_on_horizontal_grid.

Caution: (i,j) are float (the nearest grid point is the nearest integer).

Note that origin of coordinates in projection is the center of the C+I domain.

xy2ll(x, y)

Return the (lon, lat) coordinates of point (x, y) in the 2D matrix of gridpoints*(i,j)*, in degrees.

Parameters:
  • x – X coordinate of point in the projection
  • y – Y coordinate of point in the projection

Note that origin of coordinates in projection is the center of the C+I domain.

SUPER, footprint_clone

class epygram.geometries.H2DGeometry.H2DGaussGeometry(*args, **kwargs)[source]

Bases: epygram.geometries.H2DGeometry.H2DGeometry, epygram.geometries.D3Geometry.D3GaussGeometry

Handles the geometry for a Global Gauss grid Horizontal 2-Dimensions Field.

Note

This class is managed by footprint.

  • info: Not documented
  • priority: PriorityLevel::DEFAULT (rank=1)

Automatic parameters from the footprint:

  • dimensions (footprints.stdtypes.FPDict) - rxx - Handles grid dimensions.
  • geoid (footprints.stdtypes.FPDict) - rxx - To specify geoid shape; actually used in projected geometries only.
    • Optional. Default is FPDict::<<as_dict:: dict()>>.
  • grid (footprints.stdtypes.FPDict) - rxx - Handles description of the horizontal grid.
  • name (str) - rxx - Name of geometrical type of representation of points on the Globe.
    • Values: set([‘reduced_gauss’, ‘regular_gauss’, ‘rotated_reduced_gauss’])
  • position_on_horizontal_grid (str) - rwx - Position of points w/r to the horizontal.
    • Optional. Default is ‘__unknown__’.
    • Values: set([‘center-left’, ‘lower-right’, ‘upper-right’, ‘lower-center’, ‘lower-left’, ‘center-right’, ‘upper-left’, ‘__unknown__’, ‘upper-center’, ‘center’])
  • structure (str) - rxx - Type of geometry.
    • Values: set([‘H2D’])
  • vcoordinate (epygram.geometries.VGeometry.VGeometry) - rwx - Handles vertical geometry parameters.