Skip to content
forked from pydata/xarray

Commit

Permalink
test for count
Browse files Browse the repository at this point in the history
  • Loading branch information
dcherian committed Nov 8, 2019
1 parent dbf5d00 commit c1977c8
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions xarray/tests/test_variable.py
Original file line number Diff line number Diff line change
Expand Up @@ -1810,6 +1810,18 @@ def test_coarsen_2d(self):
expected[1, 1] *= 12 / 11
assert_allclose(actual, expected)

v = self.cls(("x", "y"), np.arange(4 * 4, dtype=np.float32).reshape(4, 4))
actual = v.coarsen(dict(x=2, y=2), func="count", boundary="exact")
expected = self.cls(("x", "y"), 4 * np.ones((2, 2)))
assert_equal(actual, expected)

v[0, 0] = np.nan
v[-1, -1] = np.nan
expected[0, 0] = 3
expected[-1, -1] = 3
actual = v.coarsen(dict(x=2, y=2), func="count", boundary="exact")
assert_equal(actual, expected)


@requires_dask
class TestVariableWithDask(VariableSubclassobjects):
Expand Down

0 comments on commit c1977c8

Please sign in to comment.