sertit / eoreader

Remote-sensing opensource python library reading optical and SAR sensors, loading and stacking bands, clouds, DEM and spectral indices in a sensor-agnostic way.
https://eoreader.readthedocs.io/en/latest/
Apache License 2.0
271 stars 22 forks source link

product.kml not found for Radarsat-2 product #155

Open jteulade opened 3 weeks ago

jteulade commented 3 weeks ago

For a lot of products whose : s3://sertit-projects-archives/projects/2021/FormationPCAlgerie/FormationPCAlgerie2016/TP/Donnees/TP_9_2/RS2_OK28193_PK280925_DK255114_MF23_20120228_053641_HH_SGF/RS2_OK28193_PK280925_DK255114_MF23_20120228_053641_HH_SGF

I get this error:

Traceback (most recent call last):
  File "E:\JTeulade\repositories\stac\scripts\add_items.py", line 35, in <module>
    main()
  File "E:\JTeulade\repositories\stac\libs\sertit-utils\sertit\s3.py", line 99, in s3_env_wrapper
    return function(*_args, **_kwargs)
  File "E:\JTeulade\repositories\stac\scripts\add_items.py", line 22, in main
    add_items(valid_path_products, S3_TARGET_PATH, utils.get_ids())
  File "E:\JTeulade\repositories\stac\stac\stac.py", line 294, in add_items
    path_products = create_items(valid_path_products, catalog, s3_target_path)
  File "E:\JTeulade\repositories\stac\stac\stac.py", line 205, in create_items
    create_item(
  File "E:\JTeulade\repositories\stac\stac\stac.py", line 132, in create_item
    prod.stac.create_item()
  File "e:\jteulade\repositories\eoreader\eoreader\products\product.py", line 1424, in stac
    self._stac = StacItem(self)
  File "e:\jteulade\repositories\eoreader\eoreader\stac\stac_item.py", line 69, in __init__
    self.proj = ProjExt(prod, **kwargs)
  File "e:\jteulade\repositories\eoreader\eoreader\stac\stac_extensions.py", line 210, in __init__
    self.epsg = self.crs().to_epsg()
  File "C:\Users\jteulade\AppData\Local\anaconda3\envs\arcgispro-eo\lib\site-packages\methodtools.py", line 72, in __call__
    return self.__call__(*args, **kwargs)
  File "e:\jteulade\repositories\eoreader\eoreader\__init__.py", line 34, in wrapper
    return func(*args, **kwargs)
  File "e:\jteulade\repositories\eoreader\eoreader\stac\stac_extensions.py", line 232, in crs
    return self._prod.crs()
  File "C:\Users\jteulade\AppData\Local\anaconda3\envs\arcgispro-eo\lib\site-packages\methodtools.py", line 72, in __call__
    return self.__call__(*args, **kwargs)
  File "e:\jteulade\repositories\eoreader\eoreader\__init__.py", line 34, in wrapper
    return func(*args, **kwargs)
  File "e:\jteulade\repositories\eoreader\eoreader\products\sar\sar_product.py", line 382, in crs
    extent_wgs84 = self.wgs84_extent()
  File "C:\Users\jteulade\AppData\Local\anaconda3\envs\arcgispro-eo\lib\site-packages\methodtools.py", line 72, in __call__
    return self.__call__(*args, **kwargs)
  File "e:\jteulade\repositories\eoreader\eoreader\__init__.py", line 34, in wrapper
    return func(*args, **kwargs)
  File "e:\jteulade\repositories\eoreader\eoreader\products\sar\rs2_product.py", line 431, in wgs84_extent
    raise InvalidProductError(
eoreader.exceptions.InvalidProductError: Extent file (product.kml) not found in s3://sertit-projects-archives/projects/2021/FormationPCAlgerie/FormationPCAlgerie2016/TP/Donnees/TP_9_2/RS2_OK28193_PK280925_DK255114_MF23_20120228_053641_HH_SGF/RS2_OK28193_PK280925_DK255114_MF23_20120228_053641_HH_SGF

However product.kml file is not required in RS2 products here

image

We have the same problem for map-overlay.kml and S1 products

remi-braun commented 3 weeks ago

There is a need to create workarounds when looking for these files (it's for the footprints right ? Sadly, we cannot compute a footprint from non-orthorectified data, so we should 1/ ortho the default band 2/ compute the footprint)

Maybe catch the error for now when creating the STAC Item and set the extent instead of the footprint (with a warning)