diff --git a/pyproject.toml b/pyproject.toml index df908ec..bda1181 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -20,7 +20,7 @@ classifiers = [ "Topic :: Scientific/Engineering :: GIS", "Typing :: Typed", ] -version = "0.4.0" +version = "0.5.0" dependencies = ["pydantic>=2.3,<3"] [project.optional-dependencies] diff --git a/src/edr_pydantic/parameter.py b/src/edr_pydantic/parameter.py index 466dbde..c2a31f7 100644 --- a/src/edr_pydantic/parameter.py +++ b/src/edr_pydantic/parameter.py @@ -7,6 +7,7 @@ from pydantic import RootModel from .base_model import EdrBaseModel +from .extent import Extent from .observed_property import ObservedProperty from .unit import Unit @@ -26,6 +27,7 @@ class Parameter(EdrBaseModel, extra="allow"): description: Optional[str] = None unit: Optional[Unit] = None observedProperty: ObservedProperty # noqa: N815 + extent: Optional[Extent] = None measurementType: Optional[MeasurementType] = None # noqa: N815 @model_validator(mode="after") diff --git a/tests/test_data/parameter-with-extent.json b/tests/test_data/parameter-with-extent.json new file mode 100644 index 0000000..ad521ec --- /dev/null +++ b/tests/test_data/parameter-with-extent.json @@ -0,0 +1,44 @@ +{ + "type": "Parameter", + "description": "Temperature for Specific altitude above MSL", + "unit": { + "label": "K", + "symbol": { + "value": "K", + "type": "http://qudt.org/vocab/unit/K" + } + }, + "observedProperty": { + "id": "http://codes.wmo.int/grib2/codeflag/4.2/_0-0-0", + "label": "Temperature_altitude_above_msl" + }, + "extent": { + "spatial": { + "bbox": [ + [ + -15.0, + 48.0, + 5.0, + 62.0 + ] + ], + "crs": "GEOGCS[\"WGS 84\",DATUM[\"WGS_1984\",SPHEROID[\"WGS 84\",6378137,298.257223563,AUTHORITY[\"EPSG\",\"7030\"]],AUTHORITY[\"EPSG\",\"6326\"]],PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\",\"8901\"]],UNIT[\"degree\",0.01745329251994328,AUTHORITY[\"EPSG\",\"9122\"]],AUTHORITY[\"EPSG\",\"4326\"]]" + }, + "temporal": { + "interval": [ + [ + "2020-04-19T11:00:00Z", + "2020-06-30T09:00:00Z" + ] + ], + "values": [ + "2020-04-19T11:00:00Z/2020-06-30T09:00:00Z" + ], + "trs": "TIMECRS[\"DateTime\",TDATUM[\"Gregorian Calendar\"],CS[TemporalDateTime,1],AXIS[\"Time (T)\",future]]" + } + }, + "measurementType": { + "method": "instantaneous", + "period": "PT0S" + } +} diff --git a/tests/test_edr.py b/tests/test_edr.py index 81c6da8..7064a10 100644 --- a/tests/test_edr.py +++ b/tests/test_edr.py @@ -19,6 +19,7 @@ ("landing-page.json", LandingPageModel), ("doc-example-extent.json", Extent), ("parameter-names.json", RootModel[Dict[str, Parameter]]), + ("parameter-with-extent.json", Parameter), ]