Floating point artifacts for HS when SWE is zero
At the end of a snowpack evolution it can happen that floating point artifacts remain in the layer SWE contents. I am not sure if this is a problem, but it came up when Christoph detected strange patterns for weekly anomalies in spring. Some pixels where zero, and pixels next to them were below 1e-15, which has a large effect if you divide in order to get anomalies.
A workaround would be to check if SWE is zero and then force HS to zero. I think the easiest way to implement this is to pass total SWE of the snowpack to timestep_forward
and then force all layers in the layer state variables (swe_layers
, rho_layers
, rho_max_layers
) to zero if SWE is zero.