Skip to content

docs: replace deprecated ImageContainer example in swath howto - #742

Open
Manny7717 wants to merge 2 commits into
pytroll:mainfrom
Manny7717:fix/deprecated-imagecontainer-docs
Open

docs: replace deprecated ImageContainer example in swath howto#742
Manny7717 wants to merge 2 commits into
pytroll:mainfrom
Manny7717:fix/deprecated-imagecontainer-docs

Conversation

@Manny7717

Copy link
Copy Markdown

What

Fixes #632: the RTD swath howto's resampling example used image.ImageContainerNearest, which emits FutureWarning: Usage of ImageContainer is deprecated whenever the example runs. The pyresample.image module is deprecated in favor of pyresample.kd_tree / pyresample.bilinear (and the newer xarray-based resamplers).

Change

  • docs/source/howtos/swath.rst: replaced the ImageContainerNearest example with the modern KDTreeNearestXarrayResampler (dask/xarray-based API), fixed the ImageContanerBilinear typo, and updated the remaining prose reference to the deprecated class.
  • docs/source/howtos/preproc.rst: added the module deprecation note already present in grid.rst.

Verification

  • The new doctest block was extracted and run with python -m doctest under -W error (warnings-as-errors): passes, no deprecation warnings.
  • result.shape in the doctest asserts the (800, 800) output grid.

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 djhoese self-assigned this Sep 12, 2026

@djhoese djhoese left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Documentation - ImageContainer is deprecated and should not appear as the default in RTD pages

2 participants