Skip to content

Commit

Permalink
Merge pull request #12 from KNMI/parameter-extent
Browse files Browse the repository at this point in the history
Add Extent object to Parameter
  • Loading branch information
lukas-phaf authored Sep 9, 2024
2 parents 2389a44 + 48e5f96 commit ca0ab14
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
2 changes: 2 additions & 0 deletions src/edr_pydantic/parameter.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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")
Expand Down
44 changes: 44 additions & 0 deletions tests/test_data/parameter-with-extent.json
Original file line number Diff line number Diff line change
@@ -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"
}
}
1 change: 1 addition & 0 deletions tests/test_edr.py
Original file line number Diff line number Diff line change
Expand Up @@ -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),
]


Expand Down

0 comments on commit ca0ab14

Please sign in to comment.