cf.Field.compute_vertical_coordinates¶

Field.
compute_vertical_coordinates
(default_to_zero=True, strict=True, inplace=False, verbose=None)[source]¶ Compute nonparametric vertical coordinates.
When vertical coordinates are a function of horizontal location as well as parameters which depend on vertical location, they cannot be stored in a vertical dimension coordinate construct. In such cases a parametric vertical dimension coordinate construct is stored and a coordinate reference construct contains the formula for computing the required nonparametric vertical coordinates.
See the parametric vertical coordinate sections of the CF
conventions for more details:
4.3.3. Parametric Vertical Coordinate
Appendix D: Parametric Vertical Coordinates
For example, multidimensional nonparametric parametric ocean altitude coordinates can be computed from onedimensional parametric ocean sigma coordinates.
Coordinate reference systems based on parametric vertical coordinates are identified from the coordinate reference constructs and, if possible, the corresponding nonparametric vertical coordinates are computed and stored in a new auxiliary coordinate construct.
If there are no appropriate coordinate reference constructs then the field construct is unchanged.
New in version 3.8.0.
See also
 Parameters
 default_to_zero:
bool
, optional If False then do not assume that missing terms have a value of zero. By default a missing term is assumed to be zero.
 strict:
bool
If False then allow the computation to occur when
A domain ancillary construct has no standard name, but the corresponding term has a standard name that is prescribed
When the computed standard name can not be found by inference from the standard names of the domain ancillary constructs, nor from the
computed_standard_name
parameter of the relevant coordinate reference construct.
By default an exception is raised in these cases.
If a domain ancillary construct does have a standard name, but one that is inconsistent with any prescribed standard names, then an exception is raised regardless of the value of strict.
 inplace:
bool
, optional If True then do the operation inplace and return
None
. verbose:
int
orstr
orNone
, optional If an integer from
1
to3
, or an equivalent string equal ignoring case to one of:'DISABLE'
(0
)'WARNING'
(1
)'INFO'
(2
)'DETAIL'
(3
)'DEBUG'
(1
)
set for the duration of the method call only as the minimum cutoff for the verboseness level of displayed output (log) messages, regardless of the globallyconfigured
cf.log_level
. Note that increasing numerical value corresponds to increasing verbosity, with the exception of1
as a special case of maximal and extreme verbosity.Otherwise, if
None
(the default value), output messages will be shown according to the value of thecf.log_level
setting.Overall, the higher a nonnegative integer or equivalent string that is set (up to a maximum of
3
/'DETAIL'
) for increasing verbosity, the more description that is printed to convey information about the operation.
 default_to_zero:
 Returns
Examples
>>> f = cf.example_field(1) >>> print(f) Field: air_temperature (ncvar%ta)  Data : air_temperature(atmosphere_hybrid_height_coordinate(1), grid_latitude(10), grid_longitude(9)) K Cell methods : grid_latitude(10): grid_longitude(9): mean where land (interval: 0.1 degrees) time(1): maximum Field ancils : air_temperature standard_error(grid_latitude(10), grid_longitude(9)) = [[0.76, ..., 0.32]] K Dimension coords: atmosphere_hybrid_height_coordinate(1) = [1.5] : grid_latitude(10) = [2.2, ..., 1.76] degrees : grid_longitude(9) = [4.7, ..., 1.18] degrees : time(1) = [20190101 00:00:00] Auxiliary coords: latitude(grid_latitude(10), grid_longitude(9)) = [[53.941, ..., 50.225]] degrees_N : longitude(grid_longitude(9), grid_latitude(10)) = [[2.004, ..., 8.156]] degrees_E : long_name=Grid latitude name(grid_latitude(10)) = [, ..., b'kappa'] Cell measures : measure:area(grid_longitude(9), grid_latitude(10)) = [[2391.9657, ..., 2392.6009]] km2 Coord references: grid_mapping_name:rotated_latitude_longitude : standard_name:atmosphere_hybrid_height_coordinate Domain ancils : ncvar%a(atmosphere_hybrid_height_coordinate(1)) = [10.0] m : ncvar%b(atmosphere_hybrid_height_coordinate(1)) = [20.0] : surface_altitude(grid_latitude(10), grid_longitude(9)) = [[0.0, ..., 270.0]] m >>> print(f.auxiliary_coordinate('altitude', default=None)) None >>> g = f.compute_vertical_coordinates() >>> print(g.auxiliary_coordinates) Constructs: {'auxiliarycoordinate0': <CF AuxiliaryCoordinate: latitude(10, 9) degrees_N>, 'auxiliarycoordinate1': <CF AuxiliaryCoordinate: longitude(9, 10) degrees_E>, 'auxiliarycoordinate2': <CF AuxiliaryCoordinate: long_name=Grid latitude name(10) >, 'auxiliarycoordinate3': <CF AuxiliaryCoordinate: altitude(1, 10, 9) m>} >>> g.auxiliary_coordinate('altitude').dump() Auxiliary coordinate: altitude long_name = 'Computed from parametric atmosphere_hybrid_height_coordinate vertical coordinates' standard_name = 'altitude' units = 'm' Data(1, 10, 9) = [[[10.0, ..., 5410.0]]] m Bounds:units = 'm' Bounds:Data(1, 10, 9, 2) = [[[[5.0, ..., 5415.0]]]] m