Open mraspaud opened 6 years ago
Just to be clear, I'm 90% sure the reason the I-band resolution angles are chosen is because they are higher resolutions not because they are listed in a certain order in the YAML. YAML order shouldn't matter. If it does, it should be changed.
@davidh-ssec hmmm, sounds plausible.
So basically the dependency tree needs to try to get composite dependencies at the same resolution as the other inputs. If it can't find the resolution it can fall back to the highest resolution. A couple design questions:
I can foresee issues where one composite's dependencies result in the 1000m SZA being loaded and another composite wants an unavailable 250m resolution so it will then see 1000m is already loaded and use that instead of loading the 500m resolution that would be a better choice. Maybe...not sure.
@mraspaud Didn't we fix this already?
No, just found another example
ipdb> print(self.dep_tree)
None (No Data)
+DatasetID(name='snow', wavelength=None, resolution=None, polarization=None, calibration=None, level=None, modifiers=None)
+ +DatasetID(name='DNB', wavelength=(0.5, 0.7, 0.9), resolution=743, polarization=None, calibration='radiance', level=None, modifiers=('sunz_corrected',))
+ + +DatasetID(name='DNB', wavelength=(0.5, 0.7, 0.9), resolution=743, polarization=None, calibration='radiance', level=None, modifiers=())
+ + +DatasetID(name='solar_zenith_angle', wavelength=None, resolution=742, polarization=None, calibration=None, level=None, modifiers=())
+ +DatasetID(name='M10', wavelength=(1.58, 1.61, 1.64), resolution=742, polarization=None, calibration='reflectance', level=None, modifiers=('sunz_corrected',))
+ +DatasetID(name='I04', wavelength=(3.58, 3.74, 3.9), resolution=371, polarization=None, calibration='brightness_temperature', level=None, modifiers=('nir_reflectance',))
+ + +DatasetID(name='I04', wavelength=(3.58, 3.74, 3.9), resolution=371, polarization=None, calibration='brightness_temperature', level=None, modifiers=())
+ + +DatasetID(name='M15', wavelength=(10.263, 10.763, 11.263), resolution=742, polarization=None, calibration='brightness_temperature', level=None, modifiers=())
+ + +DatasetID(name='solar_zenith_angle', wavelength=None, resolution=371, polarization=None, calibration=None, level=None, modifiers=())
In that last example, what's the expected output?
ipdb> print(self.dep_tree)
None (No Data)
+DatasetID(name='snow', wavelength=None, resolution=None, polarization=None, calibration=None, level=None, modifiers=None)
+ +DatasetID(name='DNB', wavelength=(0.5, 0.7, 0.9), resolution=743, polarization=None, calibration='radiance', level=None, modifiers=('sunz_corrected',))
+ + +DatasetID(name='DNB', wavelength=(0.5, 0.7, 0.9), resolution=743, polarization=None, calibration='radiance', level=None, modifiers=())
+ + +DatasetID(name='solar_zenith_angle', wavelength=None, resolution=742, polarization=None, calibration=None, level=None, modifiers=())
+ +DatasetID(name='M10', wavelength=(1.58, 1.61, 1.64), resolution=742, polarization=None, calibration='reflectance', level=None, modifiers=('sunz_corrected',))
+ +DatasetID(name='I04', wavelength=(3.58, 3.74, 3.9), resolution=371, polarization=None, calibration='brightness_temperature', level=None, modifiers=('nir_reflectance',))
+ + +DatasetID(name='I04', wavelength=(3.58, 3.74, 3.9), resolution=371, polarization=None, calibration='brightness_temperature', level=None, modifiers=())
+ + +DatasetID(name='I05', wavelength=(10.263, 10.763, 11.263), resolution=371, polarization=None, calibration='brightness_temperature', level=None, modifiers=())
+ + +DatasetID(name='solar_zenith_angle', wavelength=None, resolution=371, polarization=None, calibration=None, level=None, modifiers=())
Code Sample, a minimal, complete, and verifiable piece of code
Add a breakpoint at the beginning of the
Scene.compute
method, and print out the dependency tree:Problem description
Currently, the dependency search for composites doesn't propagate the correct resolution, leading to unnecessary complication of the composite and modifier configs in the yaml files.
For example, such a yaml definition:
where the angles are defined in both M- and I-band resolution leads to the wrong resolution being chosen under certain circumstances (for example when the I-band angles are defined first in the yaml dataset list).
If no modification is made to the above yaml, the presented code crashes down the line because of not having access to the M-band resolution angles.
Expected Behaviour
I'm expecting the dependency resolution to choose the right resolution when multiple resolutions are available for some datasets but not others.
Of course, creating per-resolution modifiers fixes the problem, but I find this ugly and non-optimal.
Actual Result, Traceback if applicable
Versions of Python, package at hand and relevant dependencies
Python 2.7, 3.6, satpy 7.8 or develop as of today.