docs: replace deprecated ImageContainer example in swath howto - #742
docs: replace deprecated ImageContainer example in swath howto#742Manny7717 wants to merge 2 commits into
Conversation
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
The swath howto's resampling example used image.ImageContainerNearest, which emits a FutureWarning on use. Replace it with the modern KDTreeNearestXarrayResampler (dask/xarray based) and add the module deprecation note to the preprocessing howto, matching grid.rst. Closes pytroll#632
djhoese
left a comment
There was a problem hiding this comment.
It looks like your EWA fix commit is in this PR too. Could you fix it so it is only the documentation changes?
Otherwise, I'm not sure how I feel about these changes. I didn't realize we had the deprecation warnings on the documented ways of doing things until they were already released, but I haven't had time to do anything about it. I'm also not sure telling users to use the "future" classes is the right way to go, but I don't like the other "legacy" Resampler-based classes that much either. The updated examples in this PR also switch from using plain numpy to using dask and xarray which I think is not the right way to go. Users will still want to use numpy.
I think my preference is for this PR to sit for now while the rest of pyresample gets figured out and we can finalize all of this documentation and use this PR as a basis. I'll let other maintainers comment if they have opinions.
What
Fixes #632: the RTD swath howto's resampling example used
image.ImageContainerNearest, which emitsFutureWarning: Usage of ImageContainer is deprecatedwhenever the example runs. Thepyresample.imagemodule is deprecated in favor ofpyresample.kd_tree/pyresample.bilinear(and the newer xarray-based resamplers).Change
docs/source/howtos/swath.rst: replaced theImageContainerNearestexample with the modernKDTreeNearestXarrayResampler(dask/xarray-based API), fixed theImageContanerBilineartypo, and updated the remaining prose reference to the deprecated class.docs/source/howtos/preproc.rst: added the module deprecation note already present ingrid.rst.Verification
python -m doctestunder-W error(warnings-as-errors): passes, no deprecation warnings.result.shapein the doctest asserts the (800, 800) output grid.