-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug report: broadcasted weights with NaN lead to ValueError: assignment destination is read-only #79
Labels
bug
Something isn't working
Comments
This was referenced Mar 14, 2020
Full stack trace
|
Closed via #81 |
I dont understand what that test here checks: @pytest.fixture
def a_3d():
da = xr.DataArray(
np.repeat(np.array([[0, 1, 2], [4, 5, 6], [7, 8, 9]]), 3).reshape(3, 3, 3),
coords=[
xr.cftime_range('2000-01-01', '2000-01-03', freq='D'),
np.linspace(-89.5, 89.5, 3),
np.linspace(-179.5, 179.5, 3),
],
dims=['time', 'lat', 'lon'],
)
return da
@pytest.fixture
def b_3d(a_3d):
return a_3d.copy()
@pytest.mark.parametrize('metric', WEIGHTED_METRICS)
def test_skipna_broadcast_weights_assignment_destination(
a_3d, b_3d, weights_lonlat, metric
):
"""Tests that 'assignment destination is read-only' is not raised
https://github.com/raybellwaves/xskillscore/issues/79"""
a_3d_nan = a_3d.where(a_3d > 0)
b_3d_nan = b_3d.where(b_3d > 0)
res = metric(a_3d_nan, b_3d_nan, ['lat', 'lon'], weights=weights_lonlat, skipna=True)
assert all([not np.isnan(r) for r in res]) I see here that a metric checks to identical arrays agains each other, which would not make too much sense. Tried to refactor this in #159 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The text was updated successfully, but these errors were encountered: