cf.CoordinateReference


class cf.CoordinateReference(coordinates=None, datum=None, coordinate_conversion=None, source=None, copy=True)[source]

Bases: cfdm.coordinatereference.CoordinateReference

A coordinate reference construct of the CF data model.

A coordinate reference construct relates the coordinate values of the coordinate system to locations in a planetary reference frame.

The domain of a field construct may contain various coordinate systems, each of which is constructed from a subset of the dimension and auxiliary coordinate constructs. For example, the domain of a four-dimensional field construct may contain horizontal (y-x), vertical (z), and temporal (t) coordinate systems. There may be more than one of each of these, if there is more than one coordinate construct applying to a particular spatiotemporal dimension (for example, there could be both latitude-longitude and y-x projection coordinate systems). In general, a coordinate system may be constructed implicitly from any subset of the coordinate constructs, yet a coordinate construct does not need to be explicitly or exclusively associated with any coordinate system.

A coordinate system of the field construct can be explicitly defined by a coordinate reference construct which relates the coordinate values of the coordinate system to locations in a planetary reference frame and consists of the following:

  • References to the dimension coordinate and auxiliary coordinate constructs that define the coordinate system to which the coordinate reference construct applies. Note that the coordinate values are not relevant to the coordinate reference construct, only their properties.
  • A definition of a datum specifying the zeroes of the dimension and auxiliary coordinate constructs which define the coordinate system. The datum may be implied by the metadata of the referenced dimension and auxiliary coordinate constructs, or explicitly provided.
  • A coordinate conversion, which defines a formula for converting coordinate values taken from the dimension or auxiliary coordinate constructs to a different coordinate system. A coordinate reference construct relates the coordinate values of the field to locations in a planetary reference frame.

NetCDF interface

The netCDF grid mapping variable name of a coordinate reference construct may be accessed with the nc_set_variable, nc_get_variable, nc_del_variable and nc_has_variable methods.

Initialization

Parameters:
coordinates: sequence of str, optional

Identify the related dimension and auxiliary coordinate constructs by their construct identifiers. Ignored if the source parameter is set.

The coordinates may also be set after initialisation with the set_coordinates and set_coordinate methods.

Parameter example:

coordinates=['dimensioncoordinate2']

Parameter example:

coordinates=('dimensioncoordinate0', 'dimensioncoordinate1')

datum: Datum, optional

Set the datum component of the coordinate reference construct. Ignored if the source parameter is set.

The datum may also be set after initialisation with the set_datum method.

coordinate_conversion: CoordinateConversion, optional

Set the coordinate conversion component of the coordinate reference construct. Ignored if the source parameter is set.

The coordinate conversion may also be set after initialisation with the set_coordinate_conversion method.

source: optional

Initialize the coordinates, datum and coordinate conversion from those of source.

copy: bool, optional

If False then do not deep copy arguments prior to initialization. By default arguments are deep copied.

Inspection

Methods

dump A full description of the coordinate reference construct.
identity Return the canonical identity.
identities Return all possible identities.

Attributes

construct_type Return a description of the construct type.

Dictionary-access methods

Methods

get Return a parameter value of the datum or the coordinate conversion.
__getitem__ Return a parameter value of the datum or the coordinate conversion.

Selection

Methods

match_by_identity Determine whether or not one of the identities matches.

Coordinates

Methods

del_coordinate Remove a reference to a coordinate construct.
has_coordinate Whether a reference to a coordinate construct has been set.
set_coordinate Set a reference to a coordinate construct.
coordinates Return all references to coordinate constructs.
clear_coordinates Remove all references to coordinate constructs.
set_coordinates Set references to coordinate constructs.

Datum

Methods

del_datum Remove the datum component.
get_datum Return the datum component.
set_datum Set the datum component.

Attributes

datum Return the datum component.

Coordinate conversion

Methods

del_coordinate_conversion Remove the coordinate conversion component.
get_coordinate_conversion Get the coordinate conversion component.
set_coordinate_conversion Set the coordinate conversion component.

Attributes

coordinate_conversion Return the coordinate conversion component.

Miscellaneous

Methods

canonical_units Return the canonical units for a standard CF coordinate conversion term.
change_identifiers Change the TODO
close Close all files referenced by coordinate conversion term values.
copy Return a deep copy.
default_value Return the default value for an unset standard CF coordinate conversion term.
equals Whether two coordinate reference constructs are the same.
equivalent True if two coordinate references are logically equal, False otherwise.
has_bounds Returns False since coordinate reference constructs do not have cell bounds.
inspect Inspect the attributes.
structural_signature TODO

NetCDF

Methods

nc_del_variable Remove the netCDF variable name.
nc_get_variable Return the netCDF variable name.
nc_has_variable Whether the netCDF variable name has been set.
nc_set_variable Set the netCDF variable name.

Special

Methods

__deepcopy__ Called by the copy.deepcopy function.
__repr__ Called by the repr built-in function.
__str__ Called by the str built-in function.