From cf2e8f366693fd136b5fa135e27e9599a62912b7 Mon Sep 17 00:00:00 2001 From: jteulade Date: Thu, 13 Jun 2024 11:00:37 +0200 Subject: [PATCH] #156: catch all InvalidProductError due to properties not found in metadata --- eoreader/stac/stac_extensions.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/eoreader/stac/stac_extensions.py b/eoreader/stac/stac_extensions.py index 805b4866..e77e198e 100644 --- a/eoreader/stac/stac_extensions.py +++ b/eoreader/stac/stac_extensions.py @@ -157,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 @@ -338,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 @@ -349,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