pytroll / pytroll/pyresample

When resampling goes17 data to geos projection all data are 0

Open
#322 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Python
Stars
385
Forks
102
Avg merge
4d 2h
Merged PRs (30d)
9

Description

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.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the provided Python reproducer, especially the AreaDefinition passed to global_scene.resample and the comparison with global_scene.min_area() using the native resampler. Investigate whether the geos projection or longitude wrapping produces an invalid or empty result for the GOES-17 data. Done means the area-defined output contains the expected image data rather than all zeros.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.