Skip to content
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

Add pixi command to generate delwaq input for a given model #1895

Merged
merged 1 commit into from
Oct 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@

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