Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Extent object to Parameter #12

Merged
merged 2 commits into from
Sep 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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