Skip to content

Commit

Permalink
- ENH: Load works with string bands (prod.load('BLUE'))
Browse files Browse the repository at this point in the history
- FIX: Fixing missing `_remove_tmp_process` for products needing extraction
- FIX: Remove multi converting for Sentinel-3
  • Loading branch information
remi-braun committed Sep 10, 2021
1 parent 610cfd4 commit eefbf0c
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 10 deletions.
6 changes: 6 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

## X.Y.Z (YYYY-MM-DD)

## 0.6.3 (2021-09-10)

- ENH: Load works with string bands (`prod.load('BLUE')`)
- FIX: Fixing missing `_remove_tmp_process` for products needing extraction
- FIX: Remove multi converting for Sentinel-3

## 0.6.2 (2021-09-10)

- FIX: Better handling of archives for products that needs extraction
Expand Down
2 changes: 1 addition & 1 deletion eoreader/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"""
**EOReader** library
"""
__version__ = "0.6.2"
__version__ = "0.6.3"
__title__ = "eoreader"
__description__ = (
"Remote-sensing opensource python library reading optical and SAR sensors, "
Expand Down
10 changes: 3 additions & 7 deletions eoreader/products/optical/s3_product.py
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,6 @@ def get_band_paths(self, band_list: list, resolution: float = None) -> dict:
dict: Dictionary containing the path of each queried band
"""
band_paths = {}
use_snap = False
for band in band_list:
# Get clean band path
clean_band = self._get_clean_band_path(band, resolution=resolution)
Expand All @@ -417,12 +416,9 @@ def get_band_paths(self, band_list: list, resolution: float = None) -> dict:
f"{self.condensed_name}_{band_name}.tif",
)
except (FileNotFoundError, TypeError):
use_snap = True

# If not existing (file or output), convert them
if use_snap:
all_band_paths = self._preprocess_s3(resolution)
band_paths = {band: all_band_paths[band] for band in band_list}
# If not existing (file or output), convert them
all_band_paths = self._preprocess_s3(resolution)
band_paths = {band: all_band_paths[band] for band in band_list}

return band_paths

Expand Down
5 changes: 3 additions & 2 deletions eoreader/products/product.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ def __init__(
# The output will be given later
self._tmp_output = None
self._output = None
self._remove_tmp_process = remove_tmp

# Store metadata
self._metadata = None
Expand Down Expand Up @@ -215,7 +216,6 @@ def __init__(
# Temporary files path (private)
self._tmp_process = self._output.joinpath(f"tmp_{self.condensed_name}")
os.makedirs(self._tmp_process, exist_ok=True)
self._remove_tmp_process = remove_tmp

def __del__(self):
"""Cleaning up _tmp directory"""
Expand Down Expand Up @@ -753,7 +753,8 @@ def load(
if not isinstance(bands, list):
bands = [bands]

band_dict = self._load(bands, resolution, size)
# Load bands (and convert the bands to be loaded to correct format)
band_dict = self._load(to_band(bands), resolution, size)

# Manage the case of arrays of different size -> collocate arrays if needed
band_dict = self._collocate_bands(band_dict)
Expand Down

0 comments on commit eefbf0c

Please sign in to comment.