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

load_stac: avoid dependency on eo:bands #762

Closed
jdries opened this issue Apr 24, 2024 · 12 comments · Fixed by #844 or Open-EO/openeo-opensearch-client#44
Closed

load_stac: avoid dependency on eo:bands #762

jdries opened this issue Apr 24, 2024 · 12 comments · Fixed by #844 or Open-EO/openeo-opensearch-client#44
Assignees

Comments

@jdries
Copy link
Contributor

jdries commented Apr 24, 2024

When loading our own netcdf metadata, I get:
No band assets found in items; a band asset requires an "eo:bands" property with a "name".
While the use of the name in eo:bands is relevant, all stac assets also have a default name, because assets in STAC are represented by a dictionary.
Can we fall back to those names, if eo:bands is not present? I think that would make our load_stac less extension dependent.

@bossie
Copy link
Collaborator

bossie commented Apr 24, 2024

Yes, I've been considering this as a best-effort approach. The implicit assumption then is that those are single band assets.

@soxofaan
Copy link
Member

soxofaan commented Jun 3, 2024

Maybe worth mentioning that in the python client we're also started to collect functionality to parse band information from stac:

We might want to consolidate efforts here

@bossie
Copy link
Collaborator

bossie commented Aug 21, 2024

Any STAC collection I can test this with @jdries? Was it Joris C. who needs this feature and should I ask him?

bossie added a commit that referenced this issue Aug 21, 2024
bossie added a commit that referenced this issue Aug 21, 2024
@bossie bossie linked a pull request Aug 21, 2024 that will close this issue
@bossie
Copy link
Collaborator

bossie commented Aug 22, 2024

Related: Open-EO/openeo-processes#488

@JorisCod
Copy link

JorisCod commented Aug 22, 2024

@bossie it is about the Sentinel 1 Mosaics collection, example product here: https://radiantearth.github.io/stac-browser/#/external/catalogue.dataspace.copernicus.eu/stac/collections/GLOBAL-MOSAICS/items/Sentinel-1_DH_mosaic_2023_M08_13XDE_0_0?.asset=asset-PRODUCT

But for further details on the STAC collection, please refer to @VictorVerhaert, he initially checked the collection and identified this issue.

Background info: https://dataspace.copernicus.eu/news/2024-8-6-announcing-sentinel-1-monthly-mosaics-copernicus-data-space-ecosystem

@bossie
Copy link
Collaborator

bossie commented Aug 22, 2024

Seems to work if asset key matches the band name in the asset, however:

netCDF batch job results:

  • seem to carry "eo:bands" in my case so Just Works; 👍
  • without "eo:bands", will attempt to load NETCDF:openEO.nc:openEO.nc because the asset ID becomes the band name, instead of e.g. NETCDF:openEO.nc:B04.

test sentinel-2-l2a STAC API:

  • some assets have "eo:bands", some don't but the latter will now be included as well so 👍
  • will not return valid STAC Items if requesting fields like proj:bbox etc. are requested so needs the typical workaround;
  • also needs a workaround to cope with alternate/s3 hrefs like s3://eodata/Sentinel-2/... which GDAL does not like (either treat as a file on disk or replace with /vsis3).

GLOBAL-MOSAICS STAC API:

  • assets don't have the "data" role so needs a workaround;
  • lone PRODUCT assets have alternate/s3 hrefs that point to the product directory rather than the raster files themselves so need special treatment 👎

@bossie
Copy link
Collaborator

bossie commented Aug 23, 2024

As discussed with regards to GLOBAL-MOSAICS:

avoid bad STAC API at https://catalogue.dataspace.copernicus.eu/stac; instead expose this as regular collection backed by https://catalogue.dataspace.copernicus.eu/resto/api/collections/GLOBAL-MOSAICS/search.json?platform=SENTINEL-1

A new, better STAC API is under way.

bossie added a commit that referenced this issue Aug 23, 2024
bossie added a commit to Open-EO/openeo-opensearch-client that referenced this issue Aug 23, 2024
bossie added a commit to Open-EO/openeo-opensearch-client that referenced this issue Aug 23, 2024
bossie added a commit that referenced this issue Aug 23, 2024
The presence of "eo:bands" is still a good indicator of a band asset.

#762
bossie added a commit to Open-EO/openeo-opensearch-client that referenced this issue Aug 23, 2024
bossie added a commit to Open-EO/openeo-opensearch-client that referenced this issue Aug 23, 2024
bossie added a commit to Open-EO/openeo-geotrellis-extensions that referenced this issue Aug 23, 2024
bossie added a commit to Open-EO/openeo-geotrellis-kubernetes that referenced this issue Aug 26, 2024
@bossie
Copy link
Collaborator

bossie commented Aug 26, 2024

Exposed experimental collection SENTINEL1_GLOBAL_MOSAICS, needs proper metadata.

@bossie
Copy link
Collaborator

bossie commented Aug 26, 2024

This process graph for the whole of 2023* works on dev and returns 12 assets, as expected:

{
  "process_graph": {
    "loadcollection1": {
      "arguments": {
        "bands": [
          "VV",
          "VH"
        ],
        "id": "SENTINEL1_GLOBAL_MOSAICS",
        "spatial_extent": {
          "east": 116.677065365837,
          "north": 33.88922021846574,
          "south": 33.81885394464797,
          "west": 116.56835783699199
        },
        "temporal_extent": [
          "2022-12-31T23:59:59Z",
          "2024-01-01T00:00:00Z"
        ]
      },
      "process_id": "load_collection"
    },
    "saveresult1": {
      "arguments": {
        "data": {
          "from_node": "loadcollection1"
        },
        "format": "GTiff",
        "options": {}
      },
      "process_id": "save_result",
      "result": true
    }
  }
}

*the API seems to have a quirk in that the start date is considered exclusive (hence 2022-12-31T23:59:59Z instead of 2023-01-01T00:00:00Z to include the results for 2023-01.

bossie added a commit to Open-EO/openeo-geotrellis-kubernetes that referenced this issue Aug 26, 2024
bossie added a commit that referenced this issue Aug 26, 2024
bossie added a commit that referenced this issue Aug 26, 2024
* works if asset key matches the band name

#762

* clean it up

#762

* support test STAC API

#762

* fix tests

The presence of "eo:bands" is still a good indicator of a band asset.

#762

* add test for STAC API with assets that lack eo:bands

#762

* fixup! add test for STAC API with assets that lack eo:bands

#762

* adapt CHANGELOG

#762
bossie added a commit that referenced this issue Aug 26, 2024
@bossie
Copy link
Collaborator

bossie commented Aug 26, 2024

In addition to the new SENTINEL1_GLOBAL_MOSAICS collection, the original issue has been addressed in that:

  • a role of "data" also qualifies an asset as a load_stac'able asset with bands;
  • in the absence of "eo:bands" it will assume a single-band asset of which the band name equals the asset key.

@bossie
Copy link
Collaborator

bossie commented Aug 29, 2024

load_stac from test sentinel-2-l2a STAC API works on staging (AOT_60m does not have eo:bands):

data_cube = (connection
             .load_stac("https://test-stac-api/collections/sentinel-2-l2a",
                        spatial_extent={"west": 13.59, "south": 49.56, "east": 13.73, "north": 49.80},
                        temporal_extent=["2024-03-28T10:06:30.000Z", "2024-03-28T10:06:32.000Z"],
                        bands=["AOT_60m", "B01_60m", "B01_20m"])
             .save_result("GTiff"))

@VictorVerhaert
Copy link

@bossie is that load stac url correct? It doesn't seem like a proper URL, or is that simply one that is mocked in the tests?
If so with what source could we already try out the 60m bands?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
5 participants