Bug when pysteps.blending.steps with multiple NWP models
mpvginde opened this issue · comments
Dear pysteps developers,
I recently ran into to the following error when making a steps blended nowcast with an ensemble of NWP models.
The error I got:
File "/space/hpc-home/michielv/pylibs/pysteps/pysteps/blending/steps.py", line 723, in worker
rho_nwp_fc = blending.skill_scores.lt_dependent_cor_nwp(
File "/space/hpc-home/michielv/pylibs/pysteps/pysteps/blending/skill_scores.py", line 125, in lt_dependent_cor_nwp
clim_cor_values, regr_pars = clim_regr_values(
File "/space/hpc-home/michielv/pylibs/pysteps/pysteps/blending/skill_scores.py", line 249, in clim_regr_values
clim_cor_values = clim_cor_values[n_model, :]
IndexError: index 5 is out of bounds for axis 0 with size 1
I have been able to trace back the error to the fact that in blending/skill_scores.py
the function clim_regr_values calls the blending.clim.calc_clim_skill function:
# First, obtain climatological skill values
try:
clim_cor_values = clim.calc_clim_skill(
outdir_path=outdir_path, n_cascade_levels=n_cascade_levels, **skill_kwargs
)
except FileNotFoundError:
# The climatological skill values file does not exist yet, so we'll
# use the default values from BPS2004.
clim_cor_values = np.array(
[[0.848, 0.537, 0.237, 0.065, 0.020, 0.0044, 0.0052, 0.0040]]
)
clim_cor_values = clim_cor_values[n_model, :]
without the n_models keyword, which then defaults to n_models=1. In the case that no previous skill file exists, the default skill is set, but only for 1 model.
In the case you run with multiple nwp models, the n_model index is thus out of bounds.
Hope this is somewhat clear.
Michiel Van Ginderachter
RMI
Hi Michiel,
Thanks a lot for your message and finding this potential bug! I'll pick it up in one of the coming days and I'll directly check why this passed our tests. ;)
Just to double check, which pysteps version are you using?