This is the bugfix for Units module when fcst
is not provided (#57 (comment 233553)). I tested it with this recipe https://earth.bsc.es/gitlab/es/sunset/-/blob/master/recipes/atomic_recipes/recipe_test_multivar.yml, with fcst_year
being changed to empty.
The way I chose to fix the bug is to make orig_units have hcst, fcst, obs all the time, even when fcst is NULL. I only one doubt: this line has a comment "when fcst is NULL" and it changes the units to the user_units if orig_units doesn't exist (i.e., when fcst is NULL). In my fix, this line is not needed because the NULL data don't need any changes. But I don't know if I miss some possibilities here.
I also corrected the warning, which printed repetitive sentences for each dataset. I guess all the dataset names should be collapsed into one string.
# Used to be:
WARN [2023-09-27 18:12:31] The units in hcst are not all equal. If this is not expected, please contact the ES data team.The units in fcst are not all equal. If this is not expected, please contact the ES data team.The units in obs are not all equal. If this is not expected, please contact the ES data team.
# Now:
WARN [2023-09-27 18:12:31] The units in hcst, fcst, obs are not all equal. If this is not expected, please contact the ES data team.The units in fcst are not all equal.
Let me know if there is anything to be improved further.
Cheers,
An-Chi