pytroll / pyresample

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

When resampling goes17 data to geos projection all data are 0 #322

Open TAlonglong opened 3 years ago

TAlonglong commented 3 years ago

If I save an image with resampler=native for goes17 data it works fine If I save an image with resampling to an an area almost the same area all data are 0.

import os
import glob
import s3fs
from satpy import Scene
from pyresample import geometry
from satpy.utils import debug_on
debug_on()

# get ready to download data from s3
fs = s3fs.S3FileSystem(anon=True)

area = 'F'  # F full, M Meso
year = 2020
yday = 342
hour = 15
minute = 0
meso = 'M6'
channels = ['C01', 'C02', 'C03']
file_location = []
for ch in channels:
    file_location.extend(fs.glob('s3://noaa-goes17/ABI-L1b-Rad{}/{:04d}/{:03d}/{:02d}/*{}*{}*s{:04d}{:03d}{:02d}{:02d}*.nc'.format(area,
     year, yday, hour, meso, ch, year, yday, hour, minute)))
print(file_location)

# Area to resample to
area_def_GA = geometry.AreaDefinition('GOES-AREA', 'Text', 'another tmp id',
                                       {'ellps': 'GRS80',
                                        'h': '35786023',
                                        'lon_0': '-137',
                                        'no_defs': 'None',
                                        'proj': 'geos',
                                        'sweep': 'x',
                                        'type': 'crs',
                                        'units': 'm',
                                        'x_0': '0', 'y_0': '0'
                                        },
                                       5424, 5424,
                                       (-5434894.8851, -5434894.8851, 5434894.8851, 5434894.8851))

# Do the actual download if file does not already exists
file_list = []
outdir = './'
for file1 in file_location:
    if os.path.exists(os.path.basename(file1)):
        print("Already there")
        file_list.append(os.path.basename(file1))
        continue
    print(file1)
    fs.get(file1, os.path.join(outdir, os.path.basename(file1)))
    file_list.append(os.path.basename(file1))

global_scene = Scene(reader='abi_l1b', filenames=file_list)

global_scene.load(['true_color'])
print("MIN AREA:", global_scene.min_area())
# To save some sapce and time resample to min_area
local_scene_native = global_scene.resample(global_scene.min_area(), resampler='native')
local_scene_native.save_dataset('true_color', 'true_color-s3-native.png')

# Resample to a geos area almost the same as the native one.
local_scene_area_def = global_scene.resample(area_def_GA)
local_scene_area_def.save_dataset('true_color', 'true_color-s3-area-def.png')

This results in these files

-rw-r--r--  1 polarsat polarsat 112150845 des.   7 21:01 true_color-s3-native.png
-rw-r--r--  1 polarsat polarsat    114290 des.   7 21:02 true_color-s3-area-def.png

Unfortunately these are too big to upload here I think.

This can be to the crossing of the +-180 deg longitude line or something else.

djhoese commented 3 years ago

If you comment out the chunk of code doing the native resampling, does that change the results of the "area_def_GA" nearest neighbor resampling?