Skip to content

Commit

Permalink
Fix some errors.
Browse files Browse the repository at this point in the history
  • Loading branch information
evetion committed May 16, 2024
1 parent c8b033d commit e5cd1bb
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions coupling/delwaq/generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@
USE_EVAP = True


def generate(toml: Path) -> tuple[nx.DiGraph, set[str]]:
def generate(modelfn: Path) -> tuple[nx.DiGraph, set[str]]:
"""Generate a Delwaq model from a Ribasim model and results."""

# Read in model and results
model = ribasim.Model.read(toml)
model = ribasim.Model.read(modelfn)
basins = pd.read_feather(modelfn.parent / "results" / "basin.arrow")
flows = pd.read_feather(modelfn.parent / "results" / "flow.arrow")

Expand Down
4 changes: 3 additions & 1 deletion coupling/delwaq/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,8 @@ def run_delwaq():
d3d_home = os.environ.get("D3D_HOME")
if d3d_home is None:
raise ValueError("D3D_HOME is not set.")
else:
d3d_home = Path(d3d_home)
binfolder = (d3d_home / "bin").absolute()
folder = Path(__file__).parent
inp_path = folder / "model" / "delwaq.inp"
Expand All @@ -160,4 +162,4 @@ def run_delwaq():
elif system == "Linux":
subprocess.run([binfolder / "run_delwaq.sh", inp_path.absolute()])
else:
raise Exception(f"No support for running Delwaq automatically on {system}.")
raise OSError(f"No support for running Delwaq automatically on {system}.")
2 changes: 1 addition & 1 deletion pixi.toml
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ generate-testmodels = { cmd = "python utils/generate-testmodels.py", inputs = [
"generated_testmodels",
] }
tests = { depends_on = ["lint", "test-ribasim-python", "test-ribasim-core"] }
delwaq = { cmd = "python coupling/delwaq/test.py" }
delwaq = { cmd = "pytest coupling/delwaq/test.py" }
# Codegen
codegen = { cmd = "julia --project utils/gen_python.jl && ruff format python/ribasim/ribasim/schemas.py", depends_on = [
"initialize-julia",
Expand Down

0 comments on commit e5cd1bb

Please sign in to comment.