Preserve masked and NaN fills for NumPy bilinear integer data #762
The Read the Docs failure is from four hashlib._Hash annotation warnings in geometry.py and future/resamplers/resampler.py. The same four warnings reproduce on unchanged main 0291a40, and those files and the docs configuration are unchanged by this PR. Existing #760 addresses these annotations.
Locally, all 339 doctest examples pass on both main and the fixed code. Read the Docs treats the warnings as errors, so its build is still failing; the upstream test workflows await approval.
While we wait for @pnuu to have time to review this, what do you think about moving this test out of the test class and using pytest's parametrize instead?
Codecov Report
:white_check_mark: All modified and coverable lines are covered by tests.
:white_check_mark: Project coverage is 93.92%. Comparing base (
4a46786) to head (59c12d2).:warning: Report is 24 commits behind head on main.
<details><summary>Additional details and impacted files</summary>
@@ Coverage Diff @@
## main #762 +/- ##
==========================================
+ Coverage 93.90% 93.92% +0.02%
==========================================
Files 89 89
Lines 13924 13985 +61
==========================================
+ Hits 13075 13136 +61
Misses 849 849
| Flag | Coverage Δ | |
|---|---|---|
| unittests | 93.92% <100.00%> (+0.02%) | :arrow_up: |
Flags with carried forward coverage won't be shown. Click here to find out more.
</details>
:umbrella: View full report in Codecov by Harness.
:loudspeaker: Have feedback on the report? Share it here.
<details><summary> :rocket: New features to boost your workflow: </summary>
</details>
I agree, a very good case for paramatrize.
Thanks for the (surprisingly simple) fix! Back in the day when this was implemented, I think I just considered integer data to be something that shouldn't be resampled with bilinear method, at least for my own usecases, so I hadn't noticed this. It has also been a very long time since I've used this resampler since gradient search works for all my uses and is much more efficient.
Moved it to a module-level pytest test in 6dab7eb, parametrized by dtype, band count and output fill. It uses the shared geometry fixtures, so both supported area/swath classes run, and explicitly reuses the floating run's lookup for the integer input. All 77 bilinear tests pass; Ruff/isort pass. The recorded NCEP replay is unchanged, with all 24 integer configurations completing and all 48 workload records identical to the previous head. Interpolation code is unchanged.
Gentle ping on this, #763 and #764, in case they got buried. All three still merge cleanly into current main, where the code they change is unchanged. Their CI workflows are waiting for a maintainer's approval to run. Happy to make changes, or to close any that aren't wanted.
djhoese
antonsoo
NumpyBilinearResampler.resample()raisesTypeErrorfor integer data withfill_value=None, andValueErrorwithfill_value=np.nan. The temporary corner array tries to store the output fill before interpolation converts the values to floating point.Use the existing dtype-safe fill helper for corner slicing, while preserving the requested fill for the final output. This follows the conversion already used by the base resampler. For example, this now returns the expected interpolated values as a masked array:
Validation includes signed/unsigned integer regressions with one and two bands, masked and NaN output, and lookup reuse. Eight previously crashing packed-int16 NCEP reanalysis configurations finish with the same complete output as the floating input; existing controls remain unchanged. This preserves the current interpolation algorithm.