Make astype
set new nodata
by default, and data.setter
check for unmasked nodata
#472
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
That little change on
astype
ended up being a lot bigger than I anticipated!I realized that:
nodata
value inRaster
without notice #469,None
, see Arithmetic overloading replaces existing nodate withNone
for certain operation withint
data types #471,masked
option forRaster
which is deprecated, see Removemasked
option inRaster.__init__
as it is no longer supported? #470.What's changed
data.setter
, we now check that there isn't any nodata value that is unmasked, otherwise we mask them (in case it is user input and not numerics) BUT RAISE A WARNING and recommend the user to either: Mask his array when creating the raster (if that was what he was doing), or Change the dtype to not have numerical operation derive the nodata value (if that was what he was doing). This mostly happens withint
, and should be very easy to silence using afloat
array with properly masked values (or NaNs).nodata
when usingastype
by default. If the nodata is already in the array, it will be detected byset_nodata()
.Surprisingly, those two "big" changes didn't create so many new errors in tests, and actually rather allowed to identify a couple bugs! 😄
The rest is adding new tests, silencing or catching warnings, and updating the warning for the nodata setter (that were still not so clear when I re-read them).
Resolves #471
Resolves #470
Resolves #469
Resolves #394