You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Boolean comparisons and filtering of raster rows using eg. RasterRow fail (probably) due to use of deprecated numpy.bool type in buffer.py.
An example error message:
/usr/lib/grass82/etc/python/grass/pygrass/raster/buffer.py:51: FutureWarning: Inthefuture`np.bool`willbedefinedasthecorrespondingNumPyscalar.
ifout_arr.dtype==np.bool:
Traceback (mostrecentcalllast):
File"/tmp/grassbug/test_script.py", line19, in<module>print(row>0)
^^^^^^^File"/usr/lib/grass82/etc/python/grass/pygrass/raster/buffer.py", line51, in__array_wrap__ifout_arr.dtype==np.bool:
^^^^^^^File"/usr/lib/python3/dist-packages/numpy/__init__.py", line305, in__getattr__raiseAttributeError(__former_attrs__[attr])
AttributeError: module'numpy'hasnoattribute'bool'.
`np.bool` was a deprecated alias for the builtin `bool`. To avoid this error in existing code, use `bool` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.bool_` here.
ThealiaseswasoriginallydeprecatedinNumPy1.20; formoredetailsandguidanceseetheoriginalreleasenoteat:
https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations. Did you mean: 'bool_'?
Describe the bug
Boolean comparisons and filtering of raster rows using eg.
RasterRow
fail (probably) due to use of deprecated numpy.bool type inbuffer.py
.An example error message:
To Reproduce
Test with eg.
grass --tmp-location XY --exec test_script.py
Expected behavior
print(row > 0)
and all other boolean operations should work, e.g in this case return the same asprint(arr > 0)
.System description (please complete the following information):
The text was updated successfully, but these errors were encountered: