-
Notifications
You must be signed in to change notification settings - Fork 5
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
Cannot run model without any Basins #1615
Comments
Thanks for the report. Could you add the Python script you have for writing the model, and the error message that Ribasim gives? EDIT: The Python script is here: #1263 (comment) |
The error itself comes from here, where area and level are both typed empty arrays Line 603 in eadc057
Not sure how many issues hide behind this one though. If it isn't easy to support, with correct results, we should error early with a clear message. |
Even after adding a Basin I get the same problem: import subprocess # for running the model
import shutil
from pathlib import Path
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from ribasim import Allocation, Model, Node
from ribasim.nodes import (
flow_boundary,
basin,
terminal
)
from shapely.geometry import Point
base_dir = Path("c:/Ribasim9")
model_dir = base_dir / "Virgin"
flows_path = model_dir / "input/ACTINFLW.csv"
starttime = "2023-01-01"
endtime = "2024-01-01"
model = Model(
starttime=starttime,
endtime=endtime,
crs="EPSG:4326",
)
#%% FLOW BOUNDARY
# FLOW BOUNDARY
flows = pd.read_csv(flows_path, sep=";")
model.flow_boundary.add(
Node(1, Point(0.0, 0.0), name='Main'),
[flow_boundary.Time(time=flows.time, flow_rate=flows.main, #name="Main"
)]
)
model.flow_boundary.add(
Node(2, Point(-3.0, 0.0), name='Minor'),
[flow_boundary.Time(time=flows.time, flow_rate=flows.minor, #name="Main"
)]
)
# BASIN (confluence)
model.basin.add(
Node(3, Point(-1.5, -1), name='Conf'),
[
basin.Profile(area=[1000.0, 1000.0], level=[0.0, 1.0]),
basin.State(level=[20.0]),
basin.Time(time=[starttime, endtime], precipitation=[0.0, 3e-6]),
],
)
# TERMINAL
model.terminal.add(Node(4, Point(-1.5, -3.0), name="Terminal"))
# EDGES
model.edge.add(model.flow_boundary[1], model.basin[3])
model.edge.add(model.flow_boundary[2], model.basin[3])
model.edge.add(model.basin[3], model.terminal[4])
# SCHEMATIZATION
model.plot()
datadir = Path("data")
toml_path = datadir / "basic/ribasim.toml"
model.write(toml_path)
rib_path = base_dir / "ribasim_windows/ribasim.exe"
subprocess.run([rib_path, toml_path], check=True) Is it the way the subprocess run is called? |
Indeed, this is improved in #1650. For the error of #1615 (comment), I suggest we look again after #1649 is merged. |
What
If a user wants to model a simple system with no storage, the following error is shown:
Why
Not clear that a basin node is needed to be able to run the model.

How
Mention in the error that the user needs to add a basin for the model to run or describe that certain nodes cannot be directly linked (in this case flow boundaries directly linked with a terminal)
The text was updated successfully, but these errors were encountered: