| 377 | |
| 378 | @pytest.mark.parametrize("keepdims", [False, True]) |
| 379 | def test_average_weights_with_masked_array(keepdims): |
| 380 | mask = np.array([[True, False], [True, True], [False, True]]) |
| 381 | data = np.arange(6).reshape((3, 2)) |
| 382 | a = np.ma.array(data, mask=mask) |
| 383 | d_a = da.ma.masked_array(data=data, mask=mask, chunks=2) |
| 384 | |
| 385 | weights = np.array([0.25, 0.75]) |
| 386 | d_weights = da.from_array(weights, chunks=2) |
| 387 | |
| 388 | da_avg = da.ma.average(d_a, weights=d_weights, axis=1, keepdims=keepdims) |
| 389 | assert_eq(da_avg, np.ma.average(a, weights=weights, axis=1, keepdims=keepdims)) |
| 390 | |
| 391 | |
| 392 | def test_arithmetic_results_in_masked(): |