Skip to content

Commit

Permalink
apply nomalization to rgb data along the time dim
Browse files Browse the repository at this point in the history
  • Loading branch information
zxdawn committed Dec 13, 2024
1 parent 1c41593 commit bac6509
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions wxee/xarray.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ def normalize(self, stretch: float = 1.0) -> xr.DataArray:
if stretch < 0 or stretch > 1:
raise ValueError("Stretch value must be in the range [0.0, 1.0].")

min_val = da.quantile(1 - stretch)
max_val = da.quantile(stretch)
min_val = da.quantile(1 - stretch, dim=["x", "y", "variable"])
max_val = da.quantile(stretch, dim=["x", "y", "variable"])

return ((da - min_val) / (max_val - min_val)).clip(0, 1)

0 comments on commit bac6509

Please sign in to comment.