Wflow.jl
Wflow.jl copied to clipboard
support nearest-neighbour in in lake rating curve tables (hq)
Feature type
Adding new functionality
Improvement Description
Currently, lake outflow dtermined by a rating curve table (hq) uses linear interpolation. A nearest-neighbour approach would be of added value when a discrete outflow regime is defined (in clear 'steps', see for example this image: https://wiki.bluemodel.org/images/d/de/Theorie_Abb5.gif).
Implementation Description
The outflow is calculated in:
if lake.outflowfunc[i] == 1
outflow =
interpolate_linear(lake.waterlevel[i], lake.hq[i].H, lake.hq[i].Q[:, doy])
outflow = min(outflow, storage_input)
Would it be possible to replace interpolate_linear
by a generic calculate_lake_outflow
function which get assigned during initialization of the lake? Depending on the model configuration, interpolation or nearest neighbour can be used. This could be set either as a setting in the [model]
section (preserving backward compatibility) or through an extra layer in the staticmaps (much larger impact on existing models)
Additional Context
Good to note: this behaviour is also possible in the current situation with linear interpolation by defining extra lines in the hq-table to 'force' this discrete behaviour. Still, it might be interesting to consider the support of a nearest-neighbour approach, especially when this functionality is used to simulate reservoirs using the lake module. Also consider the discussion in https://github.com/Deltares/Wflow.jl/issues/353