iris.experimental.ugrid.cf
Extensions to Iris’ CF variable representation to represent CF UGrid variables.
Eventual destination: iris.fileformats.cf
.
In this module:
A CF-UGRID auxiliary coordinate variable is a CF-netCDF auxiliary coordinate variable representing the element (node/edge/face/volume) locations (latitude, longitude or other spatial coordinates, and optional elevation or other coordinates). These auxiliary coordinate variables will have length n-elements.
For elements other than nodes, these auxiliary coordinate variables may
have in turn a bounds
attribute that specifies the bounding coordinates
of the element (thereby duplicating the data in the node_coordinates
variables).
Identified by the CF-netCDF variable attribute
node_
/edge_
/face_
/volume_coordinates
.
See also
The UGRID Conventions, https://ugrid-conventions.github.io/ugrid-conventions/
- class iris.experimental.ugrid.cf.CFUGridAuxiliaryCoordinateVariable(name, data)[source]
A CF-UGRID auxiliary coordinate variable is a CF-netCDF auxiliary coordinate variable representing the element (node/edge/face/volume) locations (latitude, longitude or other spatial coordinates, and optional elevation or other coordinates). These auxiliary coordinate variables will have length n-elements.
For elements other than nodes, these auxiliary coordinate variables may have in turn a
bounds
attribute that specifies the bounding coordinates of the element (thereby duplicating the data in thenode_coordinates
variables).Identified by the CF-netCDF variable attribute
node_
/edge_
/face_
/volume_coordinates
.See also
The UGRID Conventions, https://ugrid-conventions.github.io/ugrid-conventions/
- add_formula_term(root, term)
Register the participation of this CF-netCDF variable in a CF-netCDF formula term.
Args:
- root (string):
The name of CF-netCDF variable that defines the CF-netCDF formula_terms attribute.
- term (string):
The associated term name of this variable in the formula_terms definition.
- Returns
None.
- cf_attrs()
Return a list of all attribute name and value pairs of the CF-netCDF variable.
- cf_attrs_ignored()
Return a list of all ignored attribute name and value pairs of the CF-netCDF variable.
- cf_attrs_reset()
Reset the history of accessed attribute names of the CF-netCDF variable.
- cf_attrs_unused()
Return a list of all non-accessed attribute name and value pairs of the CF-netCDF variable.
- cf_attrs_used()
Return a list of all accessed attribute name and value pairs of the CF-netCDF variable.
- has_formula_terms()
Determine whether this CF-netCDF variable participates in a CF-netcdf formula term.
- Returns
Boolean.
- classmethod identify(variables, ignore=None, target=None, warn=True)[source]
Identify all variables that match the criterion for this CF-netCDF variable class.
Args:
- variables:
Dictionary of netCDF4.Variable instance by variable name.
Kwargs:
- ignore:
List of variable names to ignore.
- target:
Name of a single variable to check.
- warn:
Issue a warning if a missing variable is referenced.
- Returns
Dictionary of CFVariable instance by variable name.
- spans(cf_variable)
Determine whether the dimensionality of this variable is a subset of the specified target variable.
Note that, by default scalar variables always span the dimensionality of the target variable.
Args:
- cf_variable:
Compare dimensionality with the
CFVariable
.
- Returns
Boolean.
- cf_data
NetCDF4 Variable data instance.
- cf_group
Collection of CF-netCDF variables associated with this variable.
- cf_identities = ['node_coordinates', 'edge_coordinates', 'face_coordinates', 'volume_coordinates']
- cf_identity = NotImplemented
Name of the netCDF variable attribute that identifies this CF-netCDF variable.
- cf_name
NetCDF variable name.
- cf_terms_by_root
CF-netCDF formula terms that his variable participates in.
A CF_UGRID connectivity variable points to an index variable identifying
for every element (edge/face/volume) the indices of its corner nodes. The
connectivity array will thus be a matrix of size n-elements x n-corners.
For the indexing one may use either 0- or 1-based indexing; the convention
used should be specified using a start_index
attribute to the index
variable.
For face elements: the corner nodes should be specified in anticlockwise
direction as viewed from above. For volume elements: use the
additional attribute volume_shape_type
which points to a flag variable
that specifies for every volume its shape.
Identified by a CF-netCDF variable attribute equal to any one of the values
in UGRID_CF_ROLES
.
See also
The UGRID Conventions, https://ugrid-conventions.github.io/ugrid-conventions/
- class iris.experimental.ugrid.cf.CFUGridConnectivityVariable(name, data)[source]
A CF_UGRID connectivity variable points to an index variable identifying for every element (edge/face/volume) the indices of its corner nodes. The connectivity array will thus be a matrix of size n-elements x n-corners. For the indexing one may use either 0- or 1-based indexing; the convention used should be specified using a
start_index
attribute to the index variable.For face elements: the corner nodes should be specified in anticlockwise direction as viewed from above. For volume elements: use the additional attribute
volume_shape_type
which points to a flag variable that specifies for every volume its shape.Identified by a CF-netCDF variable attribute equal to any one of the values in
UGRID_CF_ROLES
.See also
The UGRID Conventions, https://ugrid-conventions.github.io/ugrid-conventions/
- add_formula_term(root, term)
Register the participation of this CF-netCDF variable in a CF-netCDF formula term.
Args:
- root (string):
The name of CF-netCDF variable that defines the CF-netCDF formula_terms attribute.
- term (string):
The associated term name of this variable in the formula_terms definition.
- Returns
None.
- cf_attrs()
Return a list of all attribute name and value pairs of the CF-netCDF variable.
- cf_attrs_ignored()
Return a list of all ignored attribute name and value pairs of the CF-netCDF variable.
- cf_attrs_reset()
Reset the history of accessed attribute names of the CF-netCDF variable.
- cf_attrs_unused()
Return a list of all non-accessed attribute name and value pairs of the CF-netCDF variable.
- cf_attrs_used()
Return a list of all accessed attribute name and value pairs of the CF-netCDF variable.
- has_formula_terms()
Determine whether this CF-netCDF variable participates in a CF-netcdf formula term.
- Returns
Boolean.
- classmethod identify(variables, ignore=None, target=None, warn=True)[source]
Identify all variables that match the criterion for this CF-netCDF variable class.
Args:
- variables:
Dictionary of netCDF4.Variable instance by variable name.
Kwargs:
- ignore:
List of variable names to ignore.
- target:
Name of a single variable to check.
- warn:
Issue a warning if a missing variable is referenced.
- Returns
Dictionary of CFVariable instance by variable name.
- spans(cf_variable)
Determine whether the dimensionality of this variable is a subset of the specified target variable.
Note that, by default scalar variables always span the dimensionality of the target variable.
Args:
- cf_variable:
Compare dimensionality with the
CFVariable
.
- Returns
Boolean.
- cf_data
NetCDF4 Variable data instance.
- cf_group
Collection of CF-netCDF variables associated with this variable.
- cf_identities = ['edge_node_connectivity', 'face_node_connectivity', 'face_edge_connectivity', 'face_face_connectivity', 'edge_face_connectivity', 'boundary_node_connectivity', 'volume_node_connectivity', 'volume_edge_connectivity', 'volume_face_connectivity', 'volume_volume_connectivity']
- cf_identity = NotImplemented
Name of the netCDF variable attribute that identifies this CF-netCDF variable.
- cf_name
NetCDF variable name.
- cf_terms_by_root
CF-netCDF formula terms that his variable participates in.
Represents a collection of ‘NetCDF Climate and Forecast (CF) Metadata Conventions’ variables and netCDF global attributes.
Specialisation of CFGroup
that includes extra
collections for CF-UGRID-specific variable types.
- class iris.experimental.ugrid.cf.CFUGridGroup[source]
Represents a collection of ‘NetCDF Climate and Forecast (CF) Metadata Conventions’ variables and netCDF global attributes.
Specialisation of
CFGroup
that includes extra collections for CF-UGRID-specific variable types.
- clear() None. Remove all items from D.
- get(k[, d]) D[k] if k in D, else d. d defaults to None.
- items() a set-like object providing a view on D's items
- keys()
Return the names of all the CF-netCDF variables in the group.
- pop(k[, d]) v, remove specified key and return the corresponding value.
If key is not found, d is returned if given, otherwise KeyError is raised.
- popitem() (k, v), remove and return some (key, value) pair
as a 2-tuple; but raise KeyError if D is empty.
- setdefault(k[, d]) D.get(k,d), also set D[k]=d if k not in D
- update([E, ]**F) None. Update D from mapping/iterable E and F.
If E present and has a .keys() method, does: for k in E: D[k] = E[k] If E present and lacks .keys() method, does: for (k, v) in E: D[k] = v In either case, this is followed by: for k, v in F.items(): D[k] = v
- values() an object providing a view on D's values
- property ancillary_variables
Collection of CF-netCDF ancillary variables.
- property auxiliary_coordinates
Collection of CF-netCDF auxiliary coordinate variables.
- property bounds
Collection of CF-netCDF boundary variables.
- property cell_measures
Collection of CF-netCDF measure variables.
- property climatology
Collection of CF-netCDF climatology variables.
- property connectivities
Collection of CF-UGRID connectivity variables.
- property coordinates
Collection of CF-netCDF coordinate variables.
- property data_variables
Collection of CF-netCDF data pay-load variables.
- property formula_terms
Collection of CF-netCDF variables that participate in a CF-netCDF formula term.
- global_attributes
Collection of netCDF global attributes
- property grid_mappings
Collection of CF-netCDF grid mapping variables.
- property labels
Collection of CF-netCDF label variables.
- property meshes
Collection of CF-UGRID mesh variables.
- property non_data_variable_names
set
of the names of the CF-netCDF/CF-UGRID variables that are not the data pay-load.
- promoted
Collection of CF-netCDF variables promoted to a CFDataVariable.
- property ugrid_coords
Collection of CF-UGRID-relevant auxiliary coordinate variables.
A CF-UGRID mesh variable is a dummy variable for storing topology
information as attributes. The mesh variable has the cf_role
‘mesh_topology’.
The UGRID conventions describe define the mesh topology as the interconnection of various geometrical elements of the mesh. The pure interconnectivity is independent of georeferencing the individual geometrical elements, but for the practical applications for which the UGRID CF extension is defined, coordinate data will always be added.
Identified by the CF-netCDF variable attribute ‘mesh’.
See also
The UGRID Conventions, https://ugrid-conventions.github.io/ugrid-conventions/
- class iris.experimental.ugrid.cf.CFUGridMeshVariable(name, data)[source]
A CF-UGRID mesh variable is a dummy variable for storing topology information as attributes. The mesh variable has the
cf_role
‘mesh_topology’.The UGRID conventions describe define the mesh topology as the interconnection of various geometrical elements of the mesh. The pure interconnectivity is independent of georeferencing the individual geometrical elements, but for the practical applications for which the UGRID CF extension is defined, coordinate data will always be added.
Identified by the CF-netCDF variable attribute ‘mesh’.
See also
The UGRID Conventions, https://ugrid-conventions.github.io/ugrid-conventions/
- add_formula_term(root, term)
Register the participation of this CF-netCDF variable in a CF-netCDF formula term.
Args:
- root (string):
The name of CF-netCDF variable that defines the CF-netCDF formula_terms attribute.
- term (string):
The associated term name of this variable in the formula_terms definition.
- Returns
None.
- cf_attrs()
Return a list of all attribute name and value pairs of the CF-netCDF variable.
- cf_attrs_ignored()
Return a list of all ignored attribute name and value pairs of the CF-netCDF variable.
- cf_attrs_reset()
Reset the history of accessed attribute names of the CF-netCDF variable.
- cf_attrs_unused()
Return a list of all non-accessed attribute name and value pairs of the CF-netCDF variable.
- cf_attrs_used()
Return a list of all accessed attribute name and value pairs of the CF-netCDF variable.
- has_formula_terms()
Determine whether this CF-netCDF variable participates in a CF-netcdf formula term.
- Returns
Boolean.
- classmethod identify(variables, ignore=None, target=None, warn=True)[source]
Identify all variables that match the criterion for this CF-netCDF variable class.
Args:
- variables:
Dictionary of netCDF4.Variable instance by variable name.
Kwargs:
- ignore:
List of variable names to ignore.
- target:
Name of a single variable to check.
- warn:
Issue a warning if a missing variable is referenced.
- Returns
Dictionary of CFVariable instance by variable name.
- spans(cf_variable)
Determine whether the dimensionality of this variable is a subset of the specified target variable.
Note that, by default scalar variables always span the dimensionality of the target variable.
Args:
- cf_variable:
Compare dimensionality with the
CFVariable
.
- Returns
Boolean.
- cf_data
NetCDF4 Variable data instance.
- cf_group
Collection of CF-netCDF variables associated with this variable.
- cf_identity = 'mesh'
Name of the netCDF variable attribute that identifies this CF-netCDF variable.
- cf_name
NetCDF variable name.
- cf_terms_by_root
CF-netCDF formula terms that his variable participates in.
This class allows the contents of a netCDF file to be interpreted according to the ‘NetCDF Climate and Forecast (CF) Metadata Conventions’.
Specialisation of CFReader
that can also
handle CF-UGRID-specific variable types.
- class iris.experimental.ugrid.cf.CFUGridReader(filename, warn=False, monotonic=False)[source]
This class allows the contents of a netCDF file to be interpreted according to the ‘NetCDF Climate and Forecast (CF) Metadata Conventions’.
Specialisation of
CFReader
that can also handle CF-UGRID-specific variable types.
- CFGroup
Represents a collection of ‘NetCDF Climate and Forecast (CF) Metadata Conventions’ variables and netCDF global attributes.
Specialisation of
CFGroup
that includes extra collections for CF-UGRID-specific variable types.
- cf_group
Collection of CF-netCDF variables associated with this netCDF file
- property filename
The file that the CFReader is reading.