joseki.profiles.schema

Dataset schema for atmosphere thermophysical profiles.

The dataset schema defines the variables, coordinates and attributes that are expected in a dataset representing an atmosphere thermophysical profile.

Attributes

Classes

Schema

Dataset schema for atmosphere thermophysical profiles.

Functions

history()

mole_fraction_sum(ds)

Compute the sum of mole fractions.

Module Contents

class joseki.profiles.schema.Schema[source]

Dataset schema for atmosphere thermophysical profiles.

convert(data_vars, coords, attrs)[source]

Convert input to schema-compliant dataset.

Parameters:
  • data_vars (Mapping[str, pint.Quantity]) – Mapping of data variable names to quantities.

  • coords (Mapping[str, pint.Quantity]) – Mapping of coordinate names to quantities.

  • attrs (Mapping[str, str]) – Mapping of attribute names to values.

Returns:

Dataset with schema-compliant data variables, coordinates, and attributes.

Return type:

xarray.Dataset

validate(ds, check_x_sum=False, ret_true_if_valid=False)[source]

Validate dataset.

Parameters:
  • ds (xarray.Dataset) – Dataset to validate.

  • check_x_sum (bool) – if True, check that mole fraction sums are never larger than one.

  • ret_true_if_valid (bool) – make this method return True if the dataset is valid. Note that if the dataset is not valid, this method will raise an exception.

Raises:

ValueError – If the dataset does not match the schema.

Returns:

If ret_true_if_valid is True, returns True if the

dataset is valid, otherwise returns None.

Return type:

None or bool

attrs
coords
data_vars
joseki.profiles.schema.history()[source]
Return type:

str

joseki.profiles.schema.mole_fraction_sum(ds)[source]

Compute the sum of mole fractions.

Parameters:

ds (xarray.Dataset) – Dataset.

Returns:

The sum of mole fractions.

Return type:

pint.Quantity

joseki.profiles.schema.logger
joseki.profiles.schema.schema