Skip to content
Open
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
6 changes: 4 additions & 2 deletions openeo_driver/util/stac_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,11 @@ def recurse(item_path: Union[str, Path]) -> list:
href = robust_urljoin(item_path, href)

if "rel" in link and (link["rel"] == "child" or link["rel"] == "item"):
all_files.extend(get_files_from_stac_catalog(href, include_metadata))
else:
all_files.extend(recurse(href))
elif "roles" in link and ("data" in link["roles"]):
all_files.append(href)
else:
pass
return all_files

return_files = recurse(catalog_path)
Expand Down
6 changes: 6 additions & 0 deletions openeo_driver/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -1851,6 +1851,12 @@ def _asset_object(
# Machine learning models.
return result_dict
bands = asset_metadata.get("bands")
if not bands and stac11:
eo_bands = asset_metadata.get("eo:bands")
if eo_bands is not None:
assert isinstance(eo_bands, list), f"expected list of bands in 'eo:bands', got {type(eo_bands)}"
# Only keep name property
bands = [{"name": b["name"]} for b in eo_bands]

if bands:
# TODO: #298 this is a quick stop-gap solution for lack of clear API
Expand Down
239 changes: 239 additions & 0 deletions tests/data/example_stac_catalog_11/collection.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,239 @@
{
"assets": {
"item-2023-06-01": {
"bands": [
{
"name": "B04",
"statistics": {
"maximum": 1766.0,
"mean": 401.07085498347,
"minimum": 180.0,
"stddev": 162.43588375276,
"valid_percent": 85.92
}
},
{
"name": "B03",
"statistics": {
"maximum": 1336.0,
"mean": 598.11572980633,
"minimum": 278.0,
"stddev": 133.74416960473,
"valid_percent": 85.92
}
},
{
"name": "B02",
"statistics": {
"maximum": 1072.0,
"mean": 368.17264997638,
"minimum": 216.0,
"stddev": 99.2670146459,
"valid_percent": 85.92
}
}
],
"href": "./openEO_2023-06-01Z.tif",
"proj:bbox": [
644530.0,
5675740.0,
645300.0,
5676380.0
],
"proj:code": "EPSG:32631",
"proj:epsg": 32631,
"proj:shape": [
64,
77
],
"roles": [
"data"
],
"title": "s3://openeo-data-dev-waw4-1/batch_jobs/j-2606111953054049bc2368898439491e/openEO_2023-06-01Z.tif",
"type": "image/tiff; application=geotiff"
},
"item-2023-06-04": {
"bands": [
{
"name": "B04",
"statistics": {
"maximum": 1628.0,
"mean": 360.10746339159,
"minimum": 174.0,
"stddev": 160.47737013663,
"valid_percent": 85.92
}
},
{
"name": "B03",
"statistics": {
"maximum": 1358.0,
"mean": 546.93197921587,
"minimum": 263.0,
"stddev": 129.15120454283,
"valid_percent": 85.92
}
},
{
"name": "B02",
"statistics": {
"maximum": 1116.0,
"mean": 344.86820973075,
"minimum": 200.0,
"stddev": 95.975778884601,
"valid_percent": 85.92
}
}
],
"href": "./openEO_2023-06-04Z.tif",
"proj:bbox": [
644530.0,
5675740.0,
645300.0,
5676380.0
],
"proj:code": "EPSG:32631",
"proj:epsg": 32631,
"proj:shape": [
64,
77
],
"roles": [
"data"
],
"title": "s3://openeo-data-dev-waw4-1/batch_jobs/j-2606111953054049bc2368898439491e/openEO_2023-06-04Z.tif",
"type": "image/tiff; application=geotiff"
},
"item-2023-06-06": {
"bands": [
{
"name": "B04",
"statistics": {
"maximum": 1774.0,
"mean": 380.50094473311,
"minimum": 171.0,
"stddev": 176.19790726983,
"valid_percent": 85.92
}
},
{
"name": "B03",
"statistics": {
"maximum": 1470.0,
"mean": 592.27586206896,
"minimum": 282.0,
"stddev": 138.20284171799,
"valid_percent": 85.92
}
},
{
"name": "B02",
"statistics": {
"maximum": 1190.0,
"mean": 412.22508266415,
"minimum": 270.0,
"stddev": 103.22080164099,
"valid_percent": 85.92
}
}
],
"href": "./openEO_2023-06-06Z.tif",
"proj:bbox": [
644530.0,
5675740.0,
645300.0,
5676380.0
],
"proj:code": "EPSG:32631",
"proj:epsg": 32631,
"proj:shape": [
64,
77
],
"roles": [
"data"
],
"title": "s3://openeo-data-dev-waw4-1/batch_jobs/j-2606111953054049bc2368898439491e/openEO_2023-06-06Z.tif",
"type": "image/tiff; application=geotiff"
}
},
"description": "test description",
"extent": {
"spatial": {
"bbox": [
[
-180,
-90,
180,
90
]
]
},
"temporal": {
"interval": [
[
"2023-06-01T00:00:00Z",
"2023-06-06T00:00:00Z"
]
]
}
},
"id": "j-2606111953054049bc2368898439491e",
"license": "proprietary",
"links": [
{
"href": "./item-2023-06-01.json",
"rel": "item",
"type": "application/geo+json"
},
{
"href": "./item-2023-06-04.json",
"rel": "item",
"type": "application/geo+json"
},
{
"href": "./item-2023-06-06.json",
"rel": "item",
"type": "application/geo+json"
}
],
"openeo:status": "finished",
"providers": [
{
"description": "This data was processed on an openEO backend maintained by VITO.",
"name": "VITO",
"processing:expression": {
"expression": {
"loadstac1": {
"arguments": {
"url": "https://raw.githubusercontent.com/Open-EO/openeo-geopyspark-driver/refs/heads/master/docker/local_batch_job/example_stac_catalog/collection.json"
},
"process_id": "load_stac",
"result": true
}
},
"format": "openeo"
},
"processing:facility": "openEO Geotrellis backend",
"processing:software": {
"Geotrellis backend": "0.72.0a13"
},
"roles": [
"processor"
]
}
],
"stac_extensions": [
"https://stac-extensions.github.io/eo/v1.1.0/schema.json",
"https://stac-extensions.github.io/file/v2.1.0/schema.json",
"https://stac-extensions.github.io/processing/v1.1.0/schema.json",
"https://stac-extensions.github.io/projection/v1.2.0/schema.json"
],
"stac_version": "1.1.0",
"summaries": {},
"title": "server_test.py_stac-version_1.1",
"properties": {
"datetime": "2023-06-01T00:00:00Z"
},
"type": "Collection"
}
111 changes: 111 additions & 0 deletions tests/data/example_stac_catalog_11/item-2023-06-01.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
{
"assets": {
"item-2023-06-01": {
"bands": [
{
"name": "B04",
"statistics": {
"maximum": 1766.0,
"mean": 401.07085498347,
"minimum": 180.0,
"stddev": 162.43588375276,
"valid_percent": 85.92
}
},
{
"name": "B03",
"statistics": {
"maximum": 1336.0,
"mean": 598.11572980633,
"minimum": 278.0,
"stddev": 133.74416960473,
"valid_percent": 85.92
}
},
{
"name": "B02",
"statistics": {
"maximum": 1072.0,
"mean": 368.17264997638,
"minimum": 216.0,
"stddev": 99.2670146459,
"valid_percent": 85.92
}
}
],
"href": "./openEO_2023-06-01Z.tif",
"proj:bbox": [
644530.0,
5675740.0,
645300.0,
5676380.0
],
"proj:code": "EPSG:32631",
"proj:epsg": 32631,
"proj:shape": [
64,
77
],
"roles": [
"data"
],
"title": "s3://openeo-data-dev-waw4-1/batch_jobs/j-2606111953054049bc2368898439491e/openEO_2023-06-01Z.tif",
"type": "image/tiff; application=geotiff"
}
},
"bbox": [
5.069386757303357,
51.214543255519786,
5.080663210429039,
51.22048989375812
],
"collection": "j-2606111953054049bc2368898439491e",
"epsg": 32631,
"geometry": {
"coordinates": [
[
[
5.0804038775948115,
51.214543255519786
],
[
5.080663210429039,
51.22029444279013
],
[
5.069644719194295,
51.22048989375812
],
[
5.069386757303357,
51.21473866656907
],
[
5.0804038775948115,
51.214543255519786
]
]
],
"type": "Polygon"
},
"id": "item-2023-06-01",
"links": [
{
"href": "./collection.json",
"rel": "collection",
"type": "application/json"
}
],
"properties": {
"datetime": "2023-06-01T00:00:00Z",
"proj:code": "EPSG:32631",
"proj:epsg": 32631
},
"stac_extensions": [
"https://stac-extensions.github.io/eo/v1.1.0/schema.json",
"https://stac-extensions.github.io/file/v2.1.0/schema.json",
"https://stac-extensions.github.io/projection/v1.2.0/schema.json"
],
"stac_version": "1.1.0",
"type": "Feature"
}
Loading