epygram.geometries.VGeometry — Vertical Geometry class

Contains the class for Vertical geometry of fields.


class epygram.geometries.VGeometry.VGeometry(*args, **kw)[source]

Bases: epygram.util.RecursiveObject, footprints.FootprintBase

Handles the vertical geometry for fields.

Here, the grid defines the vertical position of each level between a bottom and a top positions.

The position of points w/r to the vertical grid (mass or flux points), is interpreted as:

  • mass: points are located on same levels as the grid points.
  • flux: points are located on half-levels, hence are N+1.

levels is a list with one item for each level represented in data. Each item can be a scalar (constant value for all the data point),

an array with the horizontal geographic shape (level constant in time but varying on the horizontal), an array with the first dimension corresponding to the validity lengthy and other dimensions to represent the horizotal.

It is not allowed to have a level varying in time and constant on the geographic domain.

Note

This class is managed by footprint.

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

Automatic parameters from the footprint:

  • grid (footprints.stdtypes.FPDict) - rxx - Handles description of the vertical grid.
    • Optional. Default is FPDict::<<as_dict:: dict()>>.
  • levels (footprints.stdtypes.FPList) - rxx - Effective levels on which data is available.
  • position_on_grid (str) - rxx - Position of points w/r to the vertical grid.
    • Optional. Default is ‘__unknown__’.
    • Values: set([‘flux’, ‘mass’, ‘__unknown__’])
  • structure (str) - rxx - Not documented, sorry.
    • Values: set([‘V’])
  • typeoffirstfixedsurface (int) - rxx - Type of horizontal level, as of GRIB2 norm (inspired from GRIB_API).
what(out=<open file '<stdout>', mode 'w'>, levels=True)[source]

Writes in file a summary of the geometry.

Parameters:
  • out – the output open file-like object
  • levels – if True, writes the levels of the geometry

Functions

epygram.geometries.VGeometry.hybridP2pressure(hybridP_geometry, Psurf, vertical_mean, gridposition=None)[source]

Converts a ‘hybrid_pressure’ VGeometry to a ‘pressure’ (in hPa) VGeometry.

Parameters:
  • Psurf – the surface pressure in Pa, needed for integration of Ai and Bi.
  • gridposition – (= ‘mass’ or ‘flux’) is the target grid position. By default the data position in the origin geometry is taken.
  • vertical_mean – defines the kind of averaging done on the vertical to compute half-levels from full-levels, or inverse: ‘geometric’ or ‘arithmetic’.
epygram.geometries.VGeometry.hybridH2pressure(hybridH_geometry, P, position)[source]

Converts a hybrid_height coordinate grid into pressure (in hPa).

Parameters:
  • P – the vertical profile of pressure to use
  • position – the position of P values on the grid (‘mass’ or ‘flux’)
epygram.geometries.VGeometry.hybridP2altitude(hybridP_geometry, R, T, Psurf, vertical_mean, Pdep=0.0, Phi_surf=None)[source]

Converts a hybrid_pressure coordinate grid into altitude of mass levels.

Parameters:
  • R – the profile of specific gas constant (J/kg/K).
  • T – the profile of temperature (K).
  • Psurf – the surface pressure, needed for integration of Ai and Bi.
  • Pdep – the optional profile of NH pressure departures.
  • Phi_surf – the optional surface geopotential. If given, the final coordinate is altitude above sea level, else height above ground surface.
  • vertical_mean – defines the kind of averaging done on the vertical to compute half-levels from full-levels, or inverse: ‘geometric’ or ‘arithmetic’.
epygram.geometries.VGeometry.hybridH2altitude(hybridH_geometry, Zsurf, gridposition=None, conv2height=False)[source]

Converts a hybrid_height coordinate grid into altitude.

Parameters:
  • Zsurf – the surface pressure, needed for integration of Ai and Bi.
  • gridposition – if given (‘mass’ or ‘flux’), the target grid is computed accordingly. By default the data position in the origin geometry is taken.
  • conv2height – if True, conversion into height is performed instead of altitude.
epygram.geometries.VGeometry.pressure2altitude(pressure_geometry, R, T, vertical_mean, Pdep=0.0, Phi_surf=0.0)[source]

Converts a pressure coordinate grid (on mass or flux levels) to altitude on mass levels).

Parameters:
  • R – the profile of specific gas constant (J/kg/K).
  • T – the profile of temperature (K).
  • Pdep – the optional profile of NH pressure departures.
  • Phi_surf – the optional surface geopotential. If given, the final coordinate is altitude above sea level, else height above ground surface.
  • vertical_mean – defines the kind of averaging done on the vertical to compute half-levels from full-levels, or inverse: ‘geometric’ or ‘arithmetic’.
epygram.geometries.VGeometry.hybridP_coord_and_surfpressure_to_3D_pressure_field(hybridP_geometry, Psurf, vertical_mean, gridposition=None)[source]

From a hybridP Vgeometry and a surface pressure (in Pa) H2D field, compute a 3D field containing the pressure (in hPa) at each hybridP level for each gridpoint.

Parameters:
  • hybridP_geometry – the hybridP VGeometry
  • Psurf – the surface pressure field in Pa, needed for integration of Ai and Bi.
  • vertical_mean – defines the kind of averaging done on the vertical to compute half-levels from full-levels, or inverse: ‘geometric’ or ‘arithmetic’.
  • gridposition – (= ‘mass’ or ‘flux’) is the target grid position. By default the data position in the origin geometry is taken.