src.data_model module

Classes to describe “abstract” properties of model data: aspects that are independent of any model, experiment, or hosting protocol.

This is based on the CF standard terminology.

class src.data_model.AbstractDMCoordinate[source]

Bases: abc.ABC

Defines interface (set of attributes) for DMCoordinate objects.

abstract property name

Coordinate name (str).

abstract property standard_name

Coordinate CF standard name (str).

abstract property units

Coordinate units (str, or Units).

abstract property axis

Coordinate axis identifier (str, ‘X’, ‘Y’, ‘Z’, ‘T’).

abstract property bounds

Associated bounds variable for the coordinate.

abstract property value

If a scalar coordinate, value of the coordinate in units given by units().

abstract property is_scalar

Whether the coordinate is a scalar coordinate (bool).

abstract property has_bounds

Whether the coordinate has an associated bounds variable (bool).

__init__()

Initialize self. See help(type(self)) for accurate signature.

class src.data_model.AbstractDMDependentVariable[source]

Bases: abc.ABC

Defines interface (set of attributes) for “dependent variables” (data defined as a function of one or more dimension coordinates), which inherit from DMDimensions in this implementation.

abstract property name

Variable name (str).

abstract property standard_name

Variable CF standard name (str).

abstract property units

Variable units (str, or Units).

abstract property dims
abstract property scalar_coords
abstract property axes
abstract property all_axes
abstract property X

X axis coordinate of variable, if defined.

abstract property Y

Y axis coordinate of variable, if defined.

abstract property Z

Z axis coordinate of variable, if defined.

abstract property T

T axis coordinate of variable, if defined.

abstract property is_static

Whether the variable has time dependence (bool).

__init__()

Initialize self. See help(type(self)) for accurate signature.

class src.data_model.AbstractDMCoordinateBounds[source]

Bases: src.data_model.AbstractDMDependentVariable

Defines interface (set of attributes) for DMCoordinateBounds objects.

abstract property coord

DMCoordinate object which this object is the bounds of.

abstract property T

T axis coordinate of variable, if defined.

abstract property X

X axis coordinate of variable, if defined.

abstract property Y

Y axis coordinate of variable, if defined.

abstract property Z

Z axis coordinate of variable, if defined.

__init__()

Initialize self. See help(type(self)) for accurate signature.

abstract property all_axes
abstract property axes
abstract property dims
abstract property is_static

Whether the variable has time dependence (bool).

abstract property name

Variable name (str).

abstract property scalar_coords
abstract property standard_name

Variable CF standard name (str).

abstract property units

Variable units (str, or Units).

class src.data_model.DMBoundsDimension(name: str = sentinel.Mandatory)[source]

Bases: object

Placeholder object to represent the bounds dimension of a DMCoordinateBounds object. Not a dimension coordinate, and strictly speaking we should make another set of classes for dimensions.

name: str = sentinel.Mandatory
standard_name = 'bounds'
axis = 'BOUNDS'
bounds = None
value = None
property has_bounds

Whether the coordinate has an associated bounds variable (bool). Always False for this class.

property is_scalar

Whether the coordinate is a scalar coordinate (bool). Always False for this class.

__init__(name: str = sentinel.Mandatory)None

Initialize self. See help(type(self)) for accurate signature.

__post_init__(*args, **kwargs)
class src.data_model.DMCoordinate(standard_name: str = sentinel.Mandatory, units: src.units.Units = sentinel.Mandatory, axis: str = 'OTHER', bounds_var: src.data_model.AbstractDMCoordinateBounds = None, value: Union[int, float] = None, name: str = sentinel.Mandatory)[source]

Bases: src.data_model._DMCoordinateShared

Class to describe a single coordinate variable (dimension coordinate or scalar coordinate, in the sense used by the CF conventions).

name: str = sentinel.Mandatory
standard_name: str = sentinel.Mandatory
units: src.units.Units = sentinel.Mandatory
axis: str = 'OTHER'
__init__(standard_name: str = sentinel.Mandatory, units: src.units.Units = sentinel.Mandatory, axis: str = 'OTHER', bounds_var: src.data_model.AbstractDMCoordinateBounds = None, value: Union[int, float] = None, name: str = sentinel.Mandatory)None

Initialize self. See help(type(self)) for accurate signature.

__post_init__(*args, **kwargs)
property bounds

Store bounds_var as a pointer to the actual object representing the bounds variable for this coordinate, but in order to parallel xarray’s syntax define ‘bounds’ to return the name of this variable, not the variable itself.

bounds_var = None
property has_bounds

Whether the coordinate has an associated bounds variable (bool).

property is_scalar

Whether the coordinate is a scalar coordinate (bool).

make_scalar(new_value)

Returns a copy of the coordinate, converted to a scalar coordinate at value new_value (and coordinate’s current units.)

value = None
class src.data_model.DMLongitudeCoordinate(standard_name: str = 'longitude', units: src.units.Units = 'degrees_east', axis: str = 'X', bounds_var: src.data_model.AbstractDMCoordinateBounds = None, value: Union[int, float] = None, name: str = 'lon')[source]

Bases: src.data_model._DMCoordinateShared

Class to describe a longitude dimension coordinate.

name: str = 'lon'
standard_name: str = 'longitude'
units: src.units.Units = 'degrees_east'
axis: str = 'X'
__init__(standard_name: str = 'longitude', units: src.units.Units = 'degrees_east', axis: str = 'X', bounds_var: src.data_model.AbstractDMCoordinateBounds = None, value: Union[int, float] = None, name: str = 'lon')None

Initialize self. See help(type(self)) for accurate signature.

__post_init__(*args, **kwargs)
property bounds

Store bounds_var as a pointer to the actual object representing the bounds variable for this coordinate, but in order to parallel xarray’s syntax define ‘bounds’ to return the name of this variable, not the variable itself.

bounds_var = None
property has_bounds

Whether the coordinate has an associated bounds variable (bool).

property is_scalar

Whether the coordinate is a scalar coordinate (bool).

make_scalar(new_value)

Returns a copy of the coordinate, converted to a scalar coordinate at value new_value (and coordinate’s current units.)

value = None
class src.data_model.DMLatitudeCoordinate(standard_name: str = 'latitude', units: src.units.Units = 'degrees_north', axis: str = 'Y', bounds_var: src.data_model.AbstractDMCoordinateBounds = None, value: Union[int, float] = None, name: str = 'lat')[source]

Bases: src.data_model._DMCoordinateShared

Class to describe a latitude dimension coordinate.

name: str = 'lat'
standard_name: str = 'latitude'
units: src.units.Units = 'degrees_north'
axis: str = 'Y'
__init__(standard_name: str = 'latitude', units: src.units.Units = 'degrees_north', axis: str = 'Y', bounds_var: src.data_model.AbstractDMCoordinateBounds = None, value: Union[int, float] = None, name: str = 'lat')None

Initialize self. See help(type(self)) for accurate signature.

__post_init__(*args, **kwargs)
property bounds

Store bounds_var as a pointer to the actual object representing the bounds variable for this coordinate, but in order to parallel xarray’s syntax define ‘bounds’ to return the name of this variable, not the variable itself.

bounds_var = None
property has_bounds

Whether the coordinate has an associated bounds variable (bool).

property is_scalar

Whether the coordinate is a scalar coordinate (bool).

make_scalar(new_value)

Returns a copy of the coordinate, converted to a scalar coordinate at value new_value (and coordinate’s current units.)

value = None
class src.data_model.DMVerticalCoordinate(standard_name: str = sentinel.Mandatory, units: src.units.Units = '1', axis: str = 'Z', bounds_var: src.data_model.AbstractDMCoordinateBounds = None, value: Union[int, float] = None, name: str = sentinel.Mandatory, positive: str = sentinel.Mandatory)[source]

Bases: src.data_model._DMCoordinateShared

Class to describe a non-parametric vertical coordinate (height or depth), following the CF conventions.

name: str = sentinel.Mandatory
standard_name: str = sentinel.Mandatory
units: src.units.Units = '1'
axis: str = 'Z'
positive: str = sentinel.Mandatory
__init__(standard_name: str = sentinel.Mandatory, units: src.units.Units = '1', axis: str = 'Z', bounds_var: src.data_model.AbstractDMCoordinateBounds = None, value: Union[int, float] = None, name: str = sentinel.Mandatory, positive: str = sentinel.Mandatory)None

Initialize self. See help(type(self)) for accurate signature.

__post_init__(*args, **kwargs)
property bounds

Store bounds_var as a pointer to the actual object representing the bounds variable for this coordinate, but in order to parallel xarray’s syntax define ‘bounds’ to return the name of this variable, not the variable itself.

bounds_var = None
property has_bounds

Whether the coordinate has an associated bounds variable (bool).

property is_scalar

Whether the coordinate is a scalar coordinate (bool).

make_scalar(new_value)

Returns a copy of the coordinate, converted to a scalar coordinate at value new_value (and coordinate’s current units.)

value = None
class src.data_model.DMParametricVerticalCoordinate(standard_name: str = sentinel.Mandatory, units: src.units.Units = '1', axis: str = 'Z', bounds_var: src.data_model.AbstractDMCoordinateBounds = None, value: Union[int, float] = None, name: str = sentinel.Mandatory, positive: str = sentinel.Mandatory, computed_standard_name: str = '', long_name: str = '', formula_terms: str = None)[source]

Bases: src.data_model.DMVerticalCoordinate

Class to describe parametric vertical coordinates. Note that the variable names appearing in formula_terms aren’t parsed here, in order to keep the class hashable.

computed_standard_name: str = ''
long_name: str = ''
formula_terms: str = None
__init__(standard_name: str = sentinel.Mandatory, units: src.units.Units = '1', axis: str = 'Z', bounds_var: src.data_model.AbstractDMCoordinateBounds = None, value: Union[int, float] = None, name: str = sentinel.Mandatory, positive: str = sentinel.Mandatory, computed_standard_name: str = '', long_name: str = '', formula_terms: str = None)None

Initialize self. See help(type(self)) for accurate signature.

__post_init__(*args, **kwargs)
axis = 'Z'
property bounds

Store bounds_var as a pointer to the actual object representing the bounds variable for this coordinate, but in order to parallel xarray’s syntax define ‘bounds’ to return the name of this variable, not the variable itself.

bounds_var = None
property has_bounds

Whether the coordinate has an associated bounds variable (bool).

property is_scalar

Whether the coordinate is a scalar coordinate (bool).

make_scalar(new_value)

Returns a copy of the coordinate, converted to a scalar coordinate at value new_value (and coordinate’s current units.)

name = sentinel.Mandatory
positive = sentinel.Mandatory
standard_name = sentinel.Mandatory
units = '1'
value = None
class src.data_model.DMGenericTimeCoordinate(standard_name: str = 'time', units: src.units.Units = '', axis: str = 'T', bounds_var: src.data_model.AbstractDMCoordinateBounds = None, value: Union[int, float] = None, name: str = 'time', calendar: str = '', range: Any = None)[source]

Bases: src.data_model._DMCoordinateShared

Applies to collections of variables, which may be at different time frequencies (or other attributes).

name: str = 'time'
standard_name: str = 'time'
units: src.units.Units = ''
axis: str = 'T'
calendar: str = ''
range: Any = None
property is_static

Check for time-independent data (‘fx’ in CMIP6 DRS.) Do the comparison by checking date_range against the placeholder value because that’s unique – we may be using a different DateFrequency depending on the data source.

classmethod from_instances(*t_coords)[source]

Create new instance from “union” of attributes of one or more t_coords.

__init__(standard_name: str = 'time', units: src.units.Units = '', axis: str = 'T', bounds_var: src.data_model.AbstractDMCoordinateBounds = None, value: Union[int, float] = None, name: str = 'time', calendar: str = '', range: Any = None)None

Initialize self. See help(type(self)) for accurate signature.

__post_init__(*args, **kwargs)
property bounds

Store bounds_var as a pointer to the actual object representing the bounds variable for this coordinate, but in order to parallel xarray’s syntax define ‘bounds’ to return the name of this variable, not the variable itself.

bounds_var = None
property has_bounds

Whether the coordinate has an associated bounds variable (bool).

property is_scalar

Whether the coordinate is a scalar coordinate (bool).

make_scalar(new_value)

Returns a copy of the coordinate, converted to a scalar coordinate at value new_value (and coordinate’s current units.)

value = None
class src.data_model.DMTimeCoordinate(standard_name: str = 'time', units: src.units.Units = sentinel.Mandatory, axis: str = 'T', bounds_var: src.data_model.AbstractDMCoordinateBounds = None, value: Union[int, float] = None, name: str = sentinel.Mandatory, calendar: str = '', range: src.util.datelabel.AbstractDateRange = None, frequency: src.util.datelabel.AbstractDateFrequency = None)[source]

Bases: src.data_model.DMGenericTimeCoordinate

name: str = sentinel.Mandatory
standard_name: str = 'time'
units: src.units.Units = sentinel.Mandatory
axis: str = 'T'
calendar: str = ''
range: src.util.datelabel.AbstractDateRange = None
frequency: src.util.datelabel.AbstractDateFrequency = None
classmethod from_instances(*t_coords)[source]

Create new instance from “union” of attributes of one or more t_coords.

__init__(standard_name: str = 'time', units: src.units.Units = sentinel.Mandatory, axis: str = 'T', bounds_var: src.data_model.AbstractDMCoordinateBounds = None, value: Union[int, float] = None, name: str = sentinel.Mandatory, calendar: str = '', range: src.util.datelabel.AbstractDateRange = None, frequency: src.util.datelabel.AbstractDateFrequency = None)None

Initialize self. See help(type(self)) for accurate signature.

__post_init__(*args, **kwargs)
property bounds

Store bounds_var as a pointer to the actual object representing the bounds variable for this coordinate, but in order to parallel xarray’s syntax define ‘bounds’ to return the name of this variable, not the variable itself.

bounds_var = None
property has_bounds

Whether the coordinate has an associated bounds variable (bool).

property is_scalar

Whether the coordinate is a scalar coordinate (bool).

property is_static

Check for time-independent data (‘fx’ in CMIP6 DRS.) Do the comparison by checking date_range against the placeholder value because that’s unique – we may be using a different DateFrequency depending on the data source.

make_scalar(new_value)

Returns a copy of the coordinate, converted to a scalar coordinate at value new_value (and coordinate’s current units.)

value = None
src.data_model.coordinate_from_struct(d, class_dict=None, **kwargs)[source]

Attempt to instantiate the correct DMCoordinate class based on information in d.

TODO: implement full cf_xarray/MetPy heuristics.

class src.data_model.DMPlaceholderCoordinate(standard_name: str = NotImplemented, units: src.units.Units = NotImplemented, axis: str = 'OTHER', bounds_var: src.data_model.AbstractDMCoordinateBounds = None, value: Union[int, float] = None, name: str = 'PLACEHOLDER_COORD')[source]

Bases: src.data_model._DMCoordinateShared, src.data_model._DMPlaceholderCoordinateBase

Dummy base class for placeholder coordinates. Placeholder coordinates are only used in instantiating FieldlistEntry objects: they’re replaced by the appropriate translated coordinates when that object is used to create a TranslatedVarlistEntry object.

name: str = 'PLACEHOLDER_COORD'
standard_name: str = NotImplemented
units: src.units.Units = NotImplemented
axis: str = 'OTHER'
__init__(standard_name: str = NotImplemented, units: src.units.Units = NotImplemented, axis: str = 'OTHER', bounds_var: src.data_model.AbstractDMCoordinateBounds = None, value: Union[int, float] = None, name: str = 'PLACEHOLDER_COORD')None

Initialize self. See help(type(self)) for accurate signature.

__post_init__(*args, **kwargs)
property bounds

Store bounds_var as a pointer to the actual object representing the bounds variable for this coordinate, but in order to parallel xarray’s syntax define ‘bounds’ to return the name of this variable, not the variable itself.

bounds_var = None
property has_bounds

Whether the coordinate has an associated bounds variable (bool).

property is_scalar

Whether the coordinate is a scalar coordinate (bool).

make_scalar(new_value)

Returns a copy of the coordinate, converted to a scalar coordinate at value new_value (and coordinate’s current units.)

value = None
class src.data_model.DMPlaceholderXCoordinate(standard_name: str = NotImplemented, units: src.units.Units = NotImplemented, axis: str = 'X', bounds_var: src.data_model.AbstractDMCoordinateBounds = None, value: Union[int, float] = None, name: str = 'PLACEHOLDER_X_COORD')[source]

Bases: src.data_model._DMCoordinateShared, src.data_model._DMPlaceholderCoordinateBase

Dummy base class for placeholder X axis coordinates. Placeholder coordinates are only used in instantiating FieldlistEntry objects: they’re replaced by the appropriate translated coordinates when that object is used to create a TranslatedVarlistEntry object.

name: str = 'PLACEHOLDER_X_COORD'
standard_name: str = NotImplemented
units: src.units.Units = NotImplemented
axis: str = 'X'
__init__(standard_name: str = NotImplemented, units: src.units.Units = NotImplemented, axis: str = 'X', bounds_var: src.data_model.AbstractDMCoordinateBounds = None, value: Union[int, float] = None, name: str = 'PLACEHOLDER_X_COORD')None

Initialize self. See help(type(self)) for accurate signature.

__post_init__(*args, **kwargs)
property bounds

Store bounds_var as a pointer to the actual object representing the bounds variable for this coordinate, but in order to parallel xarray’s syntax define ‘bounds’ to return the name of this variable, not the variable itself.

bounds_var = None
property has_bounds

Whether the coordinate has an associated bounds variable (bool).

property is_scalar

Whether the coordinate is a scalar coordinate (bool).

make_scalar(new_value)

Returns a copy of the coordinate, converted to a scalar coordinate at value new_value (and coordinate’s current units.)

value = None
class src.data_model.DMPlaceholderYCoordinate(standard_name: str = NotImplemented, units: src.units.Units = NotImplemented, axis: str = 'Y', bounds_var: src.data_model.AbstractDMCoordinateBounds = None, value: Union[int, float] = None, name: str = 'PLACEHOLDER_Y_COORD')[source]

Bases: src.data_model._DMCoordinateShared, src.data_model._DMPlaceholderCoordinateBase

Dummy base class for placeholder Y axis coordinates. Placeholder coordinates are only used in instantiating FieldlistEntry objects: they’re replaced by the appropriate translated coordinates when that object is used to create a TranslatedVarlistEntry object.

name: str = 'PLACEHOLDER_Y_COORD'
standard_name: str = NotImplemented
units: src.units.Units = NotImplemented
axis: str = 'Y'
__init__(standard_name: str = NotImplemented, units: src.units.Units = NotImplemented, axis: str = 'Y', bounds_var: src.data_model.AbstractDMCoordinateBounds = None, value: Union[int, float] = None, name: str = 'PLACEHOLDER_Y_COORD')None

Initialize self. See help(type(self)) for accurate signature.

__post_init__(*args, **kwargs)
property bounds

Store bounds_var as a pointer to the actual object representing the bounds variable for this coordinate, but in order to parallel xarray’s syntax define ‘bounds’ to return the name of this variable, not the variable itself.

bounds_var = None
property has_bounds

Whether the coordinate has an associated bounds variable (bool).

property is_scalar

Whether the coordinate is a scalar coordinate (bool).

make_scalar(new_value)

Returns a copy of the coordinate, converted to a scalar coordinate at value new_value (and coordinate’s current units.)

value = None
class src.data_model.DMPlaceholderZCoordinate(standard_name: str = NotImplemented, units: src.units.Units = NotImplemented, axis: str = 'Z', bounds_var: src.data_model.AbstractDMCoordinateBounds = None, value: Union[int, float] = None, name: str = 'PLACEHOLDER_Z_COORD', positive: str = NotImplemented)[source]

Bases: src.data_model._DMCoordinateShared, src.data_model._DMPlaceholderCoordinateBase

Dummy base class for placeholder Z axis coordinates. Placeholder coordinates are only used in instantiating FieldlistEntry objects: they’re replaced by the appropriate translated coordinates when that object is used to create a TranslatedVarlistEntry object.

name: str = 'PLACEHOLDER_Z_COORD'
standard_name: str = NotImplemented
units: src.units.Units = NotImplemented
axis: str = 'Z'
positive: str = NotImplemented
__init__(standard_name: str = NotImplemented, units: src.units.Units = NotImplemented, axis: str = 'Z', bounds_var: src.data_model.AbstractDMCoordinateBounds = None, value: Union[int, float] = None, name: str = 'PLACEHOLDER_Z_COORD', positive: str = NotImplemented)None

Initialize self. See help(type(self)) for accurate signature.

__post_init__(*args, **kwargs)
property bounds

Store bounds_var as a pointer to the actual object representing the bounds variable for this coordinate, but in order to parallel xarray’s syntax define ‘bounds’ to return the name of this variable, not the variable itself.

bounds_var = None
property has_bounds

Whether the coordinate has an associated bounds variable (bool).

property is_scalar

Whether the coordinate is a scalar coordinate (bool).

make_scalar(new_value)

Returns a copy of the coordinate, converted to a scalar coordinate at value new_value (and coordinate’s current units.)

value = None
class src.data_model.DMPlaceholderTCoordinate(standard_name: str = NotImplemented, units: src.units.Units = NotImplemented, axis: str = 'T', bounds_var: src.data_model.AbstractDMCoordinateBounds = None, value: Union[int, float] = None, name: str = 'PLACEHOLDER_T_COORD', calendar: str = NotImplemented, range: Any = None)[source]

Bases: src.data_model._DMCoordinateShared, src.data_model._DMPlaceholderCoordinateBase

Dummy base class for placeholder T axis coordinates. Placeholder coordinates are only used in instantiating FieldlistEntry objects: they’re replaced by the appropriate translated coordinates when that object is used to create a TranslatedVarlistEntry object.

name: str = 'PLACEHOLDER_T_COORD'
standard_name: str = NotImplemented
units: src.units.Units = NotImplemented
axis: str = 'T'
calendar: str = NotImplemented
range: Any = None
property is_static

Check for time-independent data (‘fx’ in CMIP6 DRS.) Do the comparison by checking date_range against the placeholder value because that’s unique – we may be using a different DateFrequency depending on the data source.

__init__(standard_name: str = NotImplemented, units: src.units.Units = NotImplemented, axis: str = 'T', bounds_var: src.data_model.AbstractDMCoordinateBounds = None, value: Union[int, float] = None, name: str = 'PLACEHOLDER_T_COORD', calendar: str = NotImplemented, range: Any = None)None

Initialize self. See help(type(self)) for accurate signature.

__post_init__(*args, **kwargs)
property bounds

Store bounds_var as a pointer to the actual object representing the bounds variable for this coordinate, but in order to parallel xarray’s syntax define ‘bounds’ to return the name of this variable, not the variable itself.

bounds_var = None
property has_bounds

Whether the coordinate has an associated bounds variable (bool).

property is_scalar

Whether the coordinate is a scalar coordinate (bool).

make_scalar(new_value)

Returns a copy of the coordinate, converted to a scalar coordinate at value new_value (and coordinate’s current units.)

value = None
class src.data_model.DMDependentVariable(coords: dataclasses.InitVar = None, name: str = sentinel.Mandatory, standard_name: str = sentinel.Mandatory, units: src.units.Units = '', modifier: str = '')[source]

Bases: src.data_model._DMDimensionsMixin

Base class for any “dependent variable”: all non-dimension-coordinate information that depends on one or more dimension coordinates.

name: str = sentinel.Mandatory
standard_name: str = sentinel.Mandatory
units: src.units.Units = ''
modifier: str = ''
__post_init__(coords=None)[source]
property full_name

Object’s full name, to be used in logging and debugging. Preferred because it eliminates irrelevant information in repr(), which is lengthy.

property axes

Superset of the dim_axes() dict (whose values contain coordinate dimensions only) that includes axes corresponding to scalar coordinates.

property axes_set

Superset of the dim_axes_set() frozenset (which contains axes labels corresponding to coordinate dimensions only) that includes axes labels corresponding to scalar coordinates.

add_scalar(ax, ax_value, **kwargs)[source]

Metadata operation corresponding to taking a slice of a higher-dimensional variable (extracting its values at axis ax = ax_value). The coordinate corresponding to ax is removed from the list of coordinate dimensions and added to the list of scalar coordinates.

remove_scalar(ax, position=- 1, **kwargs)[source]

Metadata operation that’s the inverse of add_scalar(). Given an axis label ax that’s currently a scalar coordinate, remove the slice value and add it to the list of dimension coordinates at position (default end of the list.)

property T

Return T axis dimension coordinate if defined, else None.

property X

Return X axis dimension coordinate if defined, else None.

property Y

Return Y axis dimension coordinate if defined, else None.

property Z

Return Z axis dimension coordinate if defined, else None.

__init__(coords: dataclasses.InitVar = None, name: str = sentinel.Mandatory, standard_name: str = sentinel.Mandatory, units: src.units.Units = '', modifier: str = '')None

Initialize self. See help(type(self)) for accurate signature.

build_axes(*coords, verify=True)

Constructs a dict mapping axes labels to dimension coordinates (of type AbstractDMCoordinate.)

change_coord(ax_name, new_class=None, **kwargs)

Replace attributes on a given coordinate, but also optionally cast them to new classes.

Parameters
  • ax_name – Name of the coodinate to modify.

  • new_class (optional) – new class to cast the returned coordinate to.

  • kwargs – Set of attribute names and values to replace on the returned copy.

coords = None
property dim_axes

Retrun dict mapping axes labels (‘X’, ‘Y’, etc.) to corresponding dimension coordinate objects.

property dim_axes_set

Return frozenset of dimension coordinate axes labels.

get_scalar(ax_name)

If the axis label ax_name is a scalar coordinate, return the corresponding AbstractDMCoordinate object, otherwise return None.

property is_static

Whether the variable has time dependence (bool).

class src.data_model.DMAuxiliaryCoordinate(coords: dataclasses.InitVar = None, name: str = sentinel.Mandatory, standard_name: str = sentinel.Mandatory, units: src.units.Units = '', modifier: str = '')[source]

Bases: src.data_model.DMDependentVariable

Class to describe auxiliary coordinate variables, as defined in the CF conventions. An example would be lat or lon for data presented in a tripolar grid projection.

property T

Return T axis dimension coordinate if defined, else None.

property X

Return X axis dimension coordinate if defined, else None.

property Y

Return Y axis dimension coordinate if defined, else None.

property Z

Return Z axis dimension coordinate if defined, else None.

__init__(coords: dataclasses.InitVar = None, name: str = sentinel.Mandatory, standard_name: str = sentinel.Mandatory, units: src.units.Units = '', modifier: str = '')None

Initialize self. See help(type(self)) for accurate signature.

__post_init__(coords=None)
add_scalar(ax, ax_value, **kwargs)

Metadata operation corresponding to taking a slice of a higher-dimensional variable (extracting its values at axis ax = ax_value). The coordinate corresponding to ax is removed from the list of coordinate dimensions and added to the list of scalar coordinates.

property axes

Superset of the dim_axes() dict (whose values contain coordinate dimensions only) that includes axes corresponding to scalar coordinates.

property axes_set

Superset of the dim_axes_set() frozenset (which contains axes labels corresponding to coordinate dimensions only) that includes axes labels corresponding to scalar coordinates.

build_axes(*coords, verify=True)

Constructs a dict mapping axes labels to dimension coordinates (of type AbstractDMCoordinate.)

change_coord(ax_name, new_class=None, **kwargs)

Replace attributes on a given coordinate, but also optionally cast them to new classes.

Parameters
  • ax_name – Name of the coodinate to modify.

  • new_class (optional) – new class to cast the returned coordinate to.

  • kwargs – Set of attribute names and values to replace on the returned copy.

coords = None
property dim_axes

Retrun dict mapping axes labels (‘X’, ‘Y’, etc.) to corresponding dimension coordinate objects.

property dim_axes_set

Return frozenset of dimension coordinate axes labels.

property full_name

Object’s full name, to be used in logging and debugging. Preferred because it eliminates irrelevant information in repr(), which is lengthy.

get_scalar(ax_name)

If the axis label ax_name is a scalar coordinate, return the corresponding AbstractDMCoordinate object, otherwise return None.

property is_static

Whether the variable has time dependence (bool).

modifier: str = ''
name: str = sentinel.Mandatory
remove_scalar(ax, position=- 1, **kwargs)

Metadata operation that’s the inverse of add_scalar(). Given an axis label ax that’s currently a scalar coordinate, remove the slice value and add it to the list of dimension coordinates at position (default end of the list.)

standard_name: str = sentinel.Mandatory
units: src.units.Units = ''
class src.data_model.DMCoordinateBounds(coords: dataclasses.InitVar = None, name: str = sentinel.Mandatory, standard_name: str = sentinel.Mandatory, units: src.units.Units = '', modifier: str = '')[source]

Bases: src.data_model.DMAuxiliaryCoordinate

Class describing bounds on a dimension coordinate.

__post_init__(coords=None)[source]
property coord

CF dimension coordinate for which this is the bounds.

classmethod from_coordinate(coord, bounds_dim)[source]
property T

Return T axis dimension coordinate if defined, else None.

property X

Return X axis dimension coordinate if defined, else None.

property Y

Return Y axis dimension coordinate if defined, else None.

property Z

Return Z axis dimension coordinate if defined, else None.

__init__(coords: dataclasses.InitVar = None, name: str = sentinel.Mandatory, standard_name: str = sentinel.Mandatory, units: src.units.Units = '', modifier: str = '')None

Initialize self. See help(type(self)) for accurate signature.

add_scalar(ax, ax_value, **kwargs)

Metadata operation corresponding to taking a slice of a higher-dimensional variable (extracting its values at axis ax = ax_value). The coordinate corresponding to ax is removed from the list of coordinate dimensions and added to the list of scalar coordinates.

property axes

Superset of the dim_axes() dict (whose values contain coordinate dimensions only) that includes axes corresponding to scalar coordinates.

property axes_set

Superset of the dim_axes_set() frozenset (which contains axes labels corresponding to coordinate dimensions only) that includes axes labels corresponding to scalar coordinates.

build_axes(*coords, verify=True)

Constructs a dict mapping axes labels to dimension coordinates (of type AbstractDMCoordinate.)

change_coord(ax_name, new_class=None, **kwargs)

Replace attributes on a given coordinate, but also optionally cast them to new classes.

Parameters
  • ax_name – Name of the coodinate to modify.

  • new_class (optional) – new class to cast the returned coordinate to.

  • kwargs – Set of attribute names and values to replace on the returned copy.

coords = None
property dim_axes

Retrun dict mapping axes labels (‘X’, ‘Y’, etc.) to corresponding dimension coordinate objects.

property dim_axes_set

Return frozenset of dimension coordinate axes labels.

property full_name

Object’s full name, to be used in logging and debugging. Preferred because it eliminates irrelevant information in repr(), which is lengthy.

get_scalar(ax_name)

If the axis label ax_name is a scalar coordinate, return the corresponding AbstractDMCoordinate object, otherwise return None.

property is_static

Whether the variable has time dependence (bool).

modifier: str = ''
name: str = sentinel.Mandatory
remove_scalar(ax, position=- 1, **kwargs)

Metadata operation that’s the inverse of add_scalar(). Given an axis label ax that’s currently a scalar coordinate, remove the slice value and add it to the list of dimension coordinates at position (default end of the list.)

standard_name: str = sentinel.Mandatory
units: src.units.Units = ''
class src.data_model.DMVariable(coords: dataclasses.InitVar = None, name: str = sentinel.Mandatory, standard_name: str = sentinel.Mandatory, units: src.units.Units = '', modifier: str = '')[source]

Bases: src.data_model.DMDependentVariable

Class to describe general properties of data variables.

property T

Return T axis dimension coordinate if defined, else None.

property X

Return X axis dimension coordinate if defined, else None.

property Y

Return Y axis dimension coordinate if defined, else None.

property Z

Return Z axis dimension coordinate if defined, else None.

__init__(coords: dataclasses.InitVar = None, name: str = sentinel.Mandatory, standard_name: str = sentinel.Mandatory, units: src.units.Units = '', modifier: str = '')None

Initialize self. See help(type(self)) for accurate signature.

__post_init__(coords=None)
add_scalar(ax, ax_value, **kwargs)

Metadata operation corresponding to taking a slice of a higher-dimensional variable (extracting its values at axis ax = ax_value). The coordinate corresponding to ax is removed from the list of coordinate dimensions and added to the list of scalar coordinates.

property axes

Superset of the dim_axes() dict (whose values contain coordinate dimensions only) that includes axes corresponding to scalar coordinates.

property axes_set

Superset of the dim_axes_set() frozenset (which contains axes labels corresponding to coordinate dimensions only) that includes axes labels corresponding to scalar coordinates.

build_axes(*coords, verify=True)

Constructs a dict mapping axes labels to dimension coordinates (of type AbstractDMCoordinate.)

change_coord(ax_name, new_class=None, **kwargs)

Replace attributes on a given coordinate, but also optionally cast them to new classes.

Parameters
  • ax_name – Name of the coodinate to modify.

  • new_class (optional) – new class to cast the returned coordinate to.

  • kwargs – Set of attribute names and values to replace on the returned copy.

coords = None
property dim_axes

Retrun dict mapping axes labels (‘X’, ‘Y’, etc.) to corresponding dimension coordinate objects.

property dim_axes_set

Return frozenset of dimension coordinate axes labels.

property full_name

Object’s full name, to be used in logging and debugging. Preferred because it eliminates irrelevant information in repr(), which is lengthy.

get_scalar(ax_name)

If the axis label ax_name is a scalar coordinate, return the corresponding AbstractDMCoordinate object, otherwise return None.

property is_static

Whether the variable has time dependence (bool).

modifier: str = ''
name: str = sentinel.Mandatory
remove_scalar(ax, position=- 1, **kwargs)

Metadata operation that’s the inverse of add_scalar(). Given an axis label ax that’s currently a scalar coordinate, remove the slice value and add it to the list of dimension coordinates at position (default end of the list.)

standard_name: str = sentinel.Mandatory
units: src.units.Units = ''
class src.data_model.DMDataSet(coords: dataclasses.InitVar = None, contents: dataclasses.InitVar = sentinel.Mandatory)[source]

Bases: src.data_model._DMDimensionsMixin

Class to describe a collection of one or more variables sharing a set of common dimensions.

contents: dataclasses.InitVar = sentinel.Mandatory
vars: list
coord_bounds: list
aux_coords: list
__post_init__(coords=None, contents=None)[source]
iter_contents()[source]

Generator iterating over the full contents of the DataSet (variables, auxiliary coordinates and coordinate bounds.)

iter_vars()[source]

Generator iterating over variables and auxiliary coordinates but excluding coordinate bounds.

add_contents(*vars_)[source]
change_coord(ax_name, new_class=None, **kwargs)[source]

Replace attributes on a given coordinate, but also optionally cast them to new classes.

Parameters
  • ax_name – Name of the coodinate to modify.

  • new_class (optional) – new class to cast the returned coordinate to.

  • kwargs – Set of attribute names and values to replace on the returned copy.

property T

Return T axis dimension coordinate if defined, else None.

property X

Return X axis dimension coordinate if defined, else None.

property Y

Return Y axis dimension coordinate if defined, else None.

property Z

Return Z axis dimension coordinate if defined, else None.

__init__(coords: dataclasses.InitVar = None, contents: dataclasses.InitVar = sentinel.Mandatory)None

Initialize self. See help(type(self)) for accurate signature.

build_axes(*coords, verify=True)

Constructs a dict mapping axes labels to dimension coordinates (of type AbstractDMCoordinate.)

coords = None
property dim_axes

Retrun dict mapping axes labels (‘X’, ‘Y’, etc.) to corresponding dimension coordinate objects.

property dim_axes_set

Return frozenset of dimension coordinate axes labels.

get_scalar(ax_name)

If the axis label ax_name is a scalar coordinate, return the corresponding AbstractDMCoordinate object, otherwise return None.

property is_static

Whether the variable has time dependence (bool).