diff --git a/src/cso/cso_dataspace.py b/src/cso/cso_dataspace.py index 5209280b823f4d04729ac660b5d461abacb0f8b6..8f812ea5b449cfd84f36cfbf2051489d47ed34b5 100644 --- a/src/cso/cso_dataspace.py +++ b/src/cso/cso_dataspace.py @@ -54,6 +54,7 @@ # 2026-04, Arjo Segers # Fixed definition of bounding box for global selection. # Added increasing delays to avoid rate limit errors from STAC catalogue inquiry. +# Check on different paths to 'href' attribute in stac inquiry. # @@ -175,6 +176,17 @@ import utopya # } # } # +# Idem for nrti data: +# { ..., +# "assets": { +# "Product": { +# "href": "s3://eodata/Sentinel-5P/TROPOMI/L2__NO2___/2025/10/06/S5P_RPRO_L2__NO2____20251006T150410_20251006T164737_41360_03_020901_20260203T132453.nc", +# ... +# } +# ... +# } +# } +# class CSO_DataSpace_Inquire(utopya.UtopyaRc): @@ -374,7 +386,24 @@ class CSO_DataSpace_Inquire(utopya.UtopyaRc): te = datetime.datetime.strptime(end_time, tfmt) # extract download url: - href = item.assets['netcdf'].href + if "netcdf" in item.assets.keys(): + if hasattr(item.assets["netcdf"],"href"): + href = item.assets["netcdf"].href + else: + logging.error(f"no `href` attribute in `netcdf` asset") + raise Exception + #endif + elif "Product" in item.assets.keys(): + if hasattr(item.assets["Product"],"href"): + href = item.assets["Product"].href + else: + logging.error(f"no `href` attribute in `netcdf` asset") + raise Exception + #endif + else: + logging.error(f"no `netcdf` or `Product` asset") + raise Exception + #endif # filename: filename = f"{product_id}.nc"