Skip to content

Commit 3a5d75c

Browse files
authored
Merge pull request #52 from earthdaily/dev
v0.0.11
2 parents 5ed3ca2 + 333b242 commit 3a5d75c

File tree

4 files changed

+16
-9
lines changed

4 files changed

+16
-9
lines changed

CHANGELOG.md

+7-1
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,17 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

77

8+
## [0.0.11] - Unreleased
9+
10+
### Fixed
11+
12+
- `zonal_stats` manages index independently from row.
13+
814
## [0.0.10] - 2024-03-05
915

1016
### Added
1117

12-
- `ed.whittaker` adapted from pywapor github.
18+
- `ed.whittaker` adapted from pywapor github.
1319
- `ed.zonal_stats` using new `geocube` zonal_stats engine.
1420

1521
### Changed

earthdaily/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@
55
# to hide warnings from rioxarray or nano seconds conversion
66
warnings.filterwarnings("ignore")
77

8-
__version__ = "0.0.10"
8+
__version__ = "0.0.11"

earthdaily/earthdatastore/cube_utils/_zonal.py

+7-4
Original file line numberDiff line numberDiff line change
@@ -113,18 +113,21 @@ def zonal_stats(
113113
if method == "geocube":
114114
from geocube.api.core import make_geocube
115115

116-
gdf["feature"] = list(gdf.index)
116+
gdf["tmp_index"] = np.arange(gdf.shape[0])
117117
out_grid = make_geocube(
118118
gdf,
119-
measurements=["feature"],
119+
measurements=["tmp_index"],
120120
like=dataset, # ensure the data are on the same grid
121121
)
122-
cube = dataset.groupby(out_grid.feature)
122+
cube = dataset.groupby(out_grid.tmp_index)
123123
zonal_stats = xr.concat(
124124
[getattr(cube, operation)() for operation in operations], dim="stats"
125125
)
126126
zonal_stats["stats"] = operations
127-
return zonal_stats
127+
zonal_stats["tmp_index"] = list(gdf.index)
128+
129+
return zonal_stats.rename(dict(tmp_index="feature"))
130+
128131
tqdm_bar = tqdm.tqdm(total=gdf.shape[0])
129132

130133
if dataset.rio.crs != gdf.crs:

examples/field_evolution.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,7 @@
4545
# ----------------------------------------------------
4646
pivot_cube = pivot_cube.load()
4747
pivot_cube.ed.plot_rgb(col_wrap=3)
48-
49-
plt.title("Clear cover percent with SCL")
50-
plt.title("Pivot evolution with SCL masks")
48+
plt.title("Pivot evolution masked with native cloudmasks")
5149
plt.show()
5250

5351

0 commit comments

Comments
 (0)