Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

piecewise_linear_stretch didn't work properly on GK-2A AMI data #1779

Closed
yukaribbba opened this issue Jul 29, 2021 · 2 comments
Closed

piecewise_linear_stretch didn't work properly on GK-2A AMI data #1779

yukaribbba opened this issue Jul 29, 2021 · 2 comments

Comments

@yukaribbba
Copy link
Contributor

Describe the bug
image
That's the result. But it's no problem for S3 OLCI. And nothing wrong with CIRA stretch.

To Reproduce
enhancement YAML:

  true_color_crefl2:
    name: true_color_crefl2
    standard_name: true_color_crefl2
    operations:
      - name: reflectance_range
        method: !!python/name:satpy.enhancements.stretch
        kwargs: {stretch: 'crude', min_stretch: 0., max_stretch: 100.}
      - name: linear interpolation
        method: !!python/name:satpy.enhancements.piecewise_linear_stretch
        kwargs:
        # Polar2Grid's "Preferred" scaling
         xp: [0., 25., 55., 100., 255.]
         fp: [0., 90., 140., 175., 255.]
         reference_scale_factor: 255

composite YAML:

  true_color2:
    compositor: !!python/name:satpy.composites.GenericCompositor
    prerequisites:
      - name: VI006
        modifiers: [sunz_corrected, rayleigh_corrected]
      - name: green
      - name: VI004
        modifiers: [sunz_corrected, rayleigh_corrected]
    standard_name: true_color_crefl2 
from satpy import Scene, find_files_and_readers
from satpy.dataset import DataQuery
import satpy

satpy.config.set(config_path=['D:\\satpy_config'])
files = find_files_and_readers(base_dir="C:\\Users\\45107\\Downloads\\Sat\\GK2A",
                               reader='ami_l1b')
scn = Scene(filenames=files)
composite = 'true_color2'
scn.load([composite])
new_scn = scn.resample(scn.max_area(), resampler='native')
new_scn.save_dataset(composite, filename='{name}_{start_time:%Y%m%d_%H%M%S}.tif', writer='geotiff', base_dir="C:\\Users\\45107\\Downloads\\Sat\\GK2A", num_threads=8, compress=None)

Environment Info:

  • OS: Windows 10
  • Satpy Version: 0.29
  • PyResample Version:
  • Readers and writers dependencies (when relevant): [run from satpy.utils import check_satpy; check_satpy()]
@djhoese
Copy link
Member

djhoese commented Jul 29, 2021

The name of your composite is true_color2, the standard_name is true_color_crefl2. Your enhancement is configured to only be applied to something with a name of true_color_crefl2 (doesn't match your composite) and a standard_name of true_color_crefl2. Your enhancement is not being applied when you think it is. If you turn on debug log message you should see some output about what enhancements are being applied.

The solution is to either change your enhancement where it says name: true_color_crefl2 to name: true_color2 or you could probably just remove that name: true_color_crefl2 line and it should still work.

@yukaribbba
Copy link
Contributor Author

@djhoese OK it's solved. I got stuck here because I've benn confused about thoses 'names' in the enhancement YAML. Now I'm getting clear. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants