Repository navigation
Open
Labels
questionFurther information is requestedFurther information is requestedstacSTAC metadata and itemsSTAC metadata and items
Description
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_productclasses inconversion/data_products.py(all S1 products, S2 products, and S3 products, build similar toS2Typeins2_multiscale.py) and the corresponding attribute forstac_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 thestac_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
Metadata
Metadata
Assignees
Labels
questionFurther information is requestedFurther information is requestedstacSTAC metadata and itemsSTAC metadata and items
Activity
shollendEODC commentedon Oct 7, 2026
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-stacrepository. There, the construction logic is better tied into already existing workflows andstac_discover/assetswould contain ONLY the existing band assets (and no additional derivedreflectance).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 fromstac_discoverybut actually from the STAC items themselves. Is this the intended way or are we neglecting some aspects of the inclusion of the"reflectance"asset?shollendEODC commentedon Oct 14, 2026
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.pyadd_s2_stac_assets()