Running SPLASH using arrays that contain some np.nan values (which is an expected use case - could be water cells in a grid) outputs the following when running estimate_initial_soil_moisture:
In [84]: init_soil_moisture = splash.estimate_initial_soil_moisture(verbose=True)
Iteration: 1; maximum difference: nan
Iteration: 2; maximum difference: nan
Expected behavior
That verbose behaviour should use np.nanmax to give more meaningful progress to convergence.
Edited to add:
To extend this issue with a couple more linked changes:
the error message on failure should also handle np.nan
the function should optionally return the maximum difference that is calculated to estimate convergence as a debugging tool. In this use case, I think it could return the calculated soil moisture whether or not it has converged - so it runs for n_iter and gives back where it got to.
Actually - giving this more thought - I think this probably should add a return_convergence: bool = False argument. When that flag is True, the code creates an array with an n_iter sized dimension on the first axis that is used to return the successive guesses at initial_soil_moisture. That can then be used to explore convergence issues across the input dimensions much more cleanly and keeps the return type as a single np.array
Describe the bug
Running SPLASH using arrays that contain some
np.nan
values (which is an expected use case - could be water cells in a grid) outputs the following when runningestimate_initial_soil_moisture
:Expected behavior
That
verbose
behaviour should usenp.nanmax
to give more meaningful progress to convergence.Edited to add:
To extend this issue with a couple more linked changes:
np.nan
the function should optionally return the maximum difference that is calculated to estimate convergence as a debugging tool. In this use case, I think it could return the calculated soil moisture whether or not it has converged - so it runs for
n_iter
and gives back where it got to.Actually - giving this more thought - I think this probably should add a
return_convergence: bool = False
argument. When that flag isTrue
, the code creates an array with ann_iter
sized dimension on the first axis that is used to return the successive guesses atinitial_soil_moisture
. That can then be used to explore convergence issues across the input dimensions much more cleanly and keeps the return type as a singlenp.array