Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#156: catch InvalidProductError when we try to get cloud_coverage pro… #157

Merged
merged 3 commits into from
Jun 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions eoreader/stac/stac_extensions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand All @@ -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
Expand Down