From 867b9fe9654d7442a549401a1626aae8e392fe9d Mon Sep 17 00:00:00 2001 From: Joachim Ungar Date: Wed, 22 Oct 2025 13:29:32 +0200 Subject: [PATCH] activate sentinel-2-c1-l2a archive --- mapchete_eo/platforms/sentinel2/archives.py | 2 +- .../platforms/sentinel2/path_mappers/__init__.py | 14 ++++++++++---- .../sentinel2/path_mappers/earthsearch.py | 12 +++++++++++- 3 files changed, 22 insertions(+), 6 deletions(-) diff --git a/mapchete_eo/platforms/sentinel2/archives.py b/mapchete_eo/platforms/sentinel2/archives.py index 51ae48c2..d420c0ee 100644 --- a/mapchete_eo/platforms/sentinel2/archives.py +++ b/mapchete_eo/platforms/sentinel2/archives.py @@ -129,7 +129,7 @@ class AWSL2ACOGv1(Archive): """COG archive on AWS using E84 STAC search endpoint.""" catalog = EarthSearchV1S2L2A( - collections=["sentinel-2-l2a"], + collections=["sentinel-2-c1-l2a"], ) item_modifier_funcs = [ item_fix_footprint, diff --git a/mapchete_eo/platforms/sentinel2/path_mappers/__init__.py b/mapchete_eo/platforms/sentinel2/path_mappers/__init__.py index 5079aade..b5bccf47 100644 --- a/mapchete_eo/platforms/sentinel2/path_mappers/__init__.py +++ b/mapchete_eo/platforms/sentinel2/path_mappers/__init__.py @@ -16,13 +16,19 @@ def default_path_mapper_guesser( in order to be detected. """ if url.startswith( - ("https://roda.sentinel-hub.com/sentinel-s2-l2a/", "s3://sentinel-s2-l2a/") - ) or url.startswith( - ("https://roda.sentinel-hub.com/sentinel-s2-l1c/", "s3://sentinel-s2-l1c/") + ( + "https://roda.sentinel-hub.com/sentinel-s2-l2a/", + "s3://sentinel-s2-l2a/", + "https://roda.sentinel-hub.com/sentinel-s2-l1c/", + "s3://sentinel-s2-l1c/", + ) ): return SinergisePathMapper(url, **kwargs) elif url.startswith( - "https://sentinel-cogs.s3.us-west-2.amazonaws.com/sentinel-s2-l2a-cogs/" + ( + "https://sentinel-cogs.s3.us-west-2.amazonaws.com/", + "https://e84-earth-search-sentinel-data.s3.us-west-2.amazonaws.com/", + ) ): return EarthSearchPathMapper(url, **kwargs) else: diff --git a/mapchete_eo/platforms/sentinel2/path_mappers/earthsearch.py b/mapchete_eo/platforms/sentinel2/path_mappers/earthsearch.py index cb532e09..da7a0dc3 100644 --- a/mapchete_eo/platforms/sentinel2/path_mappers/earthsearch.py +++ b/mapchete_eo/platforms/sentinel2/path_mappers/earthsearch.py @@ -27,7 +27,17 @@ def __init__( **kwargs, ): basedir = metadata_xml.parent - self._path = (basedir / "tileinfo_metadata.json").read_json()["path"] + if basedir.startswith( + "https://e84-earth-search-sentinel-data.s3.us-west-2.amazonaws.com/" + ): + tile_info_json = "tileInfo.json" + elif basedir.startswith("https://sentinel-cogs.s3.us-west-2.amazonaws.com"): + tile_info_json = "tileinfo_metadata.json" + else: + raise ValueError( + f"cannot determine tile info JSON path from basepath {basedir}" + ) + self._path = (basedir / tile_info_json).read_json()["path"] self._utm_zone, self._latitude_band, self._grid_square = basedir.elements[-6:-3] self._baseurl = alternative_metadata_baseurl self._protocol = protocol