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

update EDR compliance #1896

Merged
merged 1 commit into from
Jan 5, 2025
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
29 changes: 19 additions & 10 deletions pygeoapi/api/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1113,12 +1113,12 @@ def describe_collections(api: API, request: APIRequest,
'href': f'{api.get_collections_url()}/{k}/items?f={F_HTML}' # noqa
})

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

elif collection_data_type == 'coverage':
# TODO: translate
Expand Down Expand Up @@ -1235,6 +1235,12 @@ def describe_collections(api: API, request: APIRequest,
'id': key,
'type': 'Parameter',
'name': value['title'],
'observedProperty': {
'label': {
'id': key,
'en': value['title']
},
},
'unit': {
'label': {
'en': value['title']
Expand All @@ -1250,8 +1256,11 @@ def describe_collections(api: API, request: APIRequest,
data_query = {
'link': {
'href': f'{api.get_collections_url()}/{k}/{qt}',
'rel': 'data'
}
'rel': 'data',
'variables': {
'query_type': qt
}
}
}
collection['data_queries'][qt] = data_query

Expand All @@ -1264,13 +1273,13 @@ def describe_collections(api: API, request: APIRequest,
'type': 'application/json',
'rel': 'data',
'title': title1,
'href': f'{api.get_collections_url()}/{k}/{qt}?f={F_JSON}' # noqa
'href': f'{api.get_collections_url()}/{k}/{qt}?f={F_JSON}'
})
collection['links'].append({
'type': FORMAT_TYPES[F_HTML],
'rel': 'data',
'title': title2,
'href': f'{api.get_collections_url()}/{k}/{qt}?f={F_HTML}' # noqa
'href': f'{api.get_collections_url()}/{k}/{qt}?f={F_HTML}'
})

if dataset is not None and k == dataset:
Expand Down
23 changes: 20 additions & 3 deletions pygeoapi/api/environmental_data_retrieval.py
Original file line number Diff line number Diff line change
Expand Up @@ -451,17 +451,34 @@ def get_oas_30(cfg: dict, locale: str) -> tuple[list[dict[str, str]], dict[str,

for eqe in edr_query_endpoints:
if eqe['qt'] == 'cube':
spatial_parameter = 'bbox'
spatial_parameter = {
'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
'explode': False,
'in': 'query',
'name': 'bbox',
'required': True,
'schema': {
'items': {
'type': 'number'
},
'maxItems': 6,
'minItems': 4,
'type': 'array'
},
'style': 'form'
}
else:
spatial_parameter = f"{eqe['qt']}Coords"
spatial_parameter = {
'$ref': f"{OPENAPI_YAML['oaedr']}/parameters/{eqe['qt']}Coords.yaml" # noqa
}
paths[eqe['path']] = {
'get': {
'summary': f"query {v['description']} by {eqe['qt']}",
'description': v['description'],
'tags': [k],
'operationId': eqe['op_id'],
'parameters': [
{'$ref': f"{OPENAPI_YAML['oaedr']}/parameters/{spatial_parameter}.yaml"}, # noqa
spatial_parameter,
{'$ref': f"{OPENAPI_YAML['oapif-1']}#/components/parameters/datetime"}, # noqa
{'$ref': f"{OPENAPI_YAML['oaedr']}/parameters/parameter-name.yaml"}, # noqa
{'$ref': f"{OPENAPI_YAML['oaedr']}/parameters/z.yaml"}, # noqa
Expand Down
29 changes: 29 additions & 0 deletions tests/cite/cite.config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,35 @@ metadata:
role: pointOfContact

resources:
icoads-sst:
type: collection
title: International Comprehensive Ocean-Atmosphere Data Set (ICOADS)
description: International Comprehensive Ocean-Atmosphere Data Set (ICOADS)
keywords:
- icoads
- sst
- air temperature
extents:
spatial:
bbox: [-180,-90,180,90]
crs: http://www.opengis.net/def/crs/OGC/1.3/CRS84
temporal:
begin: 2000-01-16T06:00:00Z
end: 2000-12-16T01:20:06Z
links:
- type: text/html
rel: canonical
title: information
href: https://psl.noaa.gov/data/gridded/data.coads.1deg.html
hreflang: en-US
providers:
- type: edr
name: xarray-edr
data: ../data/coads_sst.nc
format:
name: NetCDF
mimetype: application/x-netcdf

canada-hydat-daily-mean-02hc003:
type: collection
title: Daily Mean of Water Level or Flow
Expand Down