pytroll/pyresample

Image produced by `gradient_search` has slightly different extent to `native`

simonrp84 opened this issue · 1 comments

When I crop a GOES-16 image and then resample using gradient_search, the resulting image appears to be missing pixels on the bottom and right-hand side compared to the native resampler.
Gradient:
test_gradient_search
Native:
test_native

You probably have to load the two images in separate tabs and then quickly flick between them to notice the difference.

Here's the code I'm using:

from satpy import Scene, resample
from satpy.readers import FSFile

the_files = fsspec.open_files("filecache::s3://noaa-goes16/ABI-L1b-RadF/2022/185/17/*_s20221851700*", s3={'anon': True})
fs_files = [FSFile(open_file) for open_file in the_files]
scn = Scene(filenames=fs_files, reader='abi_l1b')

c_lat = 14.4747
c_lon = -90.8806
dell = 1.0

bbox = (c_lon - dell, c_lat - dell, c_lon + dell, c_lat + dell)

scn.load(['true_color_nocorr'])

scn2 = scn.crop(ll_bbox=bbox)
scn3 = scn2.resample(scn2.finest_area(), resampler='native')
scn3.save_dataset('true_color_nocorr', filename='./test_native.png')
print(scn3['true_color_nocorr'].attrs['area'])

scn = Scene(filenames=fs_files, reader='abi_l1b')
scn.load(['true_color_nocorr'])

scn2 = scn.crop(ll_bbox=bbox)
scn3 = scn2.resample(scn2.finest_area(), resampler='gradient_search')
scn3.save_dataset('true_color_nocorr', filename='./test_gradient_search.png')
print(scn3['true_color_nocorr'].attrs['area'])

The printed area definitions are identical, it's just the output images that vary.

Looks like an off-by-one type of error (a > that should be an >= or something)