Repository navigation
BUG: Use the default nodata value when clipping integer data without nodata - #969
Open
VolodymyrLinuxovich wants to merge 1 commit into
Open
VolodymyrLinuxovich wants to merge 1 commit into
VolodymyrLinuxovich wants to merge 1 commit into
Conversation
…nodata Masked pixels were NaN cast to the integer dtype, which raised a RuntimeWarning and left arbitrary values. They now get the default nodata value for the dtype, and it is written to the output. Closes vylor#717
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #969 +/- ##
==========================================
+ Coverage 95.90% 96.64% +0.73%
==========================================
Files 12 18 +6
Lines 1735 2177 +442
==========================================
+ Hits 1664 2104 +440
- Misses 71 73 +2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
rioxarray.clip#717docs/history.rstfor all changes anddocs/rioxarray.rstfor new APIClipping integer data with no nodata value masked pixels with NaN. The cast back to the integer dtype then raised a RuntimeWarning and left arbitrary values in those pixels. On my machine they came out as 0, so they looked like real data. This is also what #694 reports for uint8.
The in memory clip now fills masked pixels with the default nodata value for the dtype. It is the same table that reproject already uses. The value is written to the output so the masked pixels can be told apart. Float data and data with a nodata value are unchanged. The from_disk path is unchanged too.
The new test covers uint8, int16 and int32 and fails on master.