Skip to content

Commit f8e3ff6

Browse files
authored
align OACov to latest updates in specification (#908)
* align OACov to latest updates in specification * update doc
1 parent 882eb48 commit f8e3ff6

File tree

4 files changed

+32
-48
lines changed

4 files changed

+32
-48
lines changed

docs/source/usage.rst

+9-10
Original file line numberDiff line numberDiff line change
@@ -218,17 +218,16 @@ OGC API - Coverages - Part 1: Core 1.0
218218
Global Deterministic Prediction System sample'
219219
>>> gdps['description']
220220
'Global Deterministic Prediction System sample'
221-
>>> domainset = w.coverage_domainset('gdps-temperature')
222-
>>> domainset['generalGrid']['axisLabels']
223-
['x', 'y']
224-
>>> domainset['generalGrid']['gridLimits']['axisLabels']
225-
['i', 'j']
226-
>>> rangetype = w.coverage_rangetype('gdps-temperature')
227-
>>> len(rangetype['field'])
221+
>>> gdps['extent']['spatial']['grid'][0]
222+
>>> {"cellsCount": 2400, "resolution": 0.15000000000000002 }
223+
>>> gdps['extent']['spatial']['grid'][1]
224+
>>> {"cellsCount": 1201, "resolution": 0.15}
225+
>>> schema = w.collection_schema('gdps-temperature')
226+
>>> len(schema['properties'])
228227
1
229-
>>> rangetype['field'][0]['definition']
230-
'float64'
231-
>> gdps_coverage_query = w.coverage('gdps-temperature', range_subset=[1])
228+
>>> schema['properties']['1']['type']
229+
'number'
230+
>> gdps_coverage_data = w.coverage('gdps-temperature', range_subset=[1])
232231
233232
OGC API - Records - Part 1: Core 1.0
234233
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

owslib/ogcapi/__init__.py

+13
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,19 @@ def collection(self, collection_id: str) -> dict:
228228
path = f'collections/{collection_id}'
229229
return self._request(path=path)
230230

231+
def collection_schema(self, collection_id: str) -> dict:
232+
"""
233+
implements /collections/{collectionId}/schema
234+
235+
@type collection_id: string
236+
@param collection_id: id of collection
237+
238+
@returns: `dict` of feature collection schema
239+
"""
240+
241+
path = f'collections/{collection_id}/schema'
242+
return self._request(path=path)
243+
231244
def collection_queryables(self, collection_id: str) -> dict:
232245
"""
233246
implements /collections/{collectionId}/queryables

owslib/ogcapi/coverages.py

-26
Original file line numberDiff line numberDiff line change
@@ -42,32 +42,6 @@ def coverages(self) -> list:
4242

4343
return coverages_
4444

45-
def coverage_domainset(self, collection_id: str, **kwargs: dict) -> dict:
46-
"""
47-
implements /collection/{collectionId}/coverage/domainset
48-
49-
@type collection_id: string
50-
@param collection_id: id of collection
51-
52-
@returns: coverage domainset results
53-
"""
54-
55-
path = f'collections/{collection_id}/coverage/domainset'
56-
return self._request(path=path, kwargs=kwargs)
57-
58-
def coverage_rangetype(self, collection_id: str, **kwargs: dict) -> dict:
59-
"""
60-
implements /collection/{collectionId}/coverage/rangetype
61-
62-
@type collection_id: string
63-
@param collection_id: id of collection
64-
65-
@returns: coverage rangetype results
66-
"""
67-
68-
path = f'collections/{collection_id}/coverage/rangetype'
69-
return self._request(path=path, kwargs=kwargs)
70-
7145
def coverage(self, collection_id: str, **kwargs: dict) -> BinaryIO:
7246
"""
7347
implements /collection/{collectionId}/coverage/

tests/test_ogcapi_coverages_pygeoapi.py

+10-12
Original file line numberDiff line numberDiff line change
@@ -35,18 +35,16 @@ def test_ogcapi_coverages_pygeoapi():
3535
assert gdps['id'] == 'gdps-temperature'
3636
assert gdps['title'] == 'Global Deterministic Prediction System sample'
3737
assert gdps['description'] == 'Global Deterministic Prediction System sample' # noqa
38-
39-
domainset = w.coverage_domainset('gdps-temperature')
40-
41-
assert domainset['generalGrid']['axisLabels'] == ['Long', 'Lat']
42-
43-
assert domainset['generalGrid']['gridLimits']['axisLabels'] == ['i', 'j']
44-
45-
rangetype = w.coverage_rangetype('gdps-temperature')
46-
assert len(rangetype['field']) == 1
47-
assert rangetype['field'][0]['name'] == 'Temperature [C]'
48-
assert rangetype['field'][0]['uom']['code'] == '[C]'
49-
assert rangetype['field'][0]['encodingInfo']['dataType'] == 'http://www.opengis.net/def/dataType/OGC/0/float64' # noqa
38+
assert gdps['extent']['spatial']['grid'][0]['cellsCount'] == 2400
39+
assert gdps['extent']['spatial']['grid'][0]['resolution'] == 0.15000000000000002 # noqa
40+
assert gdps['extent']['spatial']['grid'][1]['cellsCount'] == 1201
41+
assert gdps['extent']['spatial']['grid'][1]['resolution'] == 0.15
42+
43+
schema = w.collection_schema('gdps-temperature')
44+
assert len(schema['properties']) == 1
45+
assert schema['properties']['1']['title'] == 'Temperature [C]'
46+
assert schema['properties']['1']['type'] == 'number'
47+
assert schema['properties']['1']['x-ogc-unit'] == '[C]'
5048

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

0 commit comments

Comments
 (0)