diff --git a/pixi.toml b/pixi.toml index fb6cd1061..89afb7452 100644 --- a/pixi.toml +++ b/pixi.toml @@ -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 = [ diff --git a/python/ribasim/ribasim/delwaq/generate.py b/python/ribasim/ribasim/delwaq/generate.py index 84317c86f..f3b197431 100644 --- a/python/ribasim/ribasim/delwaq/generate.py +++ b/python/ribasim/ribasim/delwaq/generate.py @@ -2,6 +2,7 @@ import csv import shutil +import sys from datetime import timedelta from pathlib import Path @@ -21,8 +22,7 @@ jinja2 = MissingOptionalModule("jinja2", "delwaq") # type: ignore import ribasim - -from .util import ( +from ribasim.delwaq.util import ( strfdelta, ugrid, write_flows, @@ -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")