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
Describe the bug
There is no check in the data setter that the data is a masked array, so arguably weird situations can happen as a consequence.
To Reproduce
>>>importgeoutilsasgu>>>importnumpyasnp>>>importrasterioasrio>>>data=np.ones((5, 5), dtype="int32")
>>>transform=rio.transform.from_origin(0, 5, 1, 1)
>>>img=gu.Raster.from_array(data, transform=transform, crs=4326)
>>># Now, the data has been converted to a masked_array>>>img.data.maskFalse>>>img.data=data.reshape(img.data.shape)
>>># If the data is assigned to again, it's not necessarily a masked_array>>>img.data.maskTraceback (mostrecentcalllast):
File"<stdin>", line1, in<module>AttributeError: 'numpy.ndarray'objecthasnoattribute'mask'
Expected behavior
The data setter should make sure that the data type is consistent. Right now, any class that inherits from np.ndarray is allowed!
The text was updated successfully, but these errors were encountered:
Describe the bug
There is no check in the data setter that the data is a masked array, so arguably weird situations can happen as a consequence.
To Reproduce
Expected behavior
The data setter should make sure that the data type is consistent. Right now, any class that inherits from
np.ndarray
is allowed!The text was updated successfully, but these errors were encountered: