smif.metadata.spec module¶
Data is typically multi-dimensional. Spec
is used to describe
each dataset which is supplied to - or output from - each Model
in a
CompositeModel
Reference¶
-
class
smif.metadata.spec.
Spec
(name=None, dims=None, coords=None, dtype=None, abs_range=None, exp_range=None, unit=None, description=None)[source]¶ Bases:
object
N-dimensional metadata.
Spec labels each dimension with coordinates and enforces data type, units and absolute and expected ranges.
The API here is modelled on
xarray.DataArray
: dtype and shape describe anumpy.ndarray
; dims and coords follow the xarray conventions for labelled axes; and unit, abs_range and exp_range are introduced as supplementary metadata to help validate connections between models.-
coords
¶ Dimension coordinate labels
Type: list[Coordinates]
Parameters: - name (str, optional) – Name to identifiy the variable described (typically an input, output or parameter)
- description (str, optional) – Short description
- dims (list[str], optional) – List of dimension names, must be provided if coords is a dict
- coords (list[Coordinates] or dict[str, list], optional) – A list of :class`Coordinates` or a dict mapping each dimension name to a list of names which label that dimension.
- dtype (str) – String suitable for contructing a simple
numpy.dtype
- abs_range (tuple, optional) – (min, max) absolute range for numeric values - can be used to raise errors
- exp_range (tuple, optional) – (min, max) expected range for numeric values - can be used to raise warnings
- unit (str, optional) – Unit to be used for data values
-
name
The name of the data that this spec describes.
-
description
A human-friendly description
-
dtype
The dtype of the data that this spec describes.
-
abs_range
The absolute range of data values that this spec describes.
-
exp_range
The expected range of data values that this spec describes.
-
shape
Tuple of dimension sizes. The shape of the data that this spec describes.
-
ndim
The number of dimensions of the data that this spec describes.
-
dims
Names for each dimension
-
coords
Coordinate labels for each dimension.
-
unit
The unit for all data points.
-