Skip to content

Commit f8ff81a

Browse files
committed
test for non-monotonic 2d coordinates
1 parent 80e4c87 commit f8ff81a

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

xarray/test/test_dataarray.py

+6
Original file line numberDiff line numberDiff line change
@@ -1293,6 +1293,12 @@ def test_groupby_bins_multidim(self):
12931293
actual = array.groupby_bins('lat', bins).apply(
12941294
lambda x : x.sum(), shortcut=False)
12951295
self.assertDataArrayIdentical(expected, actual)
1296+
# modify the array coordinates to be non-monotonic after unstacking
1297+
array['lat'].data = np.array([[10., 20.], [20., 10.]])
1298+
expected = DataArray([28, 28], dims='lat', coords={'lat': bin_coords})
1299+
actual = array.groupby_bins('lat', bins).apply(
1300+
lambda x : x.sum(), shortcut=False)
1301+
self.assertDataArrayIdentical(expected, actual)
12961302

12971303
def make_rolling_example_array(self):
12981304
times = pd.date_range('2000-01-01', freq='1D', periods=21)

0 commit comments

Comments
 (0)