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

iris.fileformats.rules#

Generalised mechanisms for metadata translation and cube construction.

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

Bases: object

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.

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

Bases: tuple

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

attributes#

Alias for field number 5

aux_coords_and_dims#

Alias for field number 8

cell_methods#

Alias for field number 6

count(value, /)#

Return number of occurrences of value.

dim_coords_and_dims#

Alias for field number 7

factories#

Alias for field number 0

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

Return first index of value.

Raises ValueError if the value is not present.

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

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

Bases: tuple

Create new instance of Factory(factory_class, args)

args#

Alias for field number 1

count(value, /)#

Return number of occurrences of value.

factory_class#

Alias for field number 0

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

Return first index of value.

Raises ValueError if the value is not present.

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

Bases: Loader

Create a definition of a field-based Cube loader.

Parameters:
  • 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.

Parameters:
  • 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.

converter#

Alias for field number 2

count(value, /)#

Return number of occurrences of value.

field_generator#

Alias for field number 0

field_generator_kwargs#

Alias for field number 1

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

Return first index of value.

Raises ValueError if the value is not present.

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

Bases: _OrderedHashable

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

Bases: tuple

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

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

Retrieve AuxCoordFactory instance from cube.

Return the AuxCoordFactory instance of the specified type from a cube.

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

Determine AuxCoordFactory availability within cube.

Try to find an AuxCoordFactory instance of the specified type on the cube.

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

Convert iterable of fields into iterable of Cubes using the provided converter.

Parameters:
  • fields – An iterable of fields.

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

Return type:

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

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.

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

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

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

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