Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix
io.Raster.__array__()
for NumPy>=2 (#90)
The new NumPy major version makes some interface changes to the `__array__` protocol: https://numpy.org/devdocs/numpy_2_0_migration_guide.html#adapting-to-changes-in-the-copy-keyword The `__array__` method now must take `dtype=None` and `copy=None` parameters. This change is backwards-compatible with older NumPy versions. `copy=False` should always fail for `Raster`, since converting a `Raster` to an array always involves creating a new array (rather than creating a view of an existing array). I would've preferred to make both parameters keyword-only, but the `dtype` parameter seems to be passed positionally by `np.asarray`, at least with my current NumPy version (v2.1.1), so it seems best to just allow both parameters to be positional.
- Loading branch information