Skip to content

Commit

Permalink
fix issue with precip_models_cascade
Browse files Browse the repository at this point in the history
  • Loading branch information
mats-knmi committed Oct 2, 2024
1 parent 7fd7122 commit 6d51fd4
Showing 1 changed file with 25 additions and 25 deletions.
50 changes: 25 additions & 25 deletions pysteps/blending/steps.py
Original file line number Diff line number Diff line change
Expand Up @@ -645,33 +645,33 @@ def forecast(
# 2.3.3 If zero_precip_radar, make sure that precip_cascade does not contain
# only nans or infs. If so, fill it with the zero value.
if zero_precip_radar:
if precip_models_cascade is not None:
precip_cascade[~np.isfinite(precip_cascade)] = np.nanmin(
precip_models_cascade
)
else:
done = False
for t in timesteps:
if done:
break
for j in range(precip_models.shape[0]):
if not blending.utils.check_norain(
precip_models, precip_thr, norain_thr
):
precip_models_cascade_temp = decompositor(
precip_models[j, t, :, :],
bp_filter=bp_filter,
fft_method=fft,
output_domain=domain,
normalize=True,
compute_stats=True,
compact_output=True,
)["cascade_levels"]
done = False
for t in timesteps:
if done:
break
for j in range(precip_models.shape[0]):
if not blending.utils.check_norain(
precip_models, precip_thr, norain_thr
):
if precip_models_cascade is not None:
precip_cascade[~np.isfinite(precip_cascade)] = np.nanmin(
precip_models_cascade_temp
precip_models_cascade[j, t]
)
done = True
break
continue
precip_models_cascade_temp = decompositor(
precip_models[j, t, :, :],
bp_filter=bp_filter,
fft_method=fft,
output_domain=domain,
normalize=True,
compute_stats=True,
compact_output=True,
)["cascade_levels"]
precip_cascade[~np.isfinite(precip_cascade)] = np.nanmin(
precip_models_cascade_temp
)
done = True
break

# 2.3.5 If zero_precip_radar is True, only use the velocity field of the NWP
# forecast. I.e., velocity (radar) equals velocity_model at the first time
Expand Down

0 comments on commit 6d51fd4

Please sign in to comment.