pytroll / pytroll-examples

Collection of examples for pytroll satellite data processing
GNU General Public License v3.0
76 stars 34 forks source link

Unable to create a true color image #17

Closed obemachi closed 5 years ago

obemachi commented 5 years ago

I tried to make true color from the standard sunflower data using himawari standerd data (HSD) and generate true color RGB. But I can't this. Here is the code.

rgbname = 'true_color'

scn.load([rgbname])

[DEBUG: 2019-10-06 14:06:34 : satpy.node] Skipping optional solar_zenith_angle: Unknown dataset solar_zenith_angle [DEBUG: 2019-10-06 14:06:34 : satpy.node] Skipping optional satellite_azimuth_angle: Unknown dataset satellite_azimuth_angle [DEBUG: 2019-10-06 14:06:34 : satpy.node] Skipping optional satellite_zenith_angle: Unknown dataset satellite_zenith_angle [DEBUG: 2019-10-06 14:06:34 : satpy.node] Skipping optional solar_azimuth_angle: Unknown dataset solar_azimuth_angle [DEBUG: 2019-10-06 14:06:34 : satpy.node] Skipping optional solar_zenith_angle: Unknown dataset solar_zenith_angle [DEBUG: 2019-10-06 14:06:34 : satpy.node] Skipping optional solar_zenith_angle: Unknown dataset solar_zenith_angle [DEBUG: 2019-10-06 14:06:34 : satpy.node] Skipping optional satellite_azimuth_angle: Unknown dataset satellite_azimuth_angle [DEBUG: 2019-10-06 14:06:34 : satpy.node] Skipping optional satellite_zenith_angle: Unknown dataset satellite_zenith_angle [DEBUG: 2019-10-06 14:06:34 : satpy.node] Skipping optional solar_azimuth_angle: Unknown dataset solar_azimuth_angle [DEBUG: 2019-10-06 14:06:34 : satpy.node] Skipping optional solar_zenith_angle: Unknown dataset solar_zenith_angle [DEBUG: 2019-10-06 14:06:34 : satpy.node] Skipping optional solar_zenith_angle: Unknown dataset solar_zenith_angle [DEBUG: 2019-10-06 14:06:34 : satpy.node] Skipping optional solar_zenith_angle: Unknown dataset solar_zenith_angle [DEBUG: 2019-10-06 14:06:34 : satpy.node] Skipping optional satellite_azimuth_angle: Unknown dataset satellite_azimuth_angle [DEBUG: 2019-10-06 14:06:34 : satpy.node] Skipping optional satellite_zenith_angle: Unknown dataset satellite_zenith_angle [DEBUG: 2019-10-06 14:06:34 : satpy.node] Skipping optional solar_azimuth_angle: Unknown dataset solar_azimuth_angle [DEBUG: 2019-10-06 14:06:34 : satpy.node] Skipping optional solar_zenith_angle: Unknown dataset solar_zenith_angle [DEBUG: 2019-10-06 14:06:34 : ahi_hsd] Band number = 2 [DEBUG: 2019-10-06 14:06:34 : ahi_hsd] Time_interval: 2019-10-02 00:50:20.332751 - 2019-10-02 00:50:53.688037 [DEBUG: 2019-10-06 14:06:34 : ahi_hsd] Reading time 0:00:00.007624 [DEBUG: 2019-10-06 14:06:34 : ahi_hsd] Calibration time 0:00:00.002801 [DEBUG: 2019-10-06 14:06:34 : ahi_hsd] Band number = 2 [DEBUG: 2019-10-06 14:06:34 : ahi_hsd] Time_interval: 2019-10-02 00:50:53.688037 - 2019-10-02 00:51:40.372615 [DEBUG: 2019-10-06 14:06:34 : ahi_hsd] Reading time 0:00:00.006510 [DEBUG: 2019-10-06 14:06:34 : ahi_hsd] Calibration time 0:00:00.004917 [DEBUG: 2019-10-06 14:06:34 : ahi_hsd] Band number = 2 [DEBUG: 2019-10-06 14:06:34 : ahi_hsd] Time_interval: 2019-10-02 00:51:40.372615 - 2019-10-02 00:52:37.641198 [DEBUG: 2019-10-06 14:06:34 : ahi_hsd] Reading time 0:00:00.006763 [DEBUG: 2019-10-06 14:06:34 : ahi_hsd] Calibration time 0:00:00.002606 [DEBUG: 2019-10-06 14:06:34 : ahi_hsd] Band number = 2 [DEBUG: 2019-10-06 14:06:34 : ahi_hsd] Time_interval: 2019-10-02 00:52:37.641198 - 2019-10-02 00:54:03.914060 ...

`TypeError Traceback (most recent call last)

in ----> 1 scn.load(['true_color'])` `~/anaconda3/lib/python3.7/site-packages/satpy/scene.py in load(self, wishlist, calibration, resolution, polarization, level, generate, unload, **kwargs) 967 self.read(**kwargs) 968 if generate: --> 969 keepables = self.generate_composites() 970 else: 971 # don't lose datasets we loaded to try to generate composites` `~/anaconda3/lib/python3.7/site-packages/satpy/scene.py in generate_composites(self, nodes) 882 nodes = set(self.dep_tree.trunk(nodes=required_nodes)) - \ 883 set(self.datasets.keys()) --> 884 return self._read_composites(nodes) 885 886 def _remove_failed_datasets(self, keepables):` `~/anaconda3/lib/python3.7/site-packages/satpy/scene.py in _read_composites(self, compositor_nodes) 856 keepables = set() 857 for item in compositor_nodes: --> 858 self._generate_composite(item, keepables) 859 return keepables 860 ` `~/anaconda3/lib/python3.7/site-packages/satpy/scene.py in _generate_composite(self, comp_node, keepables) 831 composite = compositor(prereq_datasets, 832 optional_datasets=optional_datasets, --> 833 **self.attrs) 834 835 cid = DatasetID.from_dict(composite.attrs)` `~/anaconda3/lib/python3.7/site-packages/satpy/composites/__init__.py in __call__(self, projectables, **info) 402 if self.max_sza is not None: 403 coszen = coszen.where(coszen >= self.max_sza_cos) --> 404 self.coszen[key] = coszen 405 elif coszen is None: 406 # we were given the SZA, calculate the cos(SZA)` `~/anaconda3/lib/python3.7/weakref.py in __setitem__(self, key, value) 166 if self._pending_removals: 167 self._commit_removals() --> 168 self.data[key] = KeyedRef(value, self._remove, key) 169 170 def copy(self):` `~/anaconda3/lib/python3.7/weakref.py in __new__(type, ob, callback, key) 335 336 def __new__(type, ob, callback, key): --> 337 self = ref.__new__(type, ob, callback) 338 self.key = key 339 return self` `TypeError: cannot create weak reference to 'DataArray' object` However, setting "rgbname" to "true_color_raw" will create a composite image.
zxdawn commented 5 years ago

xarray v0. 13.0 is the problem and need to be downgraded until 0.13.1 is released.

obemachi commented 5 years ago

Thank you for teaching me. I downgraded xarray and restarted. After trying again, a beautiful true color image was created. Thank you very much.