pytroll / pytroll/pyresample

Confusing and missing Deprecation-/FutureWarnings for ImageContainer and pyresample.bilinear

Open
#323 2 comments 0 reactions 1 assignee View on GitHub

@pnuu is already working on this.

Since Dec 23, 2020.

documentation
Dominant language
Python
Stars
385
Forks
102
Avg merge
4d 2h
Merged PRs (30d)
9

Description

Code Sample, a minimal, complete, and verifiable piece of code
import numpy as np
from pyresample import image, geometry
area_def = geometry.AreaDefinition('areaD', 'Europe (3km, HRV, VTC)', 'areaD',
                               {'a': '6378144.0', 'b': '6356759.0',
                                'lat_0': '50.00', 'lat_ts': '50.00',
                                'lon_0': '8.00', 'proj': 'stere'},
                               800, 800,
                               [-1370912.72, -909968.64,
                                1029087.28, 1490031.36])
msg_area = geometry.AreaDefinition('msg_full', 'Full globe MSG image 0 degrees',
                               'msg_full',
                               {'a': '6378169.0', 'b': '6356584.0',
                                'h': '35785831.0', 'lon_0': '0',
                                'proj': 'geos'},
                               3712, 3712,
                               [-5568742.4, -5568742.4,
                                5568742.4, 5568742.4])
data = np.ones((3712, 3712))
msg_con_quick = image.ImageContainerNearest(data, msg_area, radius_of_influence=1000)

Problem description

A few issues are present on the Deprecation warnings:

  • Initialising ImageContainerNearest, ImageContainerQuick, etc. initializes ImageContainer, which triggers a FutureWarning saying that NumpyResamplerBilinear should be used instead. This is a bit confusing for a user that doesn't want to use bilinear resampling, but another of the available algorithms. The FutureWarning should rather be something like The pyresample.image module is deprecated. Please use pyresample.kd_tree or pyresample.bilinear instead., as given in the documentation note: https://pyresample.readthedocs.io/en/latest/grid.html#pyresample-image
  • The note of the previous link is present only in the documentation page for gridded data, but is missing for the swath data here
    https://pyresample.readthedocs.io/en/latest/swath.html#pyresample-image.
  • In several places (here here here) FutureWarnings indicate the usage of NumpyResamplerBilinear. However, that class is deprecated and triggers a warning indicating to use NumpyBilinearResampler. It would be better if the updated class would be indicated in all the warnings.
Expected Output

Updated and correct Deprecation/FutureWarnings

Actual Result, Traceback if applicable
/tcenas/home/andream/code/fire_val_packages/pyresample/pyresample/image.py:62: FutureWarning: Usage of ImageContainer is deprecated, please use NumpyResamplerBilinear class instead
  FutureWarning)
Versions of Python, package at hand and relevant dependencies

Pyresample 1.17.0

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.