Nothing Special   »   [go: up one dir, main page]

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

Numpy scalars with numpy >=2.0 #3236

Open
groutr opened this issue Nov 6, 2024 · 0 comments
Open

Numpy scalars with numpy >=2.0 #3236

groutr opened this issue Nov 6, 2024 · 0 comments

Comments

@groutr
Copy link
Contributor
groutr commented Nov 6, 2024

When using rasterio with numpy >=2.0, some of the code in rasterio results in numpy scalar objects instead of Python scalars. I'm not sure what the path forward would be.

An example of where this would happen is https://github.com/rasterio/rasterio/blob/main/rasterio/windows.py#L332-L333

Example

import numpy as np  # Must be using numpy 2.x

k = np.arange(10)
min(k)   # This results in np.int64(0)
k.min()   # This also results in np.int64(0)

k.min().item()  # This results in 0 (a python int)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant