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 (
builtins.str
) - rwx - Position of points w/r to the vertical grid.- Optional. Default is ‘__unknown__’.
- Values: set([‘__unknown__’, ‘flux’, ‘mass’])
- structure (
builtins.str
) - rxx - Not documented, sorry.- Values: set([‘V’])
- typeoffirstfixedsurface (
builtins.int
) - rxx - Type of horizontal level, as of GRIB2 norm (inspired from GRIB_API).
-
grid
¶ Undocumented footprint attribute
-
levels
¶ Undocumented footprint attribute
-
position_on_grid
¶ Undocumented footprint attribute
-
structure
¶ Undocumented footprint attribute
-
to_vgrid
(**kwargs)[source]¶ Convert the VGeometry object to a
vgrid
one.Other kwargs passed to HybridPressureVGrid() constructor.
-
typeoffirstfixedsurface
¶ Undocumented footprint attribute
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: - hybridP_geometry (VGeometry) – the initial vertical coordinate
- Psurf (float) – the surface pressure in Pa, needed for integration of Ai and Bi.
- vertical_mean (str) – defines the kind of averaging done on the vertical to compute half-levels from full-levels, or inverse: ‘geometric’ or ‘arithmetic’.
- gridposition (str) – (= ‘mass’ or ‘flux’) is the target grid position. By default the data position in the origin geometry is taken.
Return type:
-
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’)
Return type:
-
epygram.geometries.VGeometry.
hybridP2altitude
(hybridP_geometry, R, T, Psurf, vertical_mean, Pdep=None, Phi_surf=None)[source]¶ Converts a hybrid_pressure coordinate grid into altitude of mass levels.
Parameters: - hybridP_geometry (VGeometry) – the initial vertical coordinate
- R (list,numpy.ndarray) – the profile of specific gas constant (J/kg/K).
- T (list,numpy.ndarray) – the profile of temperature (K).
- Psurf (float) – the surface pressure, needed for integration of Ai and Bi.
- vertical_mean (str) – defines the kind of averaging done on the vertical to compute half-levels from full-levels, or inverse: ‘geometric’ or ‘arithmetic’.
- Pdep (list,numpy.ndarray) – the optional profile of NH pressure departures.
- Phi_surf (float) – the optional surface geopotential. If given, the final coordinate is altitude above sea level, else height above ground surface.
Return type:
-
epygram.geometries.VGeometry.
hybridH2altitude
(hybridH_geometry, Zsurf, gridposition=None, conv2height=False)[source]¶ Converts a hybrid_height coordinate grid into altitude.
Parameters: - Zsurf – the surface height, 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.
Return type:
-
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 (VGeometry) – the hybridP VGeometry
- Psurf (H2DField) – the surface pressure H2DField in Pa, needed for integration of Ai and Bi.
- vertical_mean (str) – defines the kind of averaging done on the vertical to compute half-levels from full-levels, or inverse: ‘geometric’ or ‘arithmetic’.
- gridposition (str) – (= ‘mass’ or ‘flux’) is the target grid position. By default the data position in the origin geometry is taken.
Return type:
-
epygram.geometries.VGeometry.
hybridP_coord_to_3D_altitude_field
(hybridP_geometry, Psurf, vertical_mean, t3D, q3D, ql3D=None, qi3D=None, qr3D=None, qs3D=None, qg3D=None, Pdep3D=None, Phi_surf=None)[source]¶ From a hybridP Vgeometry, a surface pressure (in Pa) H2D field, and temperature and specific humidity 3D fields, compute a 3D field containing the altitude (in m) at each hybridP level for each gridpoint.
Hydrometeors 3D fields can be provided for more accurate R computation.
Parameters: - hybridP_geometry (VGeometry) – the hybridP VGeometry
- Psurf (H2DField) – the surface pressure H2DField in Pa, needed for integration of Ai and Bi.
- vertical_mean (str) – defines the kind of averaging done on the vertical to compute half-levels from full-levels, or inverse: ‘geometric’ or ‘arithmetic’.
- t3D (D3Field) – temperature D3Field
- q3D (D3Field) – specific humidity D3Field
- ql3D (D3Field) – liquid water content D3Field
- qi3D (D3Field) – ice water content D3Field
- qr3D (D3Field) – rain water content D3Field
- qs3D (D3Field) – snow water content D3Field
- qg3D (D3Field) – graupel water content D3Field
- Pdep3D (D3Field) – non-hydrostatic pressure departure D3Field
- Phi_surf (H2DField) – surface geopotential H2DField (for altitude vs. height)
Return type: