pytroll / pyresample

Geospatial image resampling in Python
http://pyresample.readthedocs.org
GNU Lesser General Public License v3.0
352 stars 94 forks source link

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

Open adybbroe opened 11 hours ago

adybbroe commented 11 hours ago

Code Sample, a minimal, complete, and verifiable piece of code

The following code snippet is taken directly from the RTD pages:

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])

data = np.fromfunction(lambda y, x: y*x, (50, 10))
lons = np.fromfunction(lambda y, x: 3 + x, (50, 10))
lats = np.fromfunction(lambda y, x: 75 - y, (50, 10))
swath_def = geometry.SwathDefinition(lons=lons, lats=lats)
swath_con = image.ImageContainerNearest(data, swath_def, radius_of_influence=5000)
area_con = swath_con.resample(area_def)
result = area_con.image_data

Problem description

The above code produce a deprecation warning!

.../pyresample/image.py:252: FutureWarning: Usage of ImageContainer is deprecated, please use NumpyResamplerBilinear class instead

In https://pyresample.readthedocs.io/en/latest/howtos/swath.html the first example of resampling "swath" data mention a deprecated class:

The ImageContainerNearest and ImageContanerBilinear classes can be used for resampling of swaths as well as grids. Below is an example using nearest neighbour resampling.

Expected Output

Actual Result, Traceback if applicable

Versions of Python, package at hand and relevant dependencies

djhoese commented 3 hours ago

Yeah I'd love to get the resampler classes/objects finalized and suggest their usage in the documentation.