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

Maxar product with QB02 satellite ID #140

Closed jteulade closed 1 month ago

jteulade commented 1 month ago

When you open a maxar product with QB02 satellite ID, you have the following error:

Traceback (most recent call last):
  File "E:\JTeulade\repositories\stac\scripts\find_valid_product.py", line 33, in <module>
    path_products = get_path_products(PATH_TO_CRAWL)
  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\stac\product.py", line 63, in get_path_products
    if all(d not in full_path.parts for d in BLACKLIST_DIRECTORIES) and check_product_and_fill_path(
  File "E:\JTeulade\repositories\stac\stac\product.py", line 103, in check_product_and_fill_path
    with Reader().open(path_to_check, remove_tmp=True) as prod:
  File "e:\jteulade\repositories\eoreader\eoreader\reader.py", line 537, in open
    prod = self._open_path(
  File "e:\jteulade\repositories\eoreader\eoreader\reader.py", line 699, in _open_path
    prod = create_product(
  File "e:\jteulade\repositories\eoreader\eoreader\reader.py", line 966, in create_product
    prod = class_(
  File "e:\jteulade\repositories\eoreader\eoreader\products\optical\vhr_product.py", line 91, in __init__
    super().__init__(product_path, archive_path, output_path, remove_tmp, **kwargs)
  File "e:\jteulade\repositories\eoreader\eoreader\products\optical\optical_product.py", line 116, in __init__
    super().__init__(product_path, archive_path, output_path, remove_tmp, **kwargs)
  File "e:\jteulade\repositories\eoreader\eoreader\products\product.py", line 259, in __init__
    self.constellation = self._get_constellation()
  File "e:\jteulade\repositories\eoreader\eoreader\products\optical\maxar_product.py", line 450, in _get_constellation
    return getattr(Constellation, constellation_id)
  File "C:\Users\jteulade\AppData\Local\anaconda3\envs\arcgispro-eo\lib\enum.py", line 429, in __getattr__
    raise AttributeError(name) from None
AttributeError: QB02

Why? Here , you try to access to the satellite ID QB02 from MaxarSatId enum in Constellation enum. But Constellation enum has only a QB attribute. That's the problem.

You can find a corresponding product: s3://sertit-projects-archives/projects/2019/EUGENIUS/Bari/Images/QB_19012007/EQ02_BGI_PSH_OR_20070119T100428_20070119T100432_DGI_29523_8F27.0000.tar

remi-braun commented 1 month ago

I'd rather set QB everywhere than QB02 which complicates things where it shouldn't. 😅 Is there a particular reason why you chose QB02 ?

jteulade commented 1 month ago

I didn't see your comment, and I merged :/

From here I get this In this PDF, they never talk about QB, but only QB02. That's why, I used this attribute.

Moreover, I think the ID QB02 come from the metadata of the product here So, i can't change this value.