Skip to content

Commit

Permalink
FIX: Get better window name (if available) when writing bands on disk…
Browse files Browse the repository at this point in the history
… (in tmp folder) + update sertit's version to benefit to the vector's name
  • Loading branch information
remi-braun committed Aug 9, 2024
1 parent 06d3b67 commit cfc713e
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 7 deletions.
4 changes: 4 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Release History

## 0.21.3 (2024-mm-dd)

- FIX: Get better window name (if available) when writing bands on disk (in tmp folder)

## 0.21.2 (2024-07-30)

- ENH: `to_str` and `to_band`: add a `as_list` argument defaulting to `True`. When set as False, return a str from `to_str` and a band from `to_band` ([#138](https://github.com/sertit/eoreader/issues/138)). Thanks @jsetty!
Expand Down
1 change: 0 additions & 1 deletion environment-doc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,4 @@ dependencies: # everything under this, installed by conda
- python=3.9
- pip
- pip: # everything under this, installed by pip
- --extra-index-url ${WINDOWS_WHEELS} # Use windows wheels on Windows
- -r ./requirements-doc.txt
15 changes: 11 additions & 4 deletions eoreader/products/optical/optical_product.py
Original file line number Diff line number Diff line change
Expand Up @@ -656,11 +656,18 @@ def _get_clean_band_path(
# Radiometric processing
rad_proc = "" if kwargs.get(TO_REFLECTANCE, True) else "_as_is"

# Window
# Window name
window = kwargs.get("window")
win_suffix = (
f"win{files.hash_file_content(str(window))}_" if window is not None else ""
)

win_suffix = ""
if window is not None:
if path.is_path(window):
win_suffix = path.get_filename(window)
elif isinstance(window, gpd.GeoDataFrame):
win_suffix = window.attrs.get("name")

if not win_suffix:
win_suffix = f"win{files.hash_file_content(str(window))}_"

return self._get_band_folder(writable).joinpath(
f"{self.condensed_name}_{band.name}_{res_str.replace('.', '-')}_{win_suffix}{cleaning_method.value}{rad_proc}.tif",
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ geopandas>=0.11.0
spyndex>=0.3.0

# SERTIT libs
sertit[full]>=1.39.1
sertit[full]>=1.41.0

# Optimizations
dask[complete]>=2021.10.0
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"xarray>=0.18.0",
"rioxarray>=0.10.0",
"geopandas>=0.11.0",
"sertit[full]>=1.39.1",
"sertit[full]>=1.41.0",
"spyndex>=0.3.0",
"pyresample",
"zarr",
Expand Down

0 comments on commit cfc713e

Please sign in to comment.