Skip to content

Commit

Permalink
Add product to reduction statistics (for raster.Place) (#62)
Browse files Browse the repository at this point in the history
  • Loading branch information
wietzesuijker committed Aug 25, 2020
1 parent 2435d1a commit 0f5a136
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Changelog of dask-geomodeling

- Check for matching time resolutions in raster.Clip.

- Added 'product' to raster.reduction STATISTICS.

2.2.10 (2020-07-29)
-------------------
Expand Down
1 change: 1 addition & 0 deletions dask_geomodeling/raster/reduction.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"std": np.nanstd,
"var": np.nanvar,
"median": np.nanmedian,
"product": np.nanprod,
# "p<number>" uses np.nanpercentile
}

Expand Down
4 changes: 3 additions & 1 deletion dask_geomodeling/tests/test_raster_reduction.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ def stack_nodata_only():
("std", [[[np.sqrt(2 / 3), np.sqrt(2 / 3), np.sqrt(2 / 3)], [0, 0, 255]]]),
("var", [[[2 / 3, 2 / 3, 2 / 3], [0, 0, 255]]]),
("median", [[[2, 2, 2], [4, 5, 255]]]),
("product", [[[6, 6, 6], [16, 25, 255]]]),
("p99", [[[2.98, 2.98, 2.98], [4, 5, 255]]]),
],
)
Expand All @@ -61,7 +62,7 @@ def test_reduce(statistic, expected, dtype, stack):


@pytest.mark.parametrize(
"statistic,expected_value",
"statistic, expected_value",
[
("first", 255),
("last", 255),
Expand All @@ -75,6 +76,7 @@ def test_reduce(statistic, expected, dtype, stack):
("std", 255),
("var", 255),
("median", 255),
("product", 255),
("p99", 255),
],
)
Expand Down

0 comments on commit 0f5a136

Please sign in to comment.