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

update dtype aliases in imageio #51

Closed
rdenham opened this issue Dec 21, 2022 · 4 comments
Closed

update dtype aliases in imageio #51

rdenham opened this issue Dec 21, 2022 · 4 comments

Comments

@rdenham
Copy link

rdenham commented Dec 21, 2022

For numpy 1.24.0, the deprecation for the aliases np.object, np.bool, np.float, np.complex, np.str, and np.int expired (introduces NumPy 1.20).

This means that in recent versions of numpy you'll get errors like:

AttributeError: module 'numpy' has no attribute 'bool'

Perhaps the authors could update the mapping in imageio.py to look like:

dataTypeMapping = [
    (numpy.uint8, gdalconst.GDT_Byte),
    (numpy.bool_, gdalconst.GDT_Byte),
    (numpy.int16, gdalconst.GDT_Int16),
    (numpy.uint16, gdalconst.GDT_UInt16),
    (numpy.int32, gdalconst.GDT_Int32),
    (numpy.uint32, gdalconst.GDT_UInt32),
    (numpy.single, gdalconst.GDT_Float32),
    (numpy.float_, gdalconst.GDT_Float64)
]

So that the original alias numpy.bool becomes numpy.bool_. Same for numpy.float. I think bool and float would also work.

Probably there are other ways too, but this approach seems to be the one with minimal effort and should not change the behaviour of the existing code.

@neilflood
Copy link
Member

Thanks @rdenham
Good point. Yes, we will update with something like that. Stay tuned......

@neilflood
Copy link
Member

@rdenham
There is now a new release of rios-1.4.14, which fixes this problem. Thank you for letting us know.

Just FYI, python-fmask had similar problems, so there is now a new version 0.5.8 of that, too.

@rdenham
Copy link
Author

rdenham commented Dec 21, 2022

thanks. Closed by #52

@rdenham rdenham closed this as completed Dec 21, 2022
@gillins
Copy link
Member

gillins commented Dec 22, 2022

Also a tuiview 1.2.11 with a fix FWIW.

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

3 participants