Logo Iris 1.12

Previous topic

iris.analysis.trajectory

Next topic

iris.config

This Page

iris.aux_factory

Definitions of derived coordinates.

In this module:

Represents a “factory” which can manufacture an additional auxiliary coordinate on demand, by combining the values of other coordinates.

Each concrete subclass represents a specific formula for deriving values from other coordinates.

The standard_name, long_name, var_name, units, attributes and coord_system of the factory are used to set the corresponding properties of the resulting auxiliary coordinates.

class iris.aux_factory.AuxCoordFactory

Bases: iris._cube_coord_common.CFVariableMixin

Represents a “factory” which can manufacture an additional auxiliary coordinate on demand, by combining the values of other coordinates.

Each concrete subclass represents a specific formula for deriving values from other coordinates.

The standard_name, long_name, var_name, units, attributes and coord_system of the factory are used to set the corresponding properties of the resulting auxiliary coordinates.

derived_dims(coord_dims_func)

Returns the virtual dim-mapping for the derived coordinate.

Args:

make_coord(coord_dims_func)

Returns a new iris.coords.AuxCoord as defined by this factory.

Args:

name(default='unknown')

Returns a human-readable name.

First it tries standard_name, then ‘long_name’, then ‘var_name’ before falling back to the value of default (which itself defaults to ‘unknown’).

rename(name)

Changes the human-readable name.

If ‘name’ is a valid standard name it will assign it to standard_name, otherwise it will assign it to long_name.

update(old_coord, new_coord=None)

Notifies the factory of a removal/replacement of a dependency.

Args:

  • old_coord:

    The dependency coordinate to be removed/replaced.

  • new_coord:

    If None, the dependency using old_coord is removed, otherwise the dependency is updated to use new_coord.

updated(new_coord_mapping)

Creates a new instance of this factory where the dependencies are replaced according to the given mapping.

Args:

  • new_coord_mapping:

    A dictionary mapping from the object IDs potentially used by this factory, to the coordinate objects that should be used instead.

xml_element(doc)

Returns a DOM element describing this coordinate factory.

attributes
coord_system = None

Coordinate system (if any) of the coordinate made by the factory

dependencies

Returns a dictionary mapping from constructor argument names to the corresponding coordinates.

long_name = None

Descriptive name of the coordinate made by the factory

standard_name

The standard name for the Cube’s data.

units

The Unit instance of the object.

var_name

CF variable name of the coordinate made by the factory

↑ top ↑

Defines a hybrid-height coordinate factory with the formula:
z = a + b * orog
class iris.aux_factory.HybridHeightFactory(delta=None, sigma=None, orography=None)

Bases: iris.aux_factory.AuxCoordFactory

Creates a hybrid-height coordinate factory with the formula:
z = a + b * orog

At least one of delta or orography must be provided.

Args:

  • delta: Coord

    The coordinate providing the a term.

  • sigma: Coord

    The coordinate providing the b term.

  • orography: Coord

    The coordinate providing the orog term.

derived_dims(coord_dims_func)

Returns the virtual dim-mapping for the derived coordinate.

Args:

make_coord(coord_dims_func)

Returns a new iris.coords.AuxCoord as defined by this factory.

Args:

name(default='unknown')

Returns a human-readable name.

First it tries standard_name, then ‘long_name’, then ‘var_name’ before falling back to the value of default (which itself defaults to ‘unknown’).

rename(name)

Changes the human-readable name.

If ‘name’ is a valid standard name it will assign it to standard_name, otherwise it will assign it to long_name.

update(old_coord, new_coord=None)

Notifies the factory of the removal/replacement of a coordinate which might be a dependency.

Args:

  • old_coord:

    The coordinate to be removed/replaced.

  • new_coord:

    If None, any dependency using old_coord is removed, otherwise any dependency using old_coord is updated to use new_coord.

updated(new_coord_mapping)

Creates a new instance of this factory where the dependencies are replaced according to the given mapping.

Args:

  • new_coord_mapping:

    A dictionary mapping from the object IDs potentially used by this factory, to the coordinate objects that should be used instead.

xml_element(doc)

Returns a DOM element describing this coordinate factory.

attributes
dependencies

Returns a dictionary mapping from constructor argument names to the corresponding coordinates.

standard_name

The standard name for the Cube’s data.

units

The Unit instance of the object.

var_name

The CF variable name for the object.

↑ top ↑

Defines a hybrid-pressure coordinate factory with the formula:
p = ap + b * ps
class iris.aux_factory.HybridPressureFactory(delta=None, sigma=None, surface_air_pressure=None)

Bases: iris.aux_factory.AuxCoordFactory

Creates a hybrid-height coordinate factory with the formula:
p = ap + b * ps

At least one of delta or surface_air_pressure must be provided.

Args:

  • delta: Coord

    The coordinate providing the ap term.

  • sigma: Coord

    The coordinate providing the b term.

  • surface_air_pressure: Coord

    The coordinate providing the ps term.

derived_dims(coord_dims_func)

Returns the virtual dim-mapping for the derived coordinate.

Args:

make_coord(coord_dims_func)

Returns a new iris.coords.AuxCoord as defined by this factory.

Args:

name(default='unknown')

Returns a human-readable name.

First it tries standard_name, then ‘long_name’, then ‘var_name’ before falling back to the value of default (which itself defaults to ‘unknown’).

rename(name)

Changes the human-readable name.

If ‘name’ is a valid standard name it will assign it to standard_name, otherwise it will assign it to long_name.

update(old_coord, new_coord=None)

Notifies the factory of the removal/replacement of a coordinate which might be a dependency.

Args:

  • old_coord:

    The coordinate to be removed/replaced.

  • new_coord:

    If None, any dependency using old_coord is removed, otherwise any dependency using old_coord is updated to use new_coord.

updated(new_coord_mapping)

Creates a new instance of this factory where the dependencies are replaced according to the given mapping.

Args:

  • new_coord_mapping:

    A dictionary mapping from the object IDs potentially used by this factory, to the coordinate objects that should be used instead.

xml_element(doc)

Returns a DOM element describing this coordinate factory.

attributes
dependencies

Returns a dictionary mapping from constructor argument names to the corresponding coordinates.

standard_name

The standard name for the Cube’s data.

units
var_name

The CF variable name for the object.

↑ top ↑

Represents a simplified NumPy array which is only computed on demand.

It provides the view() and reshape() methods so it can be used in place of a standard NumPy array under some circumstances.

The first use of either of these methods causes the array to be computed and cached for any subsequent access.

Deprecated since version 1.9.

class iris.aux_factory.LazyArray(shape, func, dtype=None)

Bases: iris.aux_factory._LazyArray

Args:

  • shape (tuple):

    The shape of the array which will be created.

  • func:

    The function which will be called to supply the real array.

Kwargs:

  • dtype (np.dtype):

    The numpy dtype of the array which will be created. Defaults to None to signify the dtype is unknown.

reshape(*args, **kwargs)

Returns a view of this array with the given shape.

See numpy.ndarray.reshape() for argument details.

to_xml_attr()

Returns a string describing this array, suitable for use in CML.

view(*args, **kwargs)

Returns a view of this array.

See numpy.ndarray.view() for argument details.

↑ top ↑

Defines an Ocean s-coordinate factory.

class iris.aux_factory.OceanSFactory(s=None, eta=None, depth=None, a=None, b=None, depth_c=None)

Bases: iris.aux_factory.AuxCoordFactory

Creates an Ocean s-coordinate factory with the formula:

z(n,k,j,i) = eta(n,j,i)*(1+s(k)) + depth_c*s(k) +
(depth(j,i)-depth_c)*C(k)
where:
C(k) = (1-b) * sinh(a*s(k)) / sinh(a) +
b * [tanh(a * (s(k) + 0.5)) / (2 * tanh(0.5*a)) - 0.5]
derived_dims(coord_dims_func)

Returns the virtual dim-mapping for the derived coordinate.

Args:

make_coord(coord_dims_func)

Returns a new iris.coords.AuxCoord as defined by this factory.

Args:

name(default='unknown')

Returns a human-readable name.

First it tries standard_name, then ‘long_name’, then ‘var_name’ before falling back to the value of default (which itself defaults to ‘unknown’).

rename(name)

Changes the human-readable name.

If ‘name’ is a valid standard name it will assign it to standard_name, otherwise it will assign it to long_name.

update(old_coord, new_coord=None)

Notifies the factory of the removal/replacement of a coordinate which might be a dependency.

Args:

  • old_coord:

    The coordinate to be removed/replaced.

  • new_coord:

    If None, any dependency using old_coord is removed, otherwise any dependency using old_coord is updated to use new_coord.

updated(new_coord_mapping)

Creates a new instance of this factory where the dependencies are replaced according to the given mapping.

Args:

  • new_coord_mapping:

    A dictionary mapping from the object IDs potentially used by this factory, to the coordinate objects that should be used instead.

xml_element(doc)

Returns a DOM element describing this coordinate factory.

attributes
dependencies

Returns a dictionary mapping from constructor argument names to the corresponding coordinates.

standard_name

The standard name for the Cube’s data.

units
var_name

The CF variable name for the object.

↑ top ↑

Defines an Ocean s-coordinate, generic form 1 factory.

class iris.aux_factory.OceanSg1Factory(s=None, c=None, eta=None, depth=None, depth_c=None)

Bases: iris.aux_factory.AuxCoordFactory

Creates an Ocean s-coordinate, generic form 1 factory with the formula:

z(n,k,j,i) = S(k,j,i) + eta(n,j,i) * (1 + S(k,j,i) / depth(j,i))

where:
S(k,j,i) = depth_c * s(k) + (depth(j,i) - depth_c) * C(k)
derived_dims(coord_dims_func)

Returns the virtual dim-mapping for the derived coordinate.

Args:

make_coord(coord_dims_func)

Returns a new iris.coords.AuxCoord as defined by this factory.

Args:

name(default='unknown')

Returns a human-readable name.

First it tries standard_name, then ‘long_name’, then ‘var_name’ before falling back to the value of default (which itself defaults to ‘unknown’).

rename(name)

Changes the human-readable name.

If ‘name’ is a valid standard name it will assign it to standard_name, otherwise it will assign it to long_name.

update(old_coord, new_coord=None)

Notifies the factory of the removal/replacement of a coordinate which might be a dependency.

Args:

  • old_coord:

    The coordinate to be removed/replaced.

  • new_coord:

    If None, any dependency using old_coord is removed, otherwise any dependency using old_coord is updated to use new_coord.

updated(new_coord_mapping)

Creates a new instance of this factory where the dependencies are replaced according to the given mapping.

Args:

  • new_coord_mapping:

    A dictionary mapping from the object IDs potentially used by this factory, to the coordinate objects that should be used instead.

xml_element(doc)

Returns a DOM element describing this coordinate factory.

attributes
dependencies

Returns a dictionary mapping from constructor argument names to the corresponding coordinates.

standard_name

The standard name for the Cube’s data.

units
var_name

The CF variable name for the object.

↑ top ↑

Defines an Ocean s-coordinate, generic form 2 factory.

class iris.aux_factory.OceanSg2Factory(s=None, c=None, eta=None, depth=None, depth_c=None)

Bases: iris.aux_factory.AuxCoordFactory

Creates an Ocean s-coordinate, generic form 2 factory with the formula:

z(n,k,j,i) = eta(n,j,i) + (eta(n,j,i) + depth(j,i)) * S(k,j,i)

where:
S(k,j,i) = (depth_c * s(k) + depth(j,i) * C(k)) /
(depth_c + depth(j,i))
derived_dims(coord_dims_func)

Returns the virtual dim-mapping for the derived coordinate.

Args:

make_coord(coord_dims_func)

Returns a new iris.coords.AuxCoord as defined by this factory.

Args:

name(default='unknown')

Returns a human-readable name.

First it tries standard_name, then ‘long_name’, then ‘var_name’ before falling back to the value of default (which itself defaults to ‘unknown’).

rename(name)

Changes the human-readable name.

If ‘name’ is a valid standard name it will assign it to standard_name, otherwise it will assign it to long_name.

update(old_coord, new_coord=None)

Notifies the factory of the removal/replacement of a coordinate which might be a dependency.

Args:

  • old_coord:

    The coordinate to be removed/replaced.

  • new_coord:

    If None, any dependency using old_coord is removed, otherwise any dependency using old_coord is updated to use new_coord.

updated(new_coord_mapping)

Creates a new instance of this factory where the dependencies are replaced according to the given mapping.

Args:

  • new_coord_mapping:

    A dictionary mapping from the object IDs potentially used by this factory, to the coordinate objects that should be used instead.

xml_element(doc)

Returns a DOM element describing this coordinate factory.

attributes
dependencies

Returns a dictionary mapping from constructor argument names to the corresponding coordinates.

standard_name

The standard name for the Cube’s data.

units
var_name

The CF variable name for the object.

↑ top ↑

Defines an ocean sigma coordinate factory.

class iris.aux_factory.OceanSigmaFactory(sigma=None, eta=None, depth=None)

Bases: iris.aux_factory.AuxCoordFactory

Creates an ocean sigma coordinate factory with the formula:

z(n, k, j, i) = eta(n, j, i) + sigma(k) *
(depth(j, i) + eta(n, j, i))
derived_dims(coord_dims_func)

Returns the virtual dim-mapping for the derived coordinate.

Args:

make_coord(coord_dims_func)

Returns a new iris.coords.AuxCoord as defined by this factory.

Args:

name(default='unknown')

Returns a human-readable name.

First it tries standard_name, then ‘long_name’, then ‘var_name’ before falling back to the value of default (which itself defaults to ‘unknown’).

rename(name)

Changes the human-readable name.

If ‘name’ is a valid standard name it will assign it to standard_name, otherwise it will assign it to long_name.

update(old_coord, new_coord=None)

Notifies the factory of the removal/replacement of a coordinate which might be a dependency.

Args:

  • old_coord:

    The coordinate to be removed/replaced.

  • new_coord:

    If None, any dependency using old_coord is removed, otherwise any dependency using old_coord is updated to use new_coord.

updated(new_coord_mapping)

Creates a new instance of this factory where the dependencies are replaced according to the given mapping.

Args:

  • new_coord_mapping:

    A dictionary mapping from the object IDs potentially used by this factory, to the coordinate objects that should be used instead.

xml_element(doc)

Returns a DOM element describing this coordinate factory.

attributes
dependencies

Returns a dictionary mapping from constructor argument names to the corresponding coordinates.

standard_name

The standard name for the Cube’s data.

units
var_name

The CF variable name for the object.

↑ top ↑

Defines an ocean sigma over z coordinate factory.

class iris.aux_factory.OceanSigmaZFactory(sigma=None, eta=None, depth=None, depth_c=None, nsigma=None, zlev=None)

Bases: iris.aux_factory.AuxCoordFactory

Creates a ocean sigma over z coordinate factory with the formula:

if k < nsigma:
z(n, k, j, i) = eta(n, j, i) + sigma(k) *
(min(depth_c, depth(j, i)) + eta(n, j, i))
if k >= nsigma:
z(n, k, j, i) = zlev(k)

The zlev and ‘nsigma’ coordinates must be provided, and at least either eta, or ‘sigma’ and depth and depth_c coordinates.

derived_dims(coord_dims_func)

Returns the virtual dim-mapping for the derived coordinate.

Args:

make_coord(coord_dims_func)

Returns a new iris.coords.AuxCoord as defined by this factory.

Args:

name(default='unknown')

Returns a human-readable name.

First it tries standard_name, then ‘long_name’, then ‘var_name’ before falling back to the value of default (which itself defaults to ‘unknown’).

rename(name)

Changes the human-readable name.

If ‘name’ is a valid standard name it will assign it to standard_name, otherwise it will assign it to long_name.

update(old_coord, new_coord=None)

Notifies the factory of the removal/replacement of a coordinate which might be a dependency.

Args:

  • old_coord:

    The coordinate to be removed/replaced.

  • new_coord:

    If None, any dependency using old_coord is removed, otherwise any dependency using old_coord is updated to use new_coord.

updated(new_coord_mapping)

Creates a new instance of this factory where the dependencies are replaced according to the given mapping.

Args:

  • new_coord_mapping:

    A dictionary mapping from the object IDs potentially used by this factory, to the coordinate objects that should be used instead.

xml_element(doc)

Returns a DOM element describing this coordinate factory.

attributes
dependencies

Returns a dictionary mapping from constructor argument names to the corresponding coordinates.

standard_name

The standard name for the Cube’s data.

units
var_name

The CF variable name for the object.