Skip to content

Commit fad44bd

Browse files
authored
update EDR compliance (geopython#1896)
1 parent 84908c9 commit fad44bd

File tree

3 files changed

+68
-13
lines changed

3 files changed

+68
-13
lines changed

pygeoapi/api/__init__.py

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1113,12 +1113,12 @@ def describe_collections(api: API, request: APIRequest,
11131113
'href': f'{api.get_collections_url()}/{k}/items?f={F_HTML}' # noqa
11141114
})
11151115

1116-
# OAPIF Part 2 - list supported CRSs and StorageCRS
1117-
if collection_data_type == 'feature':
1118-
collection['crs'] = get_supported_crs_list(collection_data, DEFAULT_CRS_LIST) # noqa
1119-
collection['storageCRS'] = collection_data.get('storage_crs', DEFAULT_STORAGE_CRS) # noqa
1120-
if 'storage_crs_coordinate_epoch' in collection_data:
1121-
collection['storageCrsCoordinateEpoch'] = collection_data.get('storage_crs_coordinate_epoch') # noqa
1116+
# OAPIF Part 2 - list supported CRSs and StorageCRS
1117+
if collection_data_type in ['edr', 'feature']:
1118+
collection['crs'] = get_supported_crs_list(collection_data, DEFAULT_CRS_LIST) # noqa
1119+
collection['storageCRS'] = collection_data.get('storage_crs', DEFAULT_STORAGE_CRS) # noqa
1120+
if 'storage_crs_coordinate_epoch' in collection_data:
1121+
collection['storageCrsCoordinateEpoch'] = collection_data.get('storage_crs_coordinate_epoch') # noqa
11221122

11231123
elif collection_data_type == 'coverage':
11241124
# TODO: translate
@@ -1235,6 +1235,12 @@ def describe_collections(api: API, request: APIRequest,
12351235
'id': key,
12361236
'type': 'Parameter',
12371237
'name': value['title'],
1238+
'observedProperty': {
1239+
'label': {
1240+
'id': key,
1241+
'en': value['title']
1242+
},
1243+
},
12381244
'unit': {
12391245
'label': {
12401246
'en': value['title']
@@ -1250,8 +1256,11 @@ def describe_collections(api: API, request: APIRequest,
12501256
data_query = {
12511257
'link': {
12521258
'href': f'{api.get_collections_url()}/{k}/{qt}',
1253-
'rel': 'data'
1254-
}
1259+
'rel': 'data',
1260+
'variables': {
1261+
'query_type': qt
1262+
}
1263+
}
12551264
}
12561265
collection['data_queries'][qt] = data_query
12571266

@@ -1264,13 +1273,13 @@ def describe_collections(api: API, request: APIRequest,
12641273
'type': 'application/json',
12651274
'rel': 'data',
12661275
'title': title1,
1267-
'href': f'{api.get_collections_url()}/{k}/{qt}?f={F_JSON}' # noqa
1276+
'href': f'{api.get_collections_url()}/{k}/{qt}?f={F_JSON}'
12681277
})
12691278
collection['links'].append({
12701279
'type': FORMAT_TYPES[F_HTML],
12711280
'rel': 'data',
12721281
'title': title2,
1273-
'href': f'{api.get_collections_url()}/{k}/{qt}?f={F_HTML}' # noqa
1282+
'href': f'{api.get_collections_url()}/{k}/{qt}?f={F_HTML}'
12741283
})
12751284

12761285
if dataset is not None and k == dataset:

pygeoapi/api/environmental_data_retrieval.py

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -451,17 +451,34 @@ def get_oas_30(cfg: dict, locale: str) -> tuple[list[dict[str, str]], dict[str,
451451

452452
for eqe in edr_query_endpoints:
453453
if eqe['qt'] == 'cube':
454-
spatial_parameter = 'bbox'
454+
spatial_parameter = {
455+
'description': 'Only features that have a geometry that intersects the bounding box are selected.The bounding box is provided as four or six numbers, depending on whether the coordinate reference system includes a vertical axis (height or depth).', # noqa
456+
'explode': False,
457+
'in': 'query',
458+
'name': 'bbox',
459+
'required': True,
460+
'schema': {
461+
'items': {
462+
'type': 'number'
463+
},
464+
'maxItems': 6,
465+
'minItems': 4,
466+
'type': 'array'
467+
},
468+
'style': 'form'
469+
}
455470
else:
456-
spatial_parameter = f"{eqe['qt']}Coords"
471+
spatial_parameter = {
472+
'$ref': f"{OPENAPI_YAML['oaedr']}/parameters/{eqe['qt']}Coords.yaml" # noqa
473+
}
457474
paths[eqe['path']] = {
458475
'get': {
459476
'summary': f"query {v['description']} by {eqe['qt']}",
460477
'description': v['description'],
461478
'tags': [k],
462479
'operationId': eqe['op_id'],
463480
'parameters': [
464-
{'$ref': f"{OPENAPI_YAML['oaedr']}/parameters/{spatial_parameter}.yaml"}, # noqa
481+
spatial_parameter,
465482
{'$ref': f"{OPENAPI_YAML['oapif-1']}#/components/parameters/datetime"}, # noqa
466483
{'$ref': f"{OPENAPI_YAML['oaedr']}/parameters/parameter-name.yaml"}, # noqa
467484
{'$ref': f"{OPENAPI_YAML['oaedr']}/parameters/z.yaml"}, # noqa

tests/cite/cite.config.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,35 @@ metadata:
5656
role: pointOfContact
5757

5858
resources:
59+
icoads-sst:
60+
type: collection
61+
title: International Comprehensive Ocean-Atmosphere Data Set (ICOADS)
62+
description: International Comprehensive Ocean-Atmosphere Data Set (ICOADS)
63+
keywords:
64+
- icoads
65+
- sst
66+
- air temperature
67+
extents:
68+
spatial:
69+
bbox: [-180,-90,180,90]
70+
crs: http://www.opengis.net/def/crs/OGC/1.3/CRS84
71+
temporal:
72+
begin: 2000-01-16T06:00:00Z
73+
end: 2000-12-16T01:20:06Z
74+
links:
75+
- type: text/html
76+
rel: canonical
77+
title: information
78+
href: https://psl.noaa.gov/data/gridded/data.coads.1deg.html
79+
hreflang: en-US
80+
providers:
81+
- type: edr
82+
name: xarray-edr
83+
data: ../data/coads_sst.nc
84+
format:
85+
name: NetCDF
86+
mimetype: application/x-netcdf
87+
5988
canada-hydat-daily-mean-02hc003:
6089
type: collection
6190
title: Daily Mean of Water Level or Flow

0 commit comments

Comments
 (0)