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

Creation of composites using sunz_corrected modifier fails with VIIRS SDR data #577

Closed
pnuu opened this issue Jan 14, 2019 · 2 comments
Closed

Comments

@pnuu
Copy link
Member

pnuu commented Jan 14, 2019

Describe the bug
Creating any of the built-in composites using sunz_corrected modifier fails for VIIRS SDR data with the traceback shown below.

To Reproduce

from satpy import Scene
import glob
fnames = glob.glob('*b37299*')
glbl = Scene(reader='viirs_sdr', filenames=fnames) 
glbl.load(['natural_color'])  # Also 'natural_color' and 'natural_color_lowres' fail
lcl = glbl.resample('euro4', resampler='nearest')

Crashes when resampling is run.

Expected behavior
A clear and concise description of what you expected to happen.

Actual results

ValueError                                Traceback (most recent call last)
<ipython-input-7-4113a12cb6fe> in <module>
----> 1 lcl = glbl.resample('EPSG_3035_4km', resampler='nearest')

~/Software/pytroll/packages/satpy/satpy/scene.py in resample(self, destination, datasets, generate, unload, resampler, **resample_kwargs)
    996         # multiple resolutions, etc.)
    997         if generate:
--> 998             keepables = new_scn.generate_composites()
    999         else:
   1000             # don't lose datasets that we may need later for generating

~/Software/pytroll/packages/satpy/satpy/scene.py in generate_composites(self, nodes)
    799             nodes = set(self.dep_tree.trunk(nodes=required_nodes)) - \
    800                 set(self.datasets.keys())
--> 801         return self._read_composites(nodes)
    802 
    803     def _remove_failed_datasets(self, keepables):

~/Software/pytroll/packages/satpy/satpy/scene.py in _read_composites(self, compositor_nodes)
    773         keepables = set()
    774         for item in compositor_nodes:
--> 775             self._generate_composite(item, keepables)
    776         return keepables
    777 

~/Software/pytroll/packages/satpy/satpy/scene.py in _generate_composite(self, comp_node, keepables)
    748             composite = compositor(prereq_datasets,
    749                                    optional_datasets=optional_datasets,
--> 750                                    **self.attrs)
    751 
    752             cid = DatasetID.from_dict(composite.attrs)

~/Software/pytroll/packages/satpy/satpy/composites/viirs.py in __call__(self, datasets, optional_datasets, **info)
     98         else:
     99             vis, sensor_aa, sensor_za, solar_aa, solar_za = self.check_areas(
--> 100                 datasets + optional_datasets)
    101             # get the dask array underneath
    102             sensor_aa = sensor_aa.data

ValueError: too many values to unpack (expected 5)

Adding a debugger call just before the failure and printing the standard_names of the datasets returned by check_areas() it seems that there are multiple instances of sensor/satellite azimuth and zenith angles:

(Pdb) print('\n'.join([dset.attrs['standard_name'] for dset in self.check_areas(datasets + optional_datasets)]))
toa_bidirectional_reflectance
sensor_azimuth_angle
sensor_zenith_angle
solar_azimuth_angle
solar_zenith_angle
sensor_azimuth_angle
sensor_zenith_angle
solar_azimuth_angle
solar_zenith_angle

Environment Info:

  • SatPy Version: 0.11.1
  • Conda, Python 3.6
@djhoese
Copy link
Member

djhoese commented Jan 16, 2019

@pnuu Are you sure you don't have some custom configuration messing with this?

The composites, which need to be specially configured if they use I band data, work for me. I am able to request scn.load(['natural_color']) for VIIRS SDR data and have it produced with no issue. Granted my data is from 2012, but that shouldn't make a difference. I am using the default satpy configurations.

@pnuu
Copy link
Member Author

pnuu commented Jan 17, 2019

Indeed. It was a modifier I thought I had copy&pasted to my own viirs.yaml from the built-ins:

modifiers:
  rayleigh_corrected:
    compositor: !!python/name:satpy.composites.viirs.ReflectanceCorrector
    dem_filename: CMGDEM.hdf
    prerequisites:
    - satellite_azimuth_angle
    - satellite_zenith_angle
    - solar_azimuth_angle
    - solar_zenith_angle

After changing the modifier name to rayleigh_corrected_crefl it didn't crash anymore.

Closing: user error :-)

@pnuu pnuu closed this as completed Jan 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants