File tree 1 file changed +8
-1
lines changed
1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -374,7 +374,9 @@ def stats(
374
374
values : xr.DataArray
375
375
values is a 2D xarray DataArray of numeric values (integers or floats).
376
376
The input `values` raster contains the input values used in
377
- calculating the output statistic for each zone.
377
+ calculating the output statistic for each zone. In dask case,
378
+ the chunksizes of `zones` and `values` should be matching. If not,
379
+ `values` will be rechunked to be the same as of `zones`.
378
380
379
381
zone_ids : list of ints, or floats
380
382
List of zones to be included in calculation. If no zone_ids provided,
@@ -519,6 +521,11 @@ def stats(
519
521
)
520
522
else :
521
523
# dask case
524
+
525
+ # make sure chunksizes of `zones` and `values` are matching
526
+ if zones .chunks != values .chunks :
527
+ values .data = values .data .rechunk (zones .chunks )
528
+
522
529
stats_df = _stats_dask_numpy (
523
530
zones .data ,
524
531
values .data ,
You can’t perform that action at this time.
0 commit comments