diff --git a/eoreader/stac/stac_extensions.py b/eoreader/stac/stac_extensions.py index e8ae9d11..e77e198e 100644 --- a/eoreader/stac/stac_extensions.py +++ b/eoreader/stac/stac_extensions.py @@ -29,6 +29,7 @@ from rasterio.crs import CRS from eoreader import cache +from eoreader.exceptions import InvalidProductError from eoreader.stac import StacCommonNames, stac_utils from eoreader.stac._stac_keywords import ( DESCRIPTION, @@ -77,7 +78,7 @@ def __init__(self, prod, **kwargs): try: if prod._has_cloud_cover: self.cloud_cover = prod.get_cloud_cover() - except AttributeError: + except (AttributeError, InvalidProductError): pass self.bands = prod.bands @@ -156,7 +157,7 @@ def add_to_item(self, item) -> None: center_wavelength = stac_utils.to_float(band.center_wavelength) solar_illumination = stac_utils.to_float(band.solar_illumination) full_width_half_max = stac_utils.to_float(band.full_width_half_max) - except AttributeError: + except (AttributeError, InvalidProductError): center_wavelength = None solar_illumination = None full_width_half_max = None @@ -337,7 +338,7 @@ def __init__(self, prod, **kwargs): # Convert from numpy dtype (which are not JSON serializable) to standard dtype self.sun_az = stac_utils.to_float(sun_az) self.sun_el = stac_utils.to_float(sun_el) - except AttributeError: + except (AttributeError, InvalidProductError): self.sun_az = None self.sun_el = None @@ -348,7 +349,7 @@ def __init__(self, prod, **kwargs): self.view_az = stac_utils.to_float(view_az) self.off_nadir = stac_utils.to_float(off_nadir) self.incidence_angle = stac_utils.to_float(incidence_angle) - except AttributeError: + except (AttributeError, InvalidProductError): self.view_az = None self.off_nadir = None self.incidence_angle = None