Closed dnerini closed 3 years ago
@pulkkins do you want to take this over or should I give it a try first?
I'll take care of this.
This should be fixed in commits 9e7a951, c46a001 and b4198d3. Commit b4198d3 also fixed the problem that the test for the velocity field was inside wrong if clause.
Very good, @pulkkins , many thanks for taking care of this!
With scipy>=1.6, a call to
steps.forecast
with argumentsvel_pert_method="bps"
andV=np.zeros((2, R[0, :].shape*))
returns all NaNs.Steps to reproduce
Set up test environment:
In python:
Expected output
precip_output
should be an array of finite values.Cause
The output of
steps.forecast
being all NaNs is caused by the call toextrapolator_method(R_f_ip, V_pert, [t_diff_prev], **extrap_kwargs_)
(L#757 of steps.py) (Note that this is callingsemilagrangian.extrapolate
) withV_pert
being all NaNs.This is caused by the call to
generate_vel_noise(vps[j], t_total[j] * timestep)
(L#754 in steps.py) at linesN = linalg.norm(V, axis=0)
andV_n = V / np.stack([N, N])
(L#127-128 in noise/motion.py) when variableV
is all zeros.I can see two main problems here that would need to be fixed:
generate_vel_noise(vps[j], t_total[j] * timestep)
should not return NaNs when zero motion is passed, but rather zero or little velocity noise.semilagrangian.extrapolate(R_f_ip, V_pert, [t_diff_prev], **extrap_kwargs_)
should not silently fail whenV_pert
is non-finite, but rather raise an exception.Originally posted by @dnerini in https://github.com/pySTEPS/pysteps/issues/202#issuecomment-757163327