pytroll / pyresample

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

Help text for the bucket resampler is incorrect #291

Closed simonrp84 closed 4 years ago

simonrp84 commented 4 years ago

Problem description

The text for help(bucket.BucketResampler) is incorrect, as the resampler expects dask arrays for lats + lons but the function used gives numpy arrays:

Expected Output


|  Read data using Satpy.  The resampling can also be done (apart from
 |  fractions) directly from Satpy, but this demonstrates the direct
 |  low-level usage.
 |  
 |  >>> from pyresample.bucket import BucketResampler
 |  >>> from satpy import Scene
 |  >>> from satpy.resample import get_area_def
 |  >>> fname = "hrpt_noaa19_20170519_1214_42635.l1b"
 |  >>> glbl = Scene(filenames=[fname])
 |  >>> glbl.load(['4'])
 |  >>> data = glbl['4']
 |  >>> lons, lats = data.area.get_lonlats()
 |  >>> target_area = get_area_def('euro4')
 |  
 |  Initialize the resampler
 |  
 |  >>> **resampler = BucketResampler(adef, da.from_array(lons), da.from_array(lats))**

Actual Result


|  Read data using Satpy.  The resampling can also be done (apart from
 |  fractions) directly from Satpy, but this demonstrates the direct
 |  low-level usage.
 |  
 |  >>> from pyresample.bucket import BucketResampler
 |  >>> from satpy import Scene
 |  >>> from satpy.resample import get_area_def
 |  >>> fname = "hrpt_noaa19_20170519_1214_42635.l1b"
 |  >>> glbl = Scene(filenames=[fname])
 |  >>> glbl.load(['4'])
 |  >>> data = glbl['4']
 |  >>> lons, lats = data.area.get_lonlats()
 |  >>> target_area = get_area_def('euro4')
 |  
 |  Initialize the resampler
 |  
 |  >>> **resampler = BucketResampler(adef, lons, lats)**
simonrp84 commented 4 years ago

Looking at this on a different computer today and I'm not sure this is actually an issue. I suspect something went wrong when I retrieved the lons + lats as they should already be dask arrays. Could someone else please try just to confirm if it was a local problem on my machine? If so, I'll close the issue.

mraspaud commented 4 years ago

I can confirm that lons and lats are dask arrays in my tests (reading aapp l1b data)

simonrp84 commented 4 years ago

Ok, I'll close this.