-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- misc updates op fix-scripts voor NZV en DOD - samenvoegen voor LHM, inclusief patch RWS-HWS en reset van static tables AAM - uploaden feedbackformulieren --------- Co-authored-by: ngoorden <[email protected]> Co-authored-by: Martijn Visser <[email protected]>
- Loading branch information
1 parent
932a39b
commit a2fd22d
Showing
14 changed files
with
740 additions
and
180 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 61 additions & 0 deletions
61
notebooks/drents_overijsselse_delta/00_review_model_network.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
# %% | ||
|
||
import pandas as pd | ||
|
||
from ribasim_nl import CloudStorage, Model, NetworkValidator | ||
|
||
cloud = CloudStorage() | ||
|
||
authority = "DrentsOverijsselseDelta" | ||
short_name = "dod" | ||
|
||
ribasim_toml = cloud.joinpath(authority, "modellen", f"{authority}_fix_model_network", f"{short_name}.toml") | ||
database_gpkg = ribasim_toml.with_name("database.gpkg") | ||
|
||
model = Model.read(ribasim_toml) | ||
network_validator = NetworkValidator(model) | ||
|
||
verwerkt_dir = cloud.joinpath(authority, "verwerkt") | ||
verwerkt_dir.mkdir(exist_ok=True) | ||
|
||
modelfouten_gpkg = cloud.joinpath(authority, "verwerkt", "modelfouten.gpkg") | ||
|
||
# %% verwijderen duplicated edges | ||
|
||
duplicated_edges = len(model.edge.df[model.edge.df.duplicated()]) | ||
model.edge.df.drop_duplicates(inplace=True) | ||
|
||
model.fix_unassigned_basin_area() | ||
|
||
# %% wegschrijven fouten | ||
|
||
# niet-bestaande fouten | ||
mask = model.edge.df.to_node_id.isin(model.node_table().df.index) & model.edge.df.from_node_id.isin( | ||
model.node_table().df.index | ||
) | ||
|
||
edge_mist_node_df = model.edge.df[~mask] | ||
model.edge.df = model.edge.df[mask] | ||
|
||
mask = model.edge.df.geometry.length == 0 | ||
model.edge.df[mask].centroid.to_file(modelfouten_gpkg, layer="edge_zonder_lengte") | ||
model.edge.df = model.edge.df[~mask] | ||
|
||
# niet-gekoppelde areas | ||
model.basin.area.df[~model.basin.area.df.node_id.isin(model.basin.node.df.index)].to_file( | ||
modelfouten_gpkg, layer="area_niet_een_basin" | ||
) | ||
|
||
model.basin.node.df[~model.basin.node.df.index.isin(model.basin.area.df.node_id)].to_file( | ||
modelfouten_gpkg, layer="basin_zonder_area" | ||
) | ||
|
||
# ontbrekende basins | ||
network_validator.node_invalid_connectivity().to_file(modelfouten_gpkg, layer="node_mist") | ||
pd.concat([network_validator.edge_incorrect_connectivity(), edge_mist_node_df]).to_file( | ||
modelfouten_gpkg, layer="ege_mist_node" | ||
) | ||
|
||
# nodes met verkeerde richting | ||
|
||
model.invalid_topology_at_node().to_file(modelfouten_gpkg, layer="node_met_verkeerde_instroom_uitstroom_egde") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# %% | ||
from ribasim_nl import CloudStorage, Model | ||
|
||
cloud = CloudStorage() | ||
|
||
ribasim_toml = cloud.joinpath("Rijkswaterstaat", "modellen", "hws_2024_7_0", "hws.toml") | ||
model = Model.read(ribasim_toml) | ||
|
||
# %%update stuw driel | ||
node_id = 8413 | ||
min_level = model.upstream_profile(node_id).level.min() + 0.1 | ||
mask = model.tabulated_rating_curve.static.df.node_id == node_id | ||
mask = mask & (model.tabulated_rating_curve.static.df.level < min_level) | ||
model.tabulated_rating_curve.static.df.loc[mask, ["level"]] = min_level | ||
|
||
|
||
model.write(cloud.joinpath("Rijkswaterstaat", "modellen", "hws", "hws.toml")) | ||
# %% |
Oops, something went wrong.