Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor TabulatedRatingCurve / time updating #1976

Open
visr opened this issue Dec 16, 2024 · 0 comments
Open

Refactor TabulatedRatingCurve / time updating #1976

visr opened this issue Dec 16, 2024 · 0 comments
Labels
tech-debt Improvements related to technical debt

Comments

@visr
Copy link
Member

visr commented Dec 16, 2024

TabulatedRatingCurve and Subgrid are the two LinearInterpolations that can be updated over time. For both we currently only support instantaneous updates.

TabulatedRatingCurve was done first in #165, and the unprocessed time table is read during initialization, after which the callback (update_tabulated_rating_curve!) searches the sorted table for the right data. From this a LinearInterpolation is created which is put into the model struct. This callback runs each time new data appears, which is precomputed.

The Subgrid update from #1975 was done differently, which is more in line with the way we update the other dynamic data. We process the tables into interpolation objects at initialization time, then use these to lookup the right data at runtime. Note that there is a double lookup. First we use the subgrid ID and time to look up what the h(h) is, and then use that to look up the h.

We should probably refactor TabulatedRatingCurve / time handling to be more like Basin / subgrid_time. One thing to consider is that this setup only supports instantaneous updating of relations. For now there is no need yet to support gradually changing relations over time, though there were reports of convergence issues is Q(h) relations get changed a lot over time, so eventually we may need time-smoothing in addition to #1919. It would need to work with a different number of data points in the LinearInterpolation over time, and DataInterpolations.jl is currently restricted to 1D.

@visr visr added the tech-debt Improvements related to technical debt label Dec 16, 2024
@github-project-automation github-project-automation bot moved this to To do in Ribasim Dec 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tech-debt Improvements related to technical debt
Projects
Status: To do
Development

No branches or pull requests

1 participant