pymetkit.paramdb.models ======================= .. py:module:: pymetkit.paramdb.models .. autoapi-nested-parse:: Pydantic models for pymetkit parameter metadata. Classes ------- .. autoapisummary:: pymetkit.paramdb.models.MarsRequestContext pymetkit.paramdb.models.ParameterEntry Module Contents --------------- .. py:class:: MarsRequestContext(/, **data: Any) Bases: :py:obj:`pydantic.BaseModel` A 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** from :class:`ParameterEntry` so the context contract can evolve independently and so user-supplied context schemas can validate against it. All fields are optional because ``params.yaml`` rules do not always constrain every key (e.g. ``levtype`` is occasionally absent). Create a new model by parsing and validating input data from keyword arguments. Raises [`ValidationError`][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model. `self` is explicitly positional-only to allow `self` as a field name. .. py:attribute:: model_config Configuration for the model, should be a dictionary conforming to [`ConfigDict`][pydantic.config.ConfigDict]. .. py:attribute:: class_ :type: str | None :value: None .. py:attribute:: stream :type: str | None :value: None .. py:attribute:: type :type: str | None :value: None .. py:attribute:: levtype :type: str | None :value: None .. py:class:: ParameterEntry(/, **data: Any) Bases: :py:obj:`pydantic.BaseModel` A single entry from the ECMWF parameter database. This model accepts the **canonical** field names only (``shortname`` / ``longname``). Raw API alias spellings (e.g. ``shortName``, ``name``) are NOT accepted and must be normalised to canonical keys before validation. The JSON schema emitted from this model (and bundled as ``parameter_entry_schema.json``) mirrors this contract: it validates the canonical keys only. Create a new model by parsing and validating input data from keyword arguments. Raises [`ValidationError`][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model. `self` is explicitly positional-only to allow `self` as a field name. .. py:attribute:: model_config Configuration for the model, should be a dictionary conforming to [`ConfigDict`][pydantic.config.ConfigDict]. .. py:attribute:: id :type: int :value: None .. py:attribute:: shortname :type: str :value: None .. py:attribute:: longname :type: str :value: None .. py:attribute:: units :type: str :value: None .. py:attribute:: table :type: int | None :value: None .. py:attribute:: mars_request_context :type: list[MarsRequestContext] :value: None .. py:attribute:: origin_ids :type: list[int] :value: None .. py:attribute:: access_ids :type: list[str] :value: None .. py:method:: coerce_id_to_int(v: Any) -> int :classmethod: .. py:method:: normalise_shortname_key(v: Any) -> str :classmethod: .. py:method:: normalise_longname_key(v: Any) -> str :classmethod: .. py:method:: default_empty_units(v: Any) -> str :classmethod: .. py:method:: coerce_table(v: Any) -> int | None :classmethod: .. py:method:: coerce_origin_ids(v: Any) -> list[int] :classmethod: .. py:method:: coerce_access_ids(v: Any) -> list[str] :classmethod: