Skip to content

Commit

Permalink
Add pixi command to generate delwaq input for a given toml.
Browse files Browse the repository at this point in the history
  • Loading branch information
evetion committed Oct 9, 2024
1 parent 7cda674 commit 9fdaba6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
1 change: 1 addition & 0 deletions pixi.toml
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ generate-testmodels = { cmd = "python utils/generate-testmodels.py", inputs = [
] }
tests = { depends_on = ["lint", "test-ribasim-python", "test-ribasim-core"] }
delwaq = { cmd = "pytest python/ribasim/tests/test_delwaq.py" }
gen-delwaq = { cmd = "python python/ribasim/ribasim/delwaq/generate.py" }
model-integration-test = { cmd = "julia --project=core --eval 'using Pkg; Pkg.test(test_args=[\"integration\"])'" }
# Codegen
codegen = { cmd = "julia --project utils/gen_python.jl && ruff format python/ribasim/ribasim/schemas.py python/ribasim/ribasim/validation.py", depends_on = [
Expand Down
9 changes: 4 additions & 5 deletions python/ribasim/ribasim/delwaq/generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import csv
import shutil
import sys
from datetime import timedelta
from pathlib import Path

Expand All @@ -21,8 +22,7 @@
jinja2 = MissingOptionalModule("jinja2", "delwaq") # type: ignore

import ribasim

from .util import (
from ribasim.delwaq.util import (
strfdelta,
ugrid,
write_flows,
Expand Down Expand Up @@ -493,6 +493,5 @@ def generate(

if __name__ == "__main__":
# Generate a Delwaq model from the default Ribasim model
repo_dir = delwaq_dir.parents[1]
toml_path = repo_dir / "generated_testmodels/basic/ribasim.toml"
graph, substances = generate(toml_path)
toml_path = Path(sys.argv[1])
graph, substances = generate(toml_path, toml_path.parent / "delwaq")

Check warning on line 497 in python/ribasim/ribasim/delwaq/generate.py

View check run for this annotation

Codecov / codecov/patch

python/ribasim/ribasim/delwaq/generate.py#L496-L497

Added lines #L496 - L497 were not covered by tests

0 comments on commit 9fdaba6

Please sign in to comment.