pymetkit.models#
Pydantic models for pymetkit parameter metadata.
Classes#
A MARS-key context that (partly) selects a parameter id. |
|
A single entry from the ECMWF parameter database. |
Module Contents#
- class MarsRequestContext#
Bases:
pydantic.BaseModelA MARS-key context that (partly) selects a parameter id.
This mirrors a single matcher rule from
share/metkit/params.yaml. Its schema is kept separate fromParameterEntryso the context contract can evolve independently and so user-supplied context schemas can validate against it. All fields are optional becauseparams.yamlrules do not always constrain every key (e.g.levtypeis occasionally absent).- model_config#
- class_: str | None#
- stream: str | None#
- type: str | None#
- levtype: str | None#
- class ParameterEntry#
Bases:
pydantic.BaseModelA single entry from the ECMWF parameter database.
Accepts both the canonical field names produced by
_normaliseand the raw aliases that may appear in YAML or API responses.- model_config#
- id: int#
- shortname: str#
- longname: str#
- units: str#
- table: int | None#
- mars_request_context: list[MarsRequestContext]#
- origin_ids: list[int]#
- access_ids: list[str]#
- classmethod coerce_id_to_int(v: Any) int#
- classmethod normalise_shortname_key(v: Any) str#
- classmethod normalise_longname_key(v: Any) str#
- classmethod default_empty_units(v: Any) str#
- classmethod coerce_table(v: Any) int | None#
- classmethod coerce_origin_ids(v: Any) list[int]#
- classmethod coerce_access_ids(v: Any) list[str]#
- classmethod _normalise_aliases(data: Any) Any#
Accept legacy key spellings from raw YAML / API payloads.