Skip to content
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

Asymmetry of arithmetic operations when broadcasting between 2D and 3D arrays #304

Closed
rhugonnet opened this issue Sep 8, 2022 · 0 comments · Fixed by #302
Closed

Asymmetry of arithmetic operations when broadcasting between 2D and 3D arrays #304

rhugonnet opened this issue Sep 8, 2022 · 0 comments · Fixed by #302

Comments

@rhugonnet
Copy link
Contributor

This actually works now with #302 (the numpy interface is not taking over anymore):

test = np.ones(r.shape) + r
type(test)
Out[15]: geoutils.georaster.raster.Raster
test = r + np.ones(r.data.shape)
type(test)
Out[17]: geoutils.georaster.raster.Raster

However, as you can notice, I have to change the shape to .data.shape on one side, and not another, otherwise:

ValueError: Both rasters must have the same shape.

I'll leave this issue to be closed by #302 and open a new one on this.

Originally posted by @rhugonnet in #256 (comment)

@rhugonnet rhugonnet changed the title Non-reflectivity of arithmetic operations when broadcasting between 2D and 3D arrays Non-symmetry of arithmetic operations when broadcasting between 2D and 3D arrays Sep 8, 2022
@rhugonnet rhugonnet changed the title Non-symmetry of arithmetic operations when broadcasting between 2D and 3D arrays Asymmetry of arithmetic operations when broadcasting between 2D and 3D arrays Sep 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant