Skip to content

Harmonising the addition of measurement metadata to stac_discovery #304

Open

Description

@shollendEODC

Currently, only S2 gets the reflectance attribute added to stac_discovery:

"reflectance": {
          "href": "/measurements/reflectance",
          "type": "application/vnd.zarr; version=3; profile=multiscales",
          "title": "Surface Reflectance",
          "roles": [
            "data",
            "reflectance"
          ],
          "gsd": 10,
          "proj:code": "EPSG:32633",
          "proj:shape": [
            10980,
            10980
          ]
        }

Afaik, such attributes will have to be added to the other products as well, similarly pointing at the consolidated measurement array as defined in #291

To achieve this, i suggest adding three things:

  • A registry with data_product classes in conversion/data_products.py (all S1 products, S2 products, and S3 products, build similar to S2Type in s2_multiscale.py) and the corresponding attribute for stac_discovery
class Product(StrEnum):
    _product = "L1C" # ... or anything else

    @classmethod
    def from_filename(cls, filename: str | None) -> S2Type | None:
        if not filename:
            return None
        for member in cls:
            if member.value in filename:
                return member
        return None

    @classmethod
    def from_datatree(cls, dt: xr.DataTree) -> S2Type | None:
        """Product level from `stac_discovery` `product:type`, else from the tree name.

        A tree opened from a Zarr store has no name, so the name alone is not enough.
        """
        return cls.from_filename(product_type_of(dt)) or cls.from_filename(dt.name)
  • An environment variable which sets and designates this data_product
DATA_PRODUCT = Product.from_datatree(dt_input)
  • A single function call in utils.updated_root_consolidation() which adds said attribute from the registry to the stac_discovery
for group_path in datasets:
        # extract all the parent paths and names
        parent, _, name = group_path.rstrip("/").rpartition("/")
        if parent not in datasets:
            init_zarr_group(output_path + group_path)

        # consolidate all measurement groups
        if name == "measurements":
            assign_stac_discovery_thing(...)
            zarr.consolidate_metadata(output_path + group_path, zarr_format=ZARR_FORMAT)

Is this required as such for your applications? How does the asset need to look like for other dataproducts? Is this required only for multiscale data? @lhoupert @emmanuelmathot

Activity

  1. self-assigned this
    on Oct 6, 2026
  2. added
    questionFurther information is requested
    stacSTAC metadata and items
    on Oct 6, 2026
  3. shollendEODC commented on Oct 7, 2026

    @shollendEODC
    CollaboratorAuthor

    We had an internal discussion with Mario today, and from our point of view, it would be better suited to move the logic of creating such product dependent metadata into the eopf-stac repository. There, the construction logic is better tied into already existing workflows and stac_discover/assets would contain ONLY the existing band assets (and no additional derived reflectance).

    If you your workflow is built around ingesting eopf sample service STAC items into the eopf explorer you will still be able to access the "reflectance" asset, but not from stac_discovery but actually from the STAC items themselves. Is this the intended way or are we neglecting some aspects of the inclusion of the "reflectance" asset?

  4. shollendEODC commented on Oct 14, 2026

    @shollendEODC
    CollaboratorAuthor

    For now, the construction of this metadata is moved to a separate function to help unravel the code and move it to eopf-stac. This is done in PR 314 ‎src/eopf_geozarr/s2_optimization/s2_converter.py add_s2_stac_assets()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

questionFurther information is requestedstacSTAC metadata and items

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions