'Using satpy, Blending multiple satellite image
I want blend multiple satellite images. but an error occured. I followed the example on the satpy document.
here is code and netcdf file is here : https://drive.google.com/drive/folders/1zp6EBVfjuh41LDRRZo4PJoeGGGn13AKy?usp=sharing
from glob import glob
from satpy import Scene, MultiScene, DataQuery
from satpy.utils import debug_on
debug_on()
areaid = 'worldeqc3km70'
eumetsat = glob('E:/Global/combine_test/MSG4-SEVI-MSG15-0100-NA-20210801000010.306000000Z-20210801001259-4774254.nat')
goes17 = glob('E:/Global/combine_test/OR_ABI-L1b-RadF-M6C13_G17_s20212130000319_e20212130009396_c20212130009445.nc')
gk2a = glob('E:/Global/combine_test/gk2a_ami_le1b_ir105_fd020ge_202108010000.nc')
goes17_scene = Scene(reader="abi_l1b", filenames=goes17)
eumetsat_scene = Scene(reader="seviri_l1b_native", filenames=eumetsat)
gk2a_scene = Scene(reader="ami_l1b", filenames=gk2a)
goes17_scene.load(["C13"])
eumetsat_scene.load(['IR_108'])
gk2a_scene.load(["IR105"])
mscn = MultiScene([goes17_scene, eumetsat_scene, gk2a_scene])
#groups = {DataQuery(name='IR_group', wavelength=(9.8, 10.8, 11.8)): ['C13', 'IR105', 'IR_108']}
groups = {DataQuery(name="IR_group", wavelength=(10, 11, 12)): ['C13', 'IR_108', 'IR105']}
mscn.group(groups)
print(mscn.loaded_dataset_ids)
resampled = mscn.resample(areaid, reduce_data=False)
blended = resampled.blend()
blended.save_datasets(filename='./test_{area}.png'.format(area=areaid))
Error message: RuntimeError: None of the requested datasets have been generated or could not be loaded. Requested composite inputs may need to have matching dimensions (eg. through resampling).
Solution 1:[1]
As mentioned in the comments this is a known bug that will hopefully be fixed in the next couple weeks. Follow issue 2089 for more information.
The short-term workaround is to make your own "blend" method that handles things the way you expect:
from satpy.multiscene import stack
def my_blend(mscn, common_datasets, blend_function=stack):
new_scn = Scene()
for ds_id in common_datasets:
datasets = [scn[ds_id] for scn in mscn.scenes if ds_id in scn]
new_scn[ds_id] = blend_function(datasets)
return new_scn
blended = my_blend(resampled, ["ir_group"])
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | djhoese |
