Dear all
I am trying to recreate a composite for an image similar to the one presented in the attached file.
I try to use the MaskingCompositor to mask the fire_temperature composite first and then use the BackgroundCompositor to overlay the masked fire composite (I named it fire_temperature_composite) with the true_color_with_night_ir105 composite.
The masking compositor fails in resampling.
Can you help with that? Or provide another solution?
My custom composites (in fci.yaml) and the error I get follow.
Note: After getting the error using the " fire_temperature_and_true_color_with_night_ir105 " in my script, I used the "fire_temperature_masked" composite in order to identify the problematic composite and got the same error which you can see below.
Best regards
Sakis
######## Custom composites
fire_temperature_masked:
standard_name: fire_temperature_masked
compositor: !!python/name:satpy.composites.MaskingCompositor
conditions:
- method: less
value: 330
transparency: 100
prerequisites:
- fire_temperature
- fire_temperature
standard_name: fire_temperature_masked
fire_temperature_and_true_color_with_night_ir105:
compositor: !!python/name:satpy.composites.BackgroundCompositor
standard_name: fire_temperature_and_true_color_with_night_ir105
prerequisites:
- fire_temperature_masked
- true_color_with_night_ir105
######### Error
Traceback (most recent call last):
File "/home/thankar/MTGI1/FCI_scripts/GR_FCI_NRes_Fire_TrueColorNightIR105.py", line 132, in <module>
scn_resampled = scn.resample(area, resampler=resample_method, radius_of_influence=7000)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/thankar/anaconda3/envs/envsat2/lib/python3.11/site-packages/satpy/scene.py", line 986, in resample
new_scn.generate_possible_composites(unload)
File "/home/thankar/anaconda3/envs/envsat2/lib/python3.11/site-packages/satpy/scene.py", line 1521, in generate_possible_composites
keepables = self._generate_composites_from_loaded_datasets()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/thankar/anaconda3/envs/envsat2/lib/python3.11/site-packages/satpy/scene.py", line 1540, in _generate_composites_from_loaded_datasets
return self._generate_composites_nodes_from_loaded_datasets(needed_comp_nodes)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/thankar/anaconda3/envs/envsat2/lib/python3.11/site-packages/satpy/scene.py", line 1546, in _generate_composites_nodes_from_loaded_datasets
self._generate_composite(node, keepables)
File "/home/thankar/anaconda3/envs/envsat2/lib/python3.11/site-packages/satpy/scene.py", line 1604, in _generate_composite
composite = compositor(prereq_datasets,
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/thankar/anaconda3/envs/envsat2/lib/python3.11/site-packages/satpy/composites/__init__.py", line 1914, in __call__
alpha = self._get_alpha_bands(data, mask_in, alpha_attrs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/thankar/anaconda3/envs/envsat2/lib/python3.11/site-packages/satpy/composites/__init__.py", line 1979, in _get_alpha_bands
data = self._set_data_nans(data, mask, alpha_attrs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/thankar/anaconda3/envs/envsat2/lib/python3.11/site-packages/satpy/composites/__init__.py", line 1943, in _set_data_nans
data[i] = xr.where(mask, np.nan, dat)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/thankar/anaconda3/envs/envsat2/lib/python3.11/site-packages/xarray/core/computation.py", line 1862, in where
result = apply_ufunc(
^^^^^^^^^^^^
File "/home/thankar/anaconda3/envs/envsat2/lib/python3.11/site-packages/xarray/core/computation.py", line 1197, in apply_ufunc
return apply_dataarray_vfunc(
^^^^^^^^^^^^^^^^^^^^^^
File "/home/thankar/anaconda3/envs/envsat2/lib/python3.11/site-packages/xarray/core/computation.py", line 304, in apply_dataarray_vfunc
result_var = func(*data_vars)
^^^^^^^^^^^^^^^^
File "/home/thankar/anaconda3/envs/envsat2/lib/python3.11/site-packages/xarray/core/computation.py", line 786, in apply_variable_ufunc
raise ValueError(
ValueError: applied function returned data with unexpected number of dimensions. Received 3 dimension(s) but expected 2 dimensions with names: ('y', 'x')