From d4fbcca152f7a000074e1a41c22dde4d8776b14b Mon Sep 17 00:00:00 2001 From: Arjo Segers Date: Thu, 30 Apr 2026 14:03:52 +0200 Subject: [PATCH] Check on different paths to `href` attribute in stac inquiry. --- src/cso/cso_dataspace.py | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/src/cso/cso_dataspace.py b/src/cso/cso_dataspace.py index 5209280..8f812ea 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" -- GitLab