Repository navigation
Fix user fill value not being used in EWA - #741
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #741 +/- ##
==========================================
+ Coverage 93.87% 93.90% +0.03%
==========================================
Files 89 89
Lines 13888 13924 +36
==========================================
+ Hits 13037 13075 +38
+ Misses 851 849 -2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
djhoese
left a comment
There was a problem hiding this comment.
Thanks for fixing this. The fix looks good. Could you please combine the two new tests outside of the unittest TestCase class and use pytest's parametrize? This will also require changing the assert method calls to normal assert X conditions.
fornav() computed a fill value from the input data (np.nan for floats, -999 for integers, or the user-supplied fill) but always passed np.nan as the input/output fill to the C resampler. Integer swath data therefore failed (NaN cannot be written into integer output), and a user-specified fill was ignored for float data. Pass the resolved fill value through. Closes pytroll#689
71ee31e to
4a46786
Compare
|
Thanks for this. I'm sorry it took so long to merge such an obvious change. Other EWA resampling PRs that were merged made some conflicts. Claude also pointed out to me that the integer fill value was out of the range for the integer dtype (int8, default was -999.0). I've tacked on a fix for that to this PR. I rebased your branch and force pushed it. This should be good to merge once CI finishes. Thanks again. |
What
fornav()resolves a fill value from the input data (NaN for floats, -999 for integers, or the caller'sfillargument) but then passed hardcodednp.nanas both the input and output fill to the C resampler (_fornav.fornav_wrapper). Two consequences (reported in #689):fill(e.g.fill=0) was ignored for float data: uncovered pixels still got NaN.Change
Pass the resolved
fillvalue as both input and output fill tofornav_wrapper. Default behavior is unchanged (float data withfill=Nonestill gets NaN, matching the documented default); onlyfill-specified and integer paths change. The dask EWA resampler already forwarded its fill value and is unaffected.Tests
test_fornav_integer_swath_with_fill: int8 swath +fill=0resamples without error; output contains only data and fill values.test_fornav_fill_value_used_in_output: float32 swath +fill=0— uncovered pixels are 0, no NaN anywhere.pytest test_ewa_fornav.py test_dask_ewa.py→ 89 passed, 20 skipped (pre-existing skips). ruff clean.