Skip to content

Error when searching for S1_SAR_SLC data using geodes_s3 provider #1978

@guillaumeeb

Description

@guillaumeeb

Describe the bug
Using S1_SAR_SLC with geodes_s3 provider consistently results in error:

error at retrieval of data from geodes_s3, for params: {'count': False, 'productType': 'S1_SAR_SLC', 'startTimeFromAscendingNode': '2025-06-05', 'completionTimeFromAscendingNode': '2025-06-26', 'geometry': <POLYGON ((2.25 48.8, 2.25 48.93, 2.44 48.93, 2.44 48.8, 2.25 48.8))>, 'page': 1, 'items_per_page': 1000}
---------------------------------------------------------------------------
BadZipFile                                Traceback (most recent call last)

Code To Reproduce

from eodag.utils.logging import setup_logging
setup_logging(verbose=3)
import os
#os.environ['PROJ_DATA']='/work/scratch/env/eynardbg/.conda/envs/geodes_dl_2/share/proj'
from assumerole import assumerole

# public-read-only-OT role
arn = "arn:aws:iam::732885638740:role/public-read-only-OT"

# Set credentials for 1 hour, 60*60s
s3_credentials = assumerole.getCredentials(arn, 7200)
for k, v in s3_credentials.items():
    os.environ[f"EODAG__GEODES_S3__AUTH__CREDENTIALS__{k}"] = v

from eodag import EODataAccessGateway

dag = EODataAccessGateway()

from eodag.utils.logging import setup_logging
setup_logging(verbose=3)

search_bbox = [2.25, 48.8, 2.44, 48.93]
search_criteria = dict(
    provider="geodes_s3",
    productType="S1_SAR_SLC",
    start="2025-06-05",
    end="2025-06-26",
    geom=search_bbox,
    )
 
results = dag.search_all(**search_criteria)
results

Output

2025-12-16 16:22:25,539 eodag.core                       [INFO    ] Searching for all the products with provider geodes_s3 and a maximum of 1000 items per page.
2025-12-16 16:22:25,540 eodag.core                       [INFO    ] Iterate search over multiple pages: page #1
2025-12-16 16:22:25,540 eodag.core                       [INFO    ] Searching on provider geodes_s3
2025-12-16 16:22:25,545 eodag.search.base                [INFO    ] geodes_s3 is configured with default sorting by 'startTimeFromAscendingNode' in ascending order
2025-12-16 16:22:25,546 eodag.search.base                [DEBUG   ] Mapping eodag product type to provider product type
2025-12-16 16:22:25,546 eodag.search.qssearch            [DEBUG   ] Building the query string that will be used for search
2025-12-16 16:22:25,547 eodag.product.metadata_mapping   [DEBUG   ] Retrieving queryable metadata from metadata_mapping
2025-12-16 16:22:25,548 eodag.search.qssearch            [INFO    ] Sending search request: https://geodes-portal.cnes.fr/api/stac/search
2025-12-16 16:22:25,549 eodag.search.qssearch            [DEBUG   ] Query parameters: {"query": {"dataset": {"eq": "PEPS_S1_L1"}, "end_datetime": {"gte": "2025-06-05T00:00:00.000Z"}, "start_datetime": {"lte": "2025-06-26T00:00:00.000Z"}, "product:type": {"eq": "SLC"}}, "intersects": {"type": "Polygon", "coordinates": [[[2.25, 48.8], [2.25, 48.93], [2.44, 48.93], [2.44, 48.8], [2.25, 48.8]]]}, "sortBy": [{"field": "start_datetime", "direction": "asc"}], "limit": 1000, "page": 1}
2025-12-16 16:22:25,549 eodag.search.qssearch            [DEBUG   ] Query kwargs: {}
2025-12-16 16:22:25,945 eodag.search.qssearch            [DEBUG   ] Next page URL could not be collected
2025-12-16 16:22:25,946 eodag.search.qssearch            [DEBUG   ] Next page Query-object could not be collected
2025-12-16 16:22:25,946 eodag.search.qssearch            [DEBUG   ] Next page merge could not be collected
2025-12-16 16:22:25,947 eodag.search.qssearch            [DEBUG   ] Adapting 12 plugin results to eodag product representation
2025-12-16 16:22:25,974 eodag.utils.s3                   [DEBUG   ] Listing assets in 2025/06/05/S1A_IW_SLC__1SDV_20250605T055927_20250605T055955_059507_076330_197E.zip
2025-12-16 16:22:27,849 eodag.core                       [WARNING ] error at retrieval of data from geodes_s3, for params: {'count': False, 'productType': 'S1_SAR_SLC', 'startTimeFromAscendingNode': '2025-06-05', 'completionTimeFromAscendingNode': '2025-06-26', 'geometry': <POLYGON ((2.25 48.8, 2.25 48.93, 2.44 48.93, 2.44 48.8, 2.25 48.8))>, 'page': 1, 'items_per_page': 1000}
---------------------------------------------------------------------------
BadZipFile                                Traceback (most recent call last)
Cell In[10], line 13
      4 search_bbox = [2.25, 48.8, 2.44, 48.93]
      5 search_criteria = dict(
      6     provider="geodes_s3",
      7     productType="S1_SAR_SLC",
   (...)     10     geom=search_bbox,
     11     )
---> 13 results = dag.search_all(**search_criteria)
     14 results

File /work/scratch/env/eynardbg/.conda/envs/geodes_dl/lib/python3.12/site-packages/eodag/api/core.py:1518, in EODataAccessGateway.search_all(self, items_per_page, start, end, geom, locations, **kwargs)
   1516 all_results = SearchResult([])
   1517 try:
-> 1518     for page_results in self.search_iter_page_plugin(
   1519         items_per_page=itp,
   1520         search_plugin=search_plugin,
   1521         count=False,
   1522         **search_kwargs,
   1523     ):
   1524         all_results.data.extend(page_results.data)
   1525     logger.info(
   1526         "Found %s result(s) on provider '%s'",
   1527         len(all_results),
   1528         search_plugin.provider,
   1529     )

File /work/scratch/env/eynardbg/.conda/envs/geodes_dl/lib/python3.12/site-packages/eodag/api/core.py:1347, in EODataAccessGateway.search_iter_page_plugin(self, search_plugin, items_per_page, **kwargs)
   1344 try:
   1345     # remove unwanted kwargs for _do_search
   1346     kwargs.pop("raise_errors", None)
-> 1347     search_result = self._do_search(
   1348         search_plugin, raise_errors=True, **kwargs
   1349     )
   1350     # if count is enabled, it will only be performed on 1st iteration
   1351     if iteration == 1:

File /work/scratch/env/eynardbg/.conda/envs/geodes_dl/lib/python3.12/site-packages/eodag/api/core.py:1932, in EODataAccessGateway._do_search(self, search_plugin, count, raise_errors, **kwargs)
   1929         logger.debug("product type %s not found", eo_product.product_type)
   1931     if eo_product.search_intersection is not None:
-> 1932         eo_product._register_downloader_from_manager(self._plugins_manager)
   1934 results.extend(res)
   1935 total_results = (
   1936     None
   1937     if (nb_res is None or total_results is None)
   1938     else total_results + nb_res
   1939 )

File /work/scratch/env/eynardbg/.conda/envs/geodes_dl/lib/python3.12/site-packages/eodag/api/product/_product.py:272, in EOProduct._register_downloader_from_manager(self, plugins_manager)
    270 except StopIteration:
    271     auth_plugin = None
--> 272 self.register_downloader(download_plugin, auth_plugin)

File /work/scratch/env/eynardbg/.conda/envs/geodes_dl/lib/python3.12/site-packages/eodag/plugins/search/stac_list_assets.py:47, in patched_register_downloader(self, downloader, authenticator)
     45 # and also update assets
     46 try:
---> 47     update_assets_from_s3(
     48         self, authenticator, getattr(downloader.config, "s3_endpoint", None)
     49     )
     50 except BotoCoreError as e:
     51     raise RequestError.from_error(e, "could not update assets") from e

File /work/scratch/env/eynardbg/.conda/envs/geodes_dl/lib/python3.12/site-packages/eodag/utils/s3.py:549, in update_assets_from_s3(product, auth, s3_endpoint, content_url)
    543 s3_client = auth.get_s3_client()
    545 if prefix.endswith(".zip"):
    546     # List prefix zip content
    547     assets_urls = [
    548         f"[zip+s3://{bucket}/{prefix}!{](zip+s3://{bucket}/%7Bprefix%7D!%7Bf.filename)[f.filename](zip+s3://{bucket}/%7Bprefix%7D!%7Bf.filename)}"
--> 549         for f in list_files_in_s3_zipped_object(bucket, prefix, s3_client)
    550     ]
    551 else:
    552     # List files in prefix
    553     assets_urls = [
    554         f"s3://{bucket}/{obj['Key']}"
    555         for obj in s3_client.list_objects(
    556             Bucket=bucket, Prefix=prefix, MaxKeys=300
    557         ).get("Contents", [])
    558     ]

File /work/scratch/env/eynardbg/.conda/envs/geodes_dl/lib/python3.12/site-packages/eodag/utils/s3.py:787, in list_files_in_s3_zipped_object(bucket_name, key_name, s3_client)
    773 def list_files_in_s3_zipped_object(
    774     bucket_name: str, key_name: str, s3_client: S3Client
    775 ) -> list[ZipInfo]:
    776     """
    777     List files in s3 zipped object, without downloading it.
    778 
   (...)    785     :returns: List of files in zip
    786     """
--> 787     zip_file, _ = open_s3_zipped_object(bucket_name, key_name, s3_client)
    788     with zip_file:
    789         logger.debug("Found %s files in %s" % (len(zip_file.filelist), key_name))

File /work/scratch/env/eynardbg/.conda/envs/geodes_dl/lib/python3.12/site-packages/eodag/utils/s3.py:649, in open_s3_zipped_object(bucket_name, key_name, s3_client, zip_size, partial)
    640 cd_data = fetch_range(
    641     bucket_name, key_name, cd_start, cd_start + cd_size - 1, s3_client
    642 )
    644 zip_data = (
    645     cd_data + eocd
    646     if partial
    647     else fetch_range(bucket_name, key_name, 0, zip_size - 1, s3_client)
    648 )
--> 649 zipf = ZipFile(io.BytesIO(zip_data))
    650 return zipf, cd_data

File /work/scratch/env/eynardbg/.conda/envs/geodes_dl/lib/python3.12/zipfile/__init__.py:1370, in ZipFile.__init__(self, file, mode, compression, allowZip64, compresslevel, strict_timestamps, metadata_encoding)
   1368 try:
   1369     if mode == 'r':
-> 1370         self._RealGetContents()
   1371     elif mode in ('w', 'x'):
   1372         # set the modified flag so central directory gets written
   1373         # even if no files are added to the archive
   1374         self._didModify = True

File /work/scratch/env/eynardbg/.conda/envs/geodes_dl/lib/python3.12/zipfile/__init__.py:1464, in ZipFile._RealGetContents(self)
   1462 centdir = struct.unpack(structCentralDir, centdir)
   1463 if centdir[_CD_SIGNATURE] != stringCentralDir:
-> 1464     raise BadZipFile("Bad magic number for central directory")
   1465 if self.debug > 2:
   1466     print(centdir)

BadZipFile: Bad magic number for central directory

Environment:

  • Python version: 3.12
  • EODAG version: 3.10.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions