diff --git a/test/webapi/ows/stac/demo-collection.json b/test/webapi/ows/stac/demo-collection.json index e86e9ac1c..58bf05393 100644 --- a/test/webapi/ows/stac/demo-collection.json +++ b/test/webapi/ows/stac/demo-collection.json @@ -417,6 +417,8 @@ } }, "xcube:dataset": { + "id": "demo", + "title": "xcube-server Demonstration L2C Cube", "groupTitle": "Demo", "tags": [ "demo", @@ -785,18 +787,6 @@ } ], "dimensions": [ - { - "name": "time", - "size": 5, - "dtype": "datetime64[ns]", - "coordinates": [ - "2017-01-16T10:09:21Z", - "2017-01-25T09:35:51Z", - "2017-01-26T10:50:17Z", - "2017-01-28T09:58:11Z", - "2017-01-30T10:46:34Z" - ] - }, { "name": "lat", "size": 1000, @@ -1804,6 +1794,18 @@ 50.00125 ] }, + { + "name": "time", + "size": 5, + "dtype": "datetime64[ns]", + "coordinates": [ + "2017-01-16T10:09:21Z", + "2017-01-25T09:35:51Z", + "2017-01-26T10:50:17Z", + "2017-01-28T09:58:11Z", + "2017-01-30T10:46:34Z" + ] + }, { "name": "lon", "size": 2000, diff --git a/test/webapi/ows/stac/stac-datacubes-item.json b/test/webapi/ows/stac/stac-datacubes-item.json index e74011a2d..b967c214a 100644 --- a/test/webapi/ows/stac/stac-datacubes-item.json +++ b/test/webapi/ows/stac/stac-datacubes-item.json @@ -256,12 +256,111 @@ } }, "xcube:dataset": { + "id": "demo-1w", + "title": "xcube-server Demonstration L3 Cube", "groupTitle": "Demo", "tags": [ "demo", "zarr", "computed" ], + "bbox": [ + 0.0, + 50.0, + 5.0, + 52.5 + ], + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + 0.0, + 50.0 + ], + [ + 0.0, + 50.5 + ], + [ + 0.0, + 51.0 + ], + [ + 0.0, + 51.5 + ], + [ + 0.0, + 52.0 + ], + [ + 0.0, + 52.5 + ], + [ + 1.0, + 52.5 + ], + [ + 2.0, + 52.5 + ], + [ + 3.0, + 52.5 + ], + [ + 4.0, + 52.5 + ], + [ + 5.0, + 52.5 + ], + [ + 5.0, + 52.0 + ], + [ + 5.0, + 51.5 + ], + [ + 5.0, + 51.0 + ], + [ + 5.0, + 50.5 + ], + [ + 5.0, + 50.0 + ], + [ + 4.0, + 50.0 + ], + [ + 3.0, + 50.0 + ], + [ + 2.0, + 50.0 + ], + [ + 1.0, + 50.0 + ], + [ + 0.0, + 50.0 + ] + ] + ] + }, "spatialRef": "EPSG:4326", "variables": [ { @@ -790,16 +889,6 @@ } ], "dimensions": [ - { - "name": "time", - "size": 3, - "dtype": "datetime64[ns]", - "coordinates": [ - "2017-01-22T00:00:00Z", - "2017-01-29T00:00:00Z", - "2017-02-05T00:00:00Z" - ] - }, { "name": "lat", "size": 1000, @@ -1807,6 +1896,16 @@ 50.00125 ] }, + { + "name": "time", + "size": 3, + "dtype": "datetime64[ns]", + "coordinates": [ + "2017-01-22T00:00:00Z", + "2017-01-29T00:00:00Z", + "2017-02-05T00:00:00Z" + ] + }, { "name": "lon", "size": 2000, diff --git a/test/webapi/ows/stac/stac-single-item.json b/test/webapi/ows/stac/stac-single-item.json index 9b41d60ae..69eedcf1a 100644 --- a/test/webapi/ows/stac/stac-single-item.json +++ b/test/webapi/ows/stac/stac-single-item.json @@ -256,12 +256,111 @@ } }, "xcube:dataset": { + "id": "demo-1w", + "title": "xcube-server Demonstration L3 Cube", "groupTitle": "Demo", "tags": [ "demo", "zarr", "computed" ], + "bbox": [ + 0.0, + 50.0, + 5.0, + 52.5 + ], + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + 0.0, + 50.0 + ], + [ + 0.0, + 50.5 + ], + [ + 0.0, + 51.0 + ], + [ + 0.0, + 51.5 + ], + [ + 0.0, + 52.0 + ], + [ + 0.0, + 52.5 + ], + [ + 1.0, + 52.5 + ], + [ + 2.0, + 52.5 + ], + [ + 3.0, + 52.5 + ], + [ + 4.0, + 52.5 + ], + [ + 5.0, + 52.5 + ], + [ + 5.0, + 52.0 + ], + [ + 5.0, + 51.5 + ], + [ + 5.0, + 51.0 + ], + [ + 5.0, + 50.5 + ], + [ + 5.0, + 50.0 + ], + [ + 4.0, + 50.0 + ], + [ + 3.0, + 50.0 + ], + [ + 2.0, + 50.0 + ], + [ + 1.0, + 50.0 + ], + [ + 0.0, + 50.0 + ] + ] + ] + }, "spatialRef": "EPSG:4326", "variables": [ { @@ -790,16 +889,6 @@ } ], "dimensions": [ - { - "name": "time", - "size": 3, - "dtype": "datetime64[ns]", - "coordinates": [ - "2017-01-22T00:00:00Z", - "2017-01-29T00:00:00Z", - "2017-02-05T00:00:00Z" - ] - }, { "name": "lat", "size": 1000, @@ -1807,6 +1896,16 @@ 50.00125 ] }, + { + "name": "time", + "size": 3, + "dtype": "datetime64[ns]", + "coordinates": [ + "2017-01-22T00:00:00Z", + "2017-01-29T00:00:00Z", + "2017-02-05T00:00:00Z" + ] + }, { "name": "lon", "size": 2000, @@ -3819,7 +3918,7 @@ "Conventions": "CF-1.7" }, "attributions": [ - "\u00a9 by Brockmann Consult GmbH 2020, contains modified Copernicus Data 2019, processed by ESA" + "© by Brockmann Consult GmbH 2020, contains modified Copernicus Data 2019, processed by ESA" ] }, "datetime": null, diff --git a/xcube/webapi/ows/stac/controllers.py b/xcube/webapi/ows/stac/controllers.py index 0dbbe452b..41c37d376 100644 --- a/xcube/webapi/ows/stac/controllers.py +++ b/xcube/webapi/ows/stac/controllers.py @@ -621,7 +621,7 @@ def _get_single_dataset_collection( }, "temporal": {"interval": [time_interval], "grid": get_time_grid(dataset)}, }, - "id": dataset_dict.pop("id"), + "id": dataset_dict.get("id"), "keywords": [], "license": "proprietary", "links": [ @@ -805,9 +805,9 @@ def _get_dataset_feature( "stac_version": STAC_VERSION, "stac_extensions": STAC_EXTENSIONS, "type": "Feature", - "id": dataset_dict.pop("id"), - "bbox": dataset_dict.pop("bbox"), - "geometry": dataset_dict.pop("geometry"), + "id": dataset_dict.get("id"), + "bbox": dataset_dict.get("bbox"), + "geometry": dataset_dict.get("geometry"), "properties": _get_cube_properties(ctx, dataset_id, dataset_dict), "collection": collection_id, "links": [ @@ -840,7 +840,7 @@ def _get_cube_properties( dataset = ml_dataset.base_dataset properties = dict() - properties["title"] = dataset_dict.pop("title", dataset_id) + properties["title"] = dataset_dict.get("title", dataset_id) cube_dimensions = get_datacube_dimensions(dataset, grid_mapping) properties["cube:dimensions"] = cube_dimensions properties["cube:variables"] = _get_dc_variables(dataset, cube_dimensions)