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

align OACov to latest updates in specification #908

Merged
merged 2 commits into from
Feb 28, 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
19 changes: 9 additions & 10 deletions docs/source/usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -218,17 +218,16 @@ OGC API - Coverages - Part 1: Core 1.0
Global Deterministic Prediction System sample'
>>> gdps['description']
'Global Deterministic Prediction System sample'
>>> domainset = w.coverage_domainset('gdps-temperature')
>>> domainset['generalGrid']['axisLabels']
['x', 'y']
>>> domainset['generalGrid']['gridLimits']['axisLabels']
['i', 'j']
>>> rangetype = w.coverage_rangetype('gdps-temperature')
>>> len(rangetype['field'])
>>> gdps['extent']['spatial']['grid'][0]
>>> {"cellsCount": 2400, "resolution": 0.15000000000000002 }
>>> gdps['extent']['spatial']['grid'][1]
>>> {"cellsCount": 1201, "resolution": 0.15}
>>> schema = w.collection_schema('gdps-temperature')
>>> len(schema['properties'])
1
>>> rangetype['field'][0]['definition']
'float64'
>> gdps_coverage_query = w.coverage('gdps-temperature', range_subset=[1])
>>> schema['properties']['1']['type']
'number'
>> gdps_coverage_data = w.coverage('gdps-temperature', range_subset=[1])

OGC API - Records - Part 1: Core 1.0
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Expand Down
13 changes: 13 additions & 0 deletions owslib/ogcapi/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,19 @@ def collection(self, collection_id: str) -> dict:
path = f'collections/{collection_id}'
return self._request(path=path)

def collection_schema(self, collection_id: str) -> dict:
"""
implements /collections/{collectionId}/schema

@type collection_id: string
@param collection_id: id of collection

@returns: `dict` of feature collection schema
"""

path = f'collections/{collection_id}/schema'
return self._request(path=path)

def collection_queryables(self, collection_id: str) -> dict:
"""
implements /collections/{collectionId}/queryables
Expand Down
26 changes: 0 additions & 26 deletions owslib/ogcapi/coverages.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,32 +42,6 @@ def coverages(self) -> list:

return coverages_

def coverage_domainset(self, collection_id: str, **kwargs: dict) -> dict:
"""
implements /collection/{collectionId}/coverage/domainset

@type collection_id: string
@param collection_id: id of collection

@returns: coverage domainset results
"""

path = f'collections/{collection_id}/coverage/domainset'
return self._request(path=path, kwargs=kwargs)

def coverage_rangetype(self, collection_id: str, **kwargs: dict) -> dict:
"""
implements /collection/{collectionId}/coverage/rangetype

@type collection_id: string
@param collection_id: id of collection

@returns: coverage rangetype results
"""

path = f'collections/{collection_id}/coverage/rangetype'
return self._request(path=path, kwargs=kwargs)

def coverage(self, collection_id: str, **kwargs: dict) -> BinaryIO:
"""
implements /collection/{collectionId}/coverage/
Expand Down
22 changes: 10 additions & 12 deletions tests/test_ogcapi_coverages_pygeoapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,16 @@ def test_ogcapi_coverages_pygeoapi():
assert gdps['id'] == 'gdps-temperature'
assert gdps['title'] == 'Global Deterministic Prediction System sample'
assert gdps['description'] == 'Global Deterministic Prediction System sample' # noqa

domainset = w.coverage_domainset('gdps-temperature')

assert domainset['generalGrid']['axisLabels'] == ['Long', 'Lat']

assert domainset['generalGrid']['gridLimits']['axisLabels'] == ['i', 'j']

rangetype = w.coverage_rangetype('gdps-temperature')
assert len(rangetype['field']) == 1
assert rangetype['field'][0]['name'] == 'Temperature [C]'
assert rangetype['field'][0]['uom']['code'] == '[C]'
assert rangetype['field'][0]['encodingInfo']['dataType'] == 'http://www.opengis.net/def/dataType/OGC/0/float64' # noqa
assert gdps['extent']['spatial']['grid'][0]['cellsCount'] == 2400
assert gdps['extent']['spatial']['grid'][0]['resolution'] == 0.15000000000000002 # noqa
assert gdps['extent']['spatial']['grid'][1]['cellsCount'] == 1201
assert gdps['extent']['spatial']['grid'][1]['resolution'] == 0.15

schema = w.collection_schema('gdps-temperature')
assert len(schema['properties']) == 1
assert schema['properties']['1']['title'] == 'Temperature [C]'
assert schema['properties']['1']['type'] == 'number'
assert schema['properties']['1']['x-ogc-unit'] == '[C]'

with pytest.raises(RuntimeError):
w.coverage('gdps-temperature', properties=[8])
Loading