Skip to content

Commit

Permalink
- FIX: Raise proper exception (UnhandledArchiveError) for archived …
Browse files Browse the repository at this point in the history
…data that needs to be extracted before use. A warning wasn't enough.

- FIX: Remove unused `pixel_spacing` for SAR Products
  • Loading branch information
remi-braun committed Mar 21, 2024
1 parent 10ae28c commit 9c395f6
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 4 deletions.
2 changes: 2 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
## 0.21.1 (2024-mm-dd)

- FIX: Correct `SWIR_CIRRUS` spectral band's enum value (to `SWIR_CIRRUS` instead of `CIRRUS`), avoiding shadowing cloud band `CIRRUS` ([#131](https://github.com/sertit/eoreader/issues/131))
- FIX: Raise proper exception (`UnhandledArchiveError`) for archived data that needs to be extracted before use. A warning wasn't enough.
- FIX: Remove unused `pixel_spacing` for SAR Products

## 0.21.0.post0 (2024-01-08)

Expand Down
6 changes: 6 additions & 0 deletions eoreader/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,9 @@ class InvalidTypeError(EoReaderError, TypeError):
"""Invalid Type Name error, thrown when an unknown type is given (should never happen)."""

pass


class UnhandledArchiveError(EoReaderError):
"""Unhandled Archive error, thrown when an archived product needs to be extracted to be processed."""

pass
5 changes: 4 additions & 1 deletion eoreader/products/product.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@
InvalidIndexError,
InvalidProductError,
InvalidTypeError,
UnhandledArchiveError,
)
from eoreader.keywords import DEM_KW, HILLSHADE_KW, SLOPE_KW
from eoreader.reader import Constellation, Reader
Expand Down Expand Up @@ -238,7 +239,9 @@ def __init__(

# Only compute data if OK (for now OK is extracted if needed)
if self.is_archived and self.needs_extraction:
LOGGER.warning(f"{self.filename} needs to be extracted to be used !")
raise UnhandledArchiveError(
f"{self.filename} needs to be extracted to be used!"
)
else:
# Get the product real name
self.name = self._get_name()
Expand Down
3 changes: 0 additions & 3 deletions eoreader/products/sar/sar_product.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,9 +199,6 @@ def __init__(
# Initialization from the super class
super().__init__(product_path, archive_path, output_path, remove_tmp, **kwargs)

# ???
self.pixel_spacing = self.pixel_size / 2.0

def _map_bands(self) -> None:
"""
Map bands
Expand Down

0 comments on commit 9c395f6

Please sign in to comment.