-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
New .broadcast_like() incorrect #3129
Comments
In https://github.com/DavidMertz/xarray/tree/feature/2885-broadcast_like-merge-branch I have created a temporary method We actually get the failure in the call to ___________________________________________ TestDataArray.test_broadcast_like ____________________________________________
self = <xarray.tests.test_dataarray.TestDataArray object at 0x7f2287e3a828>
def test_broadcast_like(self):
arr1 = DataArray(np.ones((2, 3)), dims=['x', 'y'],
coords={'x': ['a', 'b'], 'y': ['a', 'b', 'c']})
arr2 = DataArray(np.ones((3, 2)), dims=['x', 'y'],
coords={'x': ['a', 'b', 'c'], 'y': ['a', 'b']})
orig1, orig2 = broadcast(arr1, arr2)
> new1 = arr2.broadcast_like(arr1)
xarray/tests/test_dataarray.py:1276:
[...]
E ValueError: conflicting sizes for dimension 'y': length 2 on the data but length 3 on coordinate 'y' |
With the following method instead, the identical test succeeds (modulo using the temporary method for tests, of course): def broadcast_like_naive(self,
other: Union['DataArray', Dataset],
exclude=None) -> 'DataArray':
return broadcast(other, self)[1] |
Unfortunately, more robust tests show there is some logic problem in the @dcherian solution to #2885. I was merging my work in #3127 with his more-principled refactoring in #3086, and my tests showed an error in the refactoring.
The text was updated successfully, but these errors were encountered: