Support storage column in basin profile - #2278
Conversation
SouthEndMusic
left a comment
There was a problem hiding this comment.
Overall this looks good! I left a few comments. I'm also missing an update of the Basin documentation in basin.qmd.
|
|
||
| """ | ||
| Validated the initialisation of basins. Each basin at least need a level-area or level storage relationship. | ||
| We recommend to initialise all basins in the same way, which can be level-area, level-storage or level-area-storage. |
There was a problem hiding this comment.
It's good to have this here, but this is typically something that you also put into the documentation.
Co-authored-by: Bart de Koning <74617371+SouthEndMusic@users.noreply.github.com>
…https://github.com/Deltares/Ribasim into Ribasim#2254-Support-storage-column-in-Basin-profile
|
|
||
| @testitem "init_basin_only_storage" begin | ||
| toml_path = normpath( | ||
| @__DIR__, | ||
| "../../generated_testmodels/basic_basin_only_storage/ribasim.toml", | ||
| ) | ||
| @test ispath(toml_path) | ||
| model = Ribasim.run(toml_path) | ||
| @test model isa Ribasim.Model | ||
| @test success(model) | ||
| end | ||
|
|
||
| @testitem "init_basin_only_area" begin | ||
| toml_path = | ||
| normpath(@__DIR__, "../../generated_testmodels/basic_basin_only_area/ribasim.toml") | ||
| @test ispath(toml_path) | ||
| model = Ribasim.run(toml_path) | ||
| @test model isa Ribasim.Model | ||
| @test success(model) | ||
| end | ||
|
|
||
| @testitem "init_basin_both_area_and_storage" begin |
There was a problem hiding this comment.
Note that if you don't have model specific tests but just want to make sure the models run without error, there is no need to add them here, because all testmodels will be run as part of
Lines 166 to 169 in b50232d
SouthEndMusic
left a comment
There was a problem hiding this comment.
I added some final comments, nice work!
| end | ||
|
|
||
| function Basin(db::DB, config::Config, graph::MetaGraph) | ||
| function Basin(db::DB, config::Config, graph::MetaGraph)::Basin |
There was a problem hiding this comment.
It's a bit inconsistent to only have this here. Either do it for all node types or none of them. We don't need it, so it's fine to leave this out.
| profiles::StructVector{BasinProfileV1}, | ||
| )::Nothing | ||
| for (i, group) in enumerate(IterTools.groupby(row -> row.node_id, profiles)) | ||
| group_area = getproperty.(group, :area) |
Fixes #2254
Notes: