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.
-
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.
-
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.
-
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.
Everything you need to make a real Cube for a named reference.
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
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
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
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.
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