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

Change custom extend to be in line with EDR 1.1 spec #9

Merged
merged 1 commit into from
May 17, 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 @@ -19,7 +19,7 @@ classifiers = [
"Topic :: Scientific/Engineering :: GIS",
"Typing :: Typed",
]
version = "0.2.1"
version = "0.3.0"
dependencies = ["pydantic>=2.3,<3"]

[project.optional-dependencies]
Expand Down
7 changes: 4 additions & 3 deletions src/edr_pydantic/extent.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from typing import List
from typing import Optional
from typing import Union

from pydantic import AwareDatetime

Expand All @@ -26,10 +27,10 @@ class Vertical(EdrBaseModel):


class Custom(EdrBaseModel):
interval: List[str]
id: str
values: List[str]
reference: Optional[str] = None
interval: List[List[Union[str, float]]]
values: Optional[List[Union[str, float]]] = None
reference: str


class Extent(EdrBaseModel):
Expand Down
61 changes: 61 additions & 0 deletions tests/test_data/doc-example-extent.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
{
"spatial": {
"bbox": [
[
-180.0,
-90.0,
180.0,
90.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.0174532925199433,AUTHORITY[\"EPSG\",\"9122\"]],AUTHORITY[\"EPSG\",\"4326\"]]"
},
"temporal": {
"interval": [
[
"2017-06-14T00:00:00Z",
"2017-06-14T12:00:00Z"
]
],
"values": [
"2017-06-14T00:00:00Z",
"2017-06-14T06:00:00Z",
"2017-06-14T12:00:00Z",
"2017-06-14T18:00:00Z"
],
"trs": "TIMECRS[\"DateTime\",TDATUM[\"Gregorian Calendar\"],CS[TemporalDateTime,1],AXIS[\"Time (T)\",future]]"
},
"custom": [
{
"id": "realisations",
"interval": [
[
1.0,
50.0
]
],
"values": [
"R50/1/1"
],
"reference": "Ensemble members"
},
{
"id": "icao_ids",
"interval": [
[
"EB",
"EB"
]
],
"values": [
"EBAW",
"EBBR",
"EBBR",
"EBKT",
"EBLG",
"EBOS"
],
"reference": "https://en.wikipedia.org/wiki/ICAO_airport_code"
}
]
}
2 changes: 2 additions & 0 deletions tests/test_edr.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from edr_pydantic.capabilities import LandingPageModel
from edr_pydantic.collections import Collections
from edr_pydantic.collections import Instance
from edr_pydantic.extent import Extent
from edr_pydantic.unit import Unit
from pydantic import ValidationError

Expand All @@ -13,6 +14,7 @@
("doc-example-collections.json", Collections),
("simple-instance.json", Instance),
("landing-page.json", LandingPageModel),
("doc-example-extent.json", Extent),
]


Expand Down