pytroll / satpy

Python package for earth-observing satellite data processing
http://satpy.readthedocs.org/en/latest/
GNU General Public License v3.0
1.06k stars 292 forks source link

Resampling of long passes of metop l1b eps data gives strange results #1002

Closed TAlonglong closed 4 years ago

TAlonglong commented 4 years ago

When resampling a long pass of global metop l1b eps data with compute_optimal_bb_area some strange results appear.

The image below is a small capture of the resampled data showing the strange results.

Screenshot from 2019-12-06 10-03-28

https://drive.google.com/open?id=1jNxMLVe0bXXEfUJ0QBcq4_8HdLNEovCb

When eg. displayed in DIANA, and DIANA itself resample the image to eg. a stere projection results like this shows up ( this time over the Antarctic)

metop-c-global3 https://drive.google.com/open?id=1pSN-o5ZV-1Z0g7pqVJMmUFgBVSyl_nEM

with a close up:

metop-c-global4 https://drive.google.com/open?id=1_vVzLUwV2dt7FoxRAcZVJ-F59kvhSLwD

It looks like the feature starts at the south pole


from satpy import Scene, find_files_and_readers
from pyresample import geometry

from satpy.utils import debug_on
debug_on()

files = find_files_and_readers(start_time=datetime.datetime(2019, 12, 6, 7, 7, 3),
                               end_time=datetime.datetime(2019, 12, 6, 7, 22, 3),
                               base_dir='/data/pytroll/testdata',
                               reader='avhrr_l1b_eps',
                               filter_parameters={'platform_short_name': 'M03'})
ql = Scene(filenames=files)

ql.load(['overview', 'latitude', 'longitude'])

sd = geometry.SwathDefinition(ql['longitude'], ql['latitude'], nprocs=4)
bb_area = sd.compute_optimal_bb_area()
local_scene = ql.resample(bb_area, nprocs=16, radius_of_influence=5000)

local_scene.save_dataset('overview', 'test.png')

The code uses the simple image writer to save to a png. But the images above is produced with the mitiff writer. The feature exists using both writers.

Environment Info:

mraspaud commented 4 years ago

Thanks for reporting this. You mention here that the problem appears with long passes, so do I understand correctly that short passes don't exhibit this problem ?

TAlonglong commented 4 years ago

Oh, I forgot to test that. Just a few minutes.

TAlonglong commented 4 years ago

Testing with 3 segments of data gives good results. These are the segments where the feature appear. So the original data must be fine.

[DEBUG: 2019-12-06 10:55:45 : satpy.readers.eps_l1b] Reading /data/pytroll/testdata/AVHR_xxx_1B_M03_20191206071603Z_20191206071903Z_N_O_20191206082758Z
[DEBUG: 2019-12-06 10:55:45 : satpy.readers.eps_l1b] Reading /data/pytroll/testdata/AVHR_xxx_1B_M03_20191206071903Z_20191206072203Z_N_O_20191206082825Z
[DEBUG: 2019-12-06 10:55:46 : satpy.readers.eps_l1b] Reading /data/pytroll/testdata/AVHR_xxx_1B_M03_20191206072203Z_20191206072503Z_N_O_20191206082851Z

Testing now with one more segment closer to the South Pole

TAlonglong commented 4 years ago

4 segments still ok.

[DEBUG: 2019-12-06 11:00:50 : satpy.readers.eps_l1b] Reading /data/pytroll/testdata/AVHR_xxx_1B_M03_20191206071303Z_20191206071603Z_N_O_20191206082728Z
[DEBUG: 2019-12-06 11:00:51 : satpy.readers.eps_l1b] Reading /data/pytroll/testdata/AVHR_xxx_1B_M03_20191206071603Z_20191206071903Z_N_O_20191206082758Z
[DEBUG: 2019-12-06 11:00:51 : satpy.readers.eps_l1b] Reading /data/pytroll/testdata/AVHR_xxx_1B_M03_20191206071903Z_20191206072203Z_N_O_20191206082825Z
[DEBUG: 2019-12-06 11:00:52 : satpy.readers.eps_l1b] Reading /data/pytroll/testdata/AVHR_xxx_1B_M03_20191206072203Z_20191206072503Z_N_O_20191206082851Z
TAlonglong commented 4 years ago

With 5 segments the feature reappeared

[DEBUG: 2019-12-06 11:04:30 : satpy.readers.eps_l1b] Reading /data/pytroll/testdata/AVHR_xxx_1B_M03_20191206071003Z_20191206071303Z_N_O_20191206082627Z
[DEBUG: 2019-12-06 11:04:30 : satpy.readers.eps_l1b] Reading /data/pytroll/testdata/AVHR_xxx_1B_M03_20191206071303Z_20191206071603Z_N_O_20191206082728Z
[DEBUG: 2019-12-06 11:04:31 : satpy.readers.eps_l1b] Reading /data/pytroll/testdata/AVHR_xxx_1B_M03_20191206071603Z_20191206071903Z_N_O_20191206082758Z
[DEBUG: 2019-12-06 11:04:31 : satpy.readers.eps_l1b] Reading /data/pytroll/testdata/AVHR_xxx_1B_M03_20191206071903Z_20191206072203Z_N_O_20191206082825Z
[DEBUG: 2019-12-06 11:04:32 : satpy.readers.eps_l1b] Reading /data/pytroll/testdata/AVHR_xxx_1B_M03_20191206072203Z_20191206072503Z_N_O_20191206082851Z
mraspaud commented 4 years ago

Thank you for checking this. I got the data locally, I will have a look a it.

mraspaud commented 4 years ago

Reproduced. I'll look into it.

mraspaud commented 4 years ago

I've looked a bit, and I'm pretty sure this isn't a satpy/pyresample bug, but something in proj. I got some strange behaviour to show up, and reported the issue to proj, let's see what they say: https://github.com/OSGeo/PROJ/issues/1922

mraspaud commented 4 years ago

@TAlonglong We got an answer in the issue above, and this can be fixed by setting the ellipsoid of omerc_bb to sphere. I'll change the default in satpy. (the calls you perform in your script are equivalent to using the omerc_bb area to resample to)

mraspaud commented 4 years ago

This should be solved with pytroll/pyresample#252