You are viewing the latest unreleased documentation 3.10.0.dev23. You can switch to a stable version.

iris.experimental.ugrid.cf#

Extensions to Iris’ CF variable representation to represent CF UGrid variables.

Eventual destination: iris.fileformats.cf.

class iris.experimental.ugrid.cf.CFUGridAuxiliaryCoordinateVariable(name, data)[source]#

Bases: CFVariable

A CF-UGRID auxiliary coordinate variable.

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.

add_formula_term(root, term)#

Register the participation of this CF-netCDF variable in a CF-netCDF formula term.

Parameters:
  • root (str) – The name of CF-netCDF variable that defines the CF-netCDF formula_terms attribute.

  • term (str) – The associated term name of this variable in the formula_terms definition.

Return type:

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.

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.

has_formula_terms()#

Determine whether this CF-netCDF variable participates in a CF-netcdf formula term.

Return type:

bool

classmethod identify(variables, ignore=None, target=None, warn=True)[source]#

Identify all variables that match the criterion for this CF-netCDF variable class.

Parameters:
  • variables – Dictionary of netCDF4.Variable instance by variable name.

  • ignore (optional) – List of variable names to ignore.

  • target (optional) – Name of a single variable to check.

  • warn (bool, default=True) – Issue a warning if a missing variable is referenced.

Return type:

Dictionary of CFVariable instance by variable name.

spans(cf_variable)#

Determine dimensionality coverage.

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.

Parameters:

cf_variable – Compare dimensionality with the CFVariable.

Return type:

bool

class iris.experimental.ugrid.cf.CFUGridConnectivityVariable(name, data)[source]#

Bases: CFVariable

A CF_UGRID connectivity variable.

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.

add_formula_term(root, term)#

Register the participation of this CF-netCDF variable in a CF-netCDF formula term.

Parameters:
  • root (str) – The name of CF-netCDF variable that defines the CF-netCDF formula_terms attribute.

  • term (str) – The associated term name of this variable in the formula_terms definition.

Return type:

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.

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.

has_formula_terms()#

Determine whether this CF-netCDF variable participates in a CF-netcdf formula term.

Return type:

bool

classmethod identify(variables, ignore=None, target=None, warn=True)[source]#

Identify all variables that match the criterion for this CF-netCDF variable class.

Parameters:
  • variables – Dictionary of netCDF4.Variable instance by variable name.

  • ignore (optional) – List of variable names to ignore.

  • target (optional) – Name of a single variable to check.

  • warn (bool, default=True) – Issue a warning if a missing variable is referenced.

Return type:

Dictionary of CFVariable instance by variable name.

spans(cf_variable)#

Determine dimensionality coverage.

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.

Parameters:

cf_variable – Compare dimensionality with the CFVariable.

Return type:

bool

class iris.experimental.ugrid.cf.CFUGridGroup[source]#

Bases: CFGroup

Represents a collection of CF Metadata Conventions variables and netCDF global attributes.

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.

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.

clear() None.  Remove all items from D.#
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.

get(k[, d]) D[k] if k in D, else d.  d defaults to None.#
global_attributes#

Collection of netCDF global attributes

property grid_mappings#

Collection of CF-netCDF grid mapping variables.

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.

property labels#

Collection of CF-netCDF label variables.

property meshes#

Collection of CF-UGRID mesh variables.

property non_data_variable_names#

set of names of the CF-netCDF/CF-UGRID variables that are not the data pay-load.

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.

promoted#

Collection of CF-netCDF variables promoted to a CFDataVariable.

setdefault(k[, d]) D.get(k,d), also set D[k]=d if k not in D#
property ugrid_coords#

Collection of CF-UGRID-relevant auxiliary coordinate variables.

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#
class iris.experimental.ugrid.cf.CFUGridMeshVariable(name, data)[source]#

Bases: CFVariable

A CF-UGRID mesh variable is a dummy variable for storing topology information as attributes.

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’.

add_formula_term(root, term)#

Register the participation of this CF-netCDF variable in a CF-netCDF formula term.

Parameters:
  • root (str) – The name of CF-netCDF variable that defines the CF-netCDF formula_terms attribute.

  • term (str) – The associated term name of this variable in the formula_terms definition.

Return type:

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.

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.

has_formula_terms()#

Determine whether this CF-netCDF variable participates in a CF-netcdf formula term.

Return type:

bool

classmethod identify(variables, ignore=None, target=None, warn=True)[source]#

Identify all variables that match the criterion for this CF-netCDF variable class.

Parameters:
  • variables – Dictionary of netCDF4.Variable instance by variable name.

  • ignore (optional) – List of variable names to ignore.

  • target (optional) – Name of a single variable to check.

  • warn (bool, default=True) – Issue a warning if a missing variable is referenced.

Return type:

Dictionary of CFVariable instance by variable name.

spans(cf_variable)#

Determine dimensionality coverage.

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.

Parameters:

cf_variable – Compare dimensionality with the CFVariable.

Return type:

bool

class iris.experimental.ugrid.cf.CFUGridReader(file_source, warn=False, monotonic=False)[source]#

Bases: CFReader

Allows the contents of a netCDF file to be.

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#

alias of CFUGridGroup

cf_group#

Collection of CF-netCDF variables associated with this netCDF file

property filename#

The file that the CFReader is reading.