iris.fileformats.rules#

Generalised mechanisms for metadata translation and cube construction.

In this module:

iris.fileformats.rules.aux_factory(cube, aux_factory_class)[source]#

Return the class:~iris.aux_factory.AuxCoordFactory instance of the specified type from a cube.

↑ top ↑

iris.fileformats.rules.has_aux_factory(cube, aux_factory_class)[source]#

Try to find an class:~iris.aux_factory.AuxCoordFactory instance of the specified type on the cube.

↑ top ↑

iris.fileformats.rules.load_cubes(filenames, user_callback, loader, filter_function=None)[source]#

↑ top ↑

iris.fileformats.rules.load_pairs_from_fields(fields, converter)[source]#

Convert an iterable of fields into an iterable of Cubes using the provided convertor.

Args:

  • fields:

    An iterable of fields.

  • convertor:

    An Iris convertor function, suitable for use with the supplied fields. See the description in iris.fileformats.rules.Loader.

Returns

An iterable of (iris.cube.Cube, field) pairs.

↑ top ↑

iris.fileformats.rules.scalar_cell_method(cube, method, coord_name)[source]#

Try to find the given type of cell method over a single coord with the given name.

↑ top ↑

iris.fileformats.rules.scalar_coord(cube, coord_name)[source]#

Try to find a single-valued coord with the given name.

↑ top ↑

iris.fileformats.rules.vector_coord(cube, coord_name)[source]#

Try to find a one-dimensional, multi-valued coord with the given name.

↑ top ↑

Everything you need to make a real Cube for a named reference.

class iris.fileformats.rules.ConcreteReferenceTarget(name, transform=None)[source]#

Everything you need to make a real Cube for a named reference.

add_cube(cube)[source]#
as_cube()[source]#
name#

The name used to connect references with references.

transform#

An optional transformation to apply to the cubes.

↑ top ↑

ConversionMetadata(factories, references, standard_name, long_name, units, attributes, cell_methods, dim_coords_and_dims, aux_coords_and_dims)

class iris.fileformats.rules.ConversionMetadata(_cls, factories, references, standard_name, long_name, units, attributes, cell_methods, dim_coords_and_dims, aux_coords_and_dims)#

Create new instance of ConversionMetadata(factories, references, standard_name, long_name, units, attributes, cell_methods, dim_coords_and_dims, aux_coords_and_dims)

count(value, /)#

Return number of occurrences of value.

index(value, start=0, stop=9223372036854775807, /)#

Return first index of value.

Raises ValueError if the value is not present.

attributes#

Alias for field number 5

aux_coords_and_dims#

Alias for field number 8

cell_methods#

Alias for field number 6

dim_coords_and_dims#

Alias for field number 7

factories#

Alias for field number 0

long_name#

Alias for field number 3

references#

Alias for field number 1

standard_name#

Alias for field number 2

units#

Alias for field number 4

↑ top ↑

Factory(factory_class, args)

class iris.fileformats.rules.Factory(_cls, factory_class, args)#

Create new instance of Factory(factory_class, args)

count(value, /)#

Return number of occurrences of value.

index(value, start=0, stop=9223372036854775807, /)#

Return first index of value.

Raises ValueError if the value is not present.

args#

Alias for field number 1

factory_class#

Alias for field number 0

↑ top ↑

Loader(field_generator, field_generator_kwargs, converter)

class iris.fileformats.rules.Loader(field_generator, field_generator_kwargs, converter)[source]#

Create a definition of a field-based Cube loader.

Args:

  • field_generator

    A callable that accepts a filename as its first argument and returns an iterable of field objects.

  • field_generator_kwargs

    Additional arguments to be passed to the field_generator.

  • converter

    A callable that converts a field object into a Cube.

static __new__(cls, field_generator, field_generator_kwargs, converter)[source]#

Create a definition of a field-based Cube loader.

Args:

  • field_generator

    A callable that accepts a filename as its first argument and returns an iterable of field objects.

  • field_generator_kwargs

    Additional arguments to be passed to the field_generator.

  • converter

    A callable that converts a field object into a Cube.

count(value, /)#

Return number of occurrences of value.

index(value, start=0, stop=9223372036854775807, /)#

Return first index of value.

Raises ValueError if the value is not present.

converter#

Alias for field number 2

field_generator#

Alias for field number 0

field_generator_kwargs#

Alias for field number 1

↑ top ↑

Convenience class for creating “immutable”, hashable, and ordered classes.

Instance identity is defined by the specific list of attribute names declared in the abstract attribute “_names”. Subclasses must declare the attribute “_names” as an iterable containing the names of all the attributes relevant to equality/hash-value/ordering.

Initial values should be set by using ::

self._init(self, value1, value2, ..)

Note

It’s the responsibility of the subclass to ensure that the values of its attributes are themselves hashable.

class iris.fileformats.rules.Reference(name)[source]#

↑ top ↑

ReferenceTarget(name, transform)

class iris.fileformats.rules.ReferenceTarget(_cls, name, transform)#

Create new instance of ReferenceTarget(name, transform)

count(value, /)#

Return number of occurrences of value.

index(value, start=0, stop=9223372036854775807, /)#

Return first index of value.

Raises ValueError if the value is not present.

name#

Alias for field number 0

transform#

Alias for field number 1