diff --git a/.github/workflows/core_compat_helper.yml b/.github/workflows/core_compat_helper.yml
index 6db7c8918..c2e96be0f 100644
--- a/.github/workflows/core_compat_helper.yml
+++ b/.github/workflows/core_compat_helper.yml
@@ -38,11 +38,8 @@ jobs:
run: |
import CompatHelper
CompatHelper.main(; subdirs=[
+ ".",
"core",
- "docs",
- "build/create_binaries",
- "build/libribasim",
- "build/ribasim_cli"
])
shell: julia --color=yes {0}
env:
diff --git a/.gitignore b/.gitignore
index 56a0cdec8..7b5586e8c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -10,8 +10,8 @@ docs/build/
docs/site/
/generated_testmodels
-build/create_binaries/ribasim_cli/
-build/create_binaries/libribasim/
+build/ribasim_cli/
+build/libribasim/
JuliaSysimage.dll
LocalPreferences.toml
@@ -147,7 +147,7 @@ dmypy.json
.pyre/
/.luarc.json
-build/ribasim_cli/tests/temp/
+build/tests/temp/
python/ribasim_api/tests/temp/
report.xml
/utils/juliaup
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 02f29b113..c34f7a757 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -14,7 +14,7 @@ repos:
exclude: '.teamcity'
- id: trailing-whitespace
- repo: https://github.com/astral-sh/ruff-pre-commit
- rev: v0.1.9
+ rev: v0.1.15
hooks:
- id: ruff
types_or: [python, pyi, jupyter]
@@ -26,6 +26,6 @@ repos:
hooks:
- id: nbstripout
- repo: https://github.com/crate-ci/typos
- rev: v1.16.26
+ rev: v1.17.2
hooks:
- id: typos
diff --git a/.teamcity/Ribasim_Linux/buildTypes/Ribasim_Linux_BuildLibribasim.xml b/.teamcity/Ribasim_Linux/buildTypes/Ribasim_Linux_BuildLibribasim.xml
index 21460aa82..f0595b117 100644
--- a/.teamcity/Ribasim_Linux/buildTypes/Ribasim_Linux_BuildLibribasim.xml
+++ b/.teamcity/Ribasim_Linux/buildTypes/Ribasim_Linux_BuildLibribasim.xml
@@ -4,7 +4,7 @@
-
+
@@ -49,31 +49,7 @@ pixi run build-libribasim]]>
-
-
-
-
-+:v*]]>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
diff --git a/.teamcity/Ribasim_Linux/buildTypes/Ribasim_Linux_BuildRibasimCli.xml b/.teamcity/Ribasim_Linux/buildTypes/Ribasim_Linux_BuildRibasimCli.xml
index f203da184..68b1c7c42 100644
--- a/.teamcity/Ribasim_Linux/buildTypes/Ribasim_Linux_BuildRibasimCli.xml
+++ b/.teamcity/Ribasim_Linux/buildTypes/Ribasim_Linux_BuildRibasimCli.xml
@@ -4,7 +4,7 @@
-
+
@@ -42,7 +42,7 @@ pixi run build-ribasim-cli]]>
-
+
@@ -56,31 +56,7 @@ pixi run build-ribasim-cli]]>
-
-
-
-
-+:v*]]>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
diff --git a/.teamcity/Ribasim_Linux/buildTypes/Ribasim_Linux_TestRibasimApi.xml b/.teamcity/Ribasim_Linux/buildTypes/Ribasim_Linux_TestRibasimApi.xml
index 8ba314363..e3f2982d9 100644
--- a/.teamcity/Ribasim_Linux/buildTypes/Ribasim_Linux_TestRibasimApi.xml
+++ b/.teamcity/Ribasim_Linux/buildTypes/Ribasim_Linux_TestRibasimApi.xml
@@ -49,11 +49,27 @@ pixi run test-ribasim-api]]>
-
+
-
-
-
+
++:v*]]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -76,10 +92,19 @@ pixi run test-ribasim-api]]>
-
-
+
+
+
+
+
+
+
+
+
+
+
diff --git a/.teamcity/Ribasim_Linux/buildTypes/Ribasim_Linux_TestRibasimCli.xml b/.teamcity/Ribasim_Linux/buildTypes/Ribasim_Linux_TestRibasimCli.xml
index 2fd093858..6ea08f763 100644
--- a/.teamcity/Ribasim_Linux/buildTypes/Ribasim_Linux_TestRibasimCli.xml
+++ b/.teamcity/Ribasim_Linux/buildTypes/Ribasim_Linux_TestRibasimCli.xml
@@ -4,7 +4,7 @@
-
+
@@ -49,11 +49,27 @@ pixi run test-ribasim-cli]]>
-
+
-
-
-
+
++:v*]]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -76,10 +92,19 @@ pixi run test-ribasim-cli]]>
-
-
+
+
+
+
+
+
+
+
+
+
+
diff --git a/.teamcity/Ribasim_Windows/buildTypes/Ribasim_Windows_BuildLibribasim.xml b/.teamcity/Ribasim_Windows/buildTypes/Ribasim_Windows_BuildLibribasim.xml
index 72138fa0d..da602fdf4 100644
--- a/.teamcity/Ribasim_Windows/buildTypes/Ribasim_Windows_BuildLibribasim.xml
+++ b/.teamcity/Ribasim_Windows/buildTypes/Ribasim_Windows_BuildLibribasim.xml
@@ -4,7 +4,7 @@
-
+
@@ -37,31 +37,7 @@ pixi run build-libribasim]]>
-
-
-
-
-+:v*]]>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
diff --git a/.teamcity/Ribasim_Windows/buildTypes/Ribasim_Windows_BuildRibasimCli.xml b/.teamcity/Ribasim_Windows/buildTypes/Ribasim_Windows_BuildRibasimCli.xml
index 42403143f..031915d93 100644
--- a/.teamcity/Ribasim_Windows/buildTypes/Ribasim_Windows_BuildRibasimCli.xml
+++ b/.teamcity/Ribasim_Windows/buildTypes/Ribasim_Windows_BuildRibasimCli.xml
@@ -4,7 +4,7 @@
-
+
@@ -30,7 +30,7 @@ pixi run build-ribasim-cli]]>
-
+
@@ -44,31 +44,7 @@ pixi run build-ribasim-cli]]>
-
-
-
-
-+:v*]]>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
diff --git a/.teamcity/Ribasim_Windows/buildTypes/Ribasim_Windows_TestRibasimApi.xml b/.teamcity/Ribasim_Windows/buildTypes/Ribasim_Windows_TestRibasimApi.xml
index 6c485d086..a10c6af45 100644
--- a/.teamcity/Ribasim_Windows/buildTypes/Ribasim_Windows_TestRibasimApi.xml
+++ b/.teamcity/Ribasim_Windows/buildTypes/Ribasim_Windows_TestRibasimApi.xml
@@ -37,11 +37,27 @@
-
+
-
-
-
+
++:v*]]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -65,10 +81,19 @@
-
-
+
+
+
+
+
+
+
+
+
+
+
diff --git a/.teamcity/Ribasim_Windows/buildTypes/Ribasim_Windows_TestRibasimCli.xml b/.teamcity/Ribasim_Windows/buildTypes/Ribasim_Windows_TestRibasimCli.xml
index 67dd0f46f..ccd2e426f 100644
--- a/.teamcity/Ribasim_Windows/buildTypes/Ribasim_Windows_TestRibasimCli.xml
+++ b/.teamcity/Ribasim_Windows/buildTypes/Ribasim_Windows_TestRibasimCli.xml
@@ -4,7 +4,7 @@
-
+
@@ -37,11 +37,27 @@
-
+
-
-
-
+
++:v*]]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -65,10 +81,19 @@
-
-
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Manifest.toml b/Manifest.toml
index f161f91e0..4b4538c67 100644
--- a/Manifest.toml
+++ b/Manifest.toml
@@ -2,7 +2,7 @@
julia_version = "1.10.0"
manifest_format = "2.0"
-project_hash = "1a68754569dae741c9232c9ae2db3512f52c2b80"
+project_hash = "7e18cea33bf679231c5c94c6b99a1b635f9a1b61"
[[deps.ADTypes]]
git-tree-sha1 = "41c37aa88889c171f1300ceac1313c06e891d245"
@@ -150,9 +150,9 @@ version = "0.2.4"
[[deps.ChainRulesCore]]
deps = ["Compat", "LinearAlgebra"]
-git-tree-sha1 = "c1deebd76f7a443d527fc0430d5758b8b2112ed8"
+git-tree-sha1 = "1287e3872d646eed95198457873249bd9f0caed2"
uuid = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4"
-version = "1.19.1"
+version = "1.20.1"
weakdeps = ["SparseArrays"]
[deps.ChainRulesCore.extensions]
@@ -172,9 +172,9 @@ version = "1.3.5"
[[deps.CodecBzip2]]
deps = ["Bzip2_jll", "Libdl", "TranscodingStreams"]
-git-tree-sha1 = "c0ae2a86b162fb5d7acc65269b469ff5b8a73594"
+git-tree-sha1 = "9b1ca1aa6ce3f71b3d1840c538a8210a043625eb"
uuid = "523fee87-0ab8-5b00-afb7-3ecf72e48cfd"
-version = "0.8.1"
+version = "0.8.2"
[[deps.CodecLz4]]
deps = ["Lz4_jll", "TranscodingStreams"]
@@ -184,9 +184,9 @@ version = "0.4.1"
[[deps.CodecZlib]]
deps = ["TranscodingStreams", "Zlib_jll"]
-git-tree-sha1 = "cd67fc487743b2f0fd4380d4cbd3a24660d0eec8"
+git-tree-sha1 = "59939d8a997469ee05c4b4944560a820f9ba0d73"
uuid = "944b1d66-785c-5afd-91f1-9de20f533193"
-version = "0.7.3"
+version = "0.7.4"
[[deps.CodecZstd]]
deps = ["TranscodingStreams", "Zstd_jll"]
@@ -355,9 +355,9 @@ uuid = "ade2ca70-3891-5945-98fb-dc099432e06a"
[[deps.Dictionaries]]
deps = ["Indexing", "Random", "Serialization"]
-git-tree-sha1 = "5bde104a45593207307e1481a58e0339d4643fca"
+git-tree-sha1 = "8b73c5a704d74e78a114b785d648ceba1e5790a9"
uuid = "85a47980-9c8c-11e8-2b9f-f7ca1fa99fb4"
-version = "0.3.26"
+version = "0.4.0"
[[deps.DiffEqBase]]
deps = ["ArrayInterface", "DataStructures", "DocStringExtensions", "EnumX", "EnzymeCore", "FastBroadcast", "ForwardDiff", "FunctionWrappers", "FunctionWrappersWrappers", "LinearAlgebra", "Logging", "Markdown", "MuladdMacro", "Parameters", "PreallocationTools", "PrecompileTools", "Printf", "RecursiveArrayTools", "Reexport", "SciMLBase", "SciMLOperators", "Setfield", "SparseArrays", "Static", "StaticArraysCore", "Statistics", "Tricks", "TruncatedStacktraces"]
@@ -497,9 +497,9 @@ version = "0.3.2"
[[deps.FastLapackInterface]]
deps = ["LinearAlgebra"]
-git-tree-sha1 = "b12f05108e405dadcc2aff0008db7f831374e051"
+git-tree-sha1 = "d576a29bf8bcabf4b1deb9abe88a3d7f78306ab5"
uuid = "29a986be-02c6-4525-aec4-84b980013641"
-version = "2.0.0"
+version = "2.0.1"
[[deps.FileIO]]
deps = ["Pkg", "Requires", "UUIDs"]
@@ -939,9 +939,9 @@ version = "1.1.0"
[[deps.MathOptInterface]]
deps = ["BenchmarkTools", "CodecBzip2", "CodecZlib", "DataStructures", "ForwardDiff", "JSON", "LinearAlgebra", "MutableArithmetics", "NaNMath", "OrderedCollections", "PrecompileTools", "Printf", "SparseArrays", "SpecialFunctions", "Test", "Unicode"]
-git-tree-sha1 = "e2ae8cf5ac6daf5a3959f7f6ded9c2028b61d09d"
+git-tree-sha1 = "8b40681684df46785a0012d352982e22ac3be59e"
uuid = "b8f27783-ece8-5eb3-8dc8-9495eed66fee"
-version = "1.25.1"
+version = "1.25.2"
[[deps.MatrixFactorizations]]
deps = ["ArrayLayouts", "LinearAlgebra", "Printf", "Random"]
@@ -1026,9 +1026,9 @@ version = "1.2.0"
[[deps.NonlinearSolve]]
deps = ["ADTypes", "ArrayInterface", "ConcreteStructs", "DiffEqBase", "FastBroadcast", "FastClosures", "FiniteDiff", "ForwardDiff", "LazyArrays", "LineSearches", "LinearAlgebra", "LinearSolve", "MaybeInplace", "PrecompileTools", "Preferences", "Printf", "RecursiveArrayTools", "Reexport", "SciMLBase", "SimpleNonlinearSolve", "SparseArrays", "SparseDiffTools", "StaticArraysCore", "TimerOutputs"]
-git-tree-sha1 = "78bdd3a4a62865cf43c53d63783b0cbfddcdbbe6"
+git-tree-sha1 = "323d2a61f4adc4dfe404bf332b59690253b4f4f2"
uuid = "8913a72c-1f9b-4ce2-8d82-65094dcecaec"
-version = "3.5.0"
+version = "3.5.3"
[deps.NonlinearSolve.extensions]
NonlinearSolveBandedMatricesExt = "BandedMatrices"
@@ -1086,9 +1086,9 @@ version = "1.6.3"
[[deps.OrdinaryDiffEq]]
deps = ["ADTypes", "Adapt", "ArrayInterface", "DataStructures", "DiffEqBase", "DocStringExtensions", "ExponentialUtilities", "FastBroadcast", "FastClosures", "FillArrays", "FiniteDiff", "ForwardDiff", "FunctionWrappersWrappers", "IfElse", "InteractiveUtils", "LineSearches", "LinearAlgebra", "LinearSolve", "Logging", "MacroTools", "MuladdMacro", "NonlinearSolve", "Polyester", "PreallocationTools", "PrecompileTools", "Preferences", "RecursiveArrayTools", "Reexport", "SciMLBase", "SciMLOperators", "SimpleNonlinearSolve", "SimpleUnPack", "SparseArrays", "SparseDiffTools", "StaticArrayInterface", "StaticArrays", "TruncatedStacktraces"]
-git-tree-sha1 = "7c6738f21fba2ccd07b7eaa9d23b437a8a97f1a1"
+git-tree-sha1 = "c971a69e5eea2eba435b55e962c283f15502a0c8"
uuid = "1dea7af3-3e70-54e6-95c3-0bf5283fa5ed"
-version = "6.69.0"
+version = "6.70.0"
[[deps.PackageCompiler]]
deps = ["Artifacts", "Glob", "LazyArtifacts", "Libdl", "Pkg", "Printf", "RelocatableFolders", "TOML", "UUIDs", "p7zip_jll"]
@@ -1191,9 +1191,9 @@ uuid = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
[[deps.ReTestItems]]
deps = ["Dates", "Logging", "LoggingExtras", "Pkg", "Serialization", "Sockets", "Test", "TestEnv"]
-git-tree-sha1 = "68a7d4fd86f12c2fc6dec60d566f033a10ffb5fb"
+git-tree-sha1 = "32138ef9f7205330693b0e8e366370c470b2285d"
uuid = "817f1d60-ba6b-4fd5-9520-3cf149f6a823"
-version = "1.23.0"
+version = "1.23.1"
[[deps.RecipesBase]]
deps = ["PrecompileTools"]
@@ -1203,14 +1203,15 @@ version = "1.3.4"
[[deps.RecursiveArrayTools]]
deps = ["Adapt", "ArrayInterface", "DocStringExtensions", "GPUArraysCore", "IteratorInterfaceExtensions", "LinearAlgebra", "RecipesBase", "SparseArrays", "StaticArraysCore", "Statistics", "SymbolicIndexingInterface", "Tables"]
-git-tree-sha1 = "dd7fc1923fde0cc6cdff451352d17924b0704ca1"
+git-tree-sha1 = "5a904ad526cc9a2c5b464f6642ce9dd230fd69b6"
uuid = "731186ca-8d62-57ce-b412-fbd966d074cd"
-version = "3.5.4"
+version = "3.7.0"
[deps.RecursiveArrayTools.extensions]
RecursiveArrayToolsFastBroadcastExt = "FastBroadcast"
RecursiveArrayToolsMeasurementsExt = "Measurements"
RecursiveArrayToolsMonteCarloMeasurementsExt = "MonteCarloMeasurements"
+ RecursiveArrayToolsReverseDiffExt = ["ReverseDiff", "Zygote"]
RecursiveArrayToolsTrackerExt = "Tracker"
RecursiveArrayToolsZygoteExt = "Zygote"
@@ -1218,6 +1219,7 @@ version = "3.5.4"
FastBroadcast = "7034ab61-46d4-4ed7-9d0f-46aef9175898"
Measurements = "eff96d63-e80a-5855-80a2-b1b0885c5ab7"
MonteCarloMeasurements = "0987c9cc-fe09-11e8-30f0-b96dd679fdca"
+ ReverseDiff = "37e2e3b7-166d-5795-8a7a-e32c996b4267"
Tracker = "9f7883ad-71c0-57eb-9f7f-b5c9e6d3789c"
Zygote = "e88e6eb3-aa80-5325-afca-941959d7151f"
@@ -1285,15 +1287,15 @@ version = "1.6.0"
[[deps.SQLite_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Zlib_jll"]
-git-tree-sha1 = "81f7d934b52b2441f7b44520bd982fdb3607b0da"
+git-tree-sha1 = "75e28667a36b5650b5cc4baa266c5760c3672275"
uuid = "76ed43ae-9a5d-5a62-8c75-30186b810ce8"
-version = "3.43.0+0"
+version = "3.45.0+0"
[[deps.SciMLBase]]
deps = ["ADTypes", "ArrayInterface", "CommonSolve", "ConstructionBase", "Distributed", "DocStringExtensions", "EnumX", "FillArrays", "FunctionWrappersWrappers", "IteratorInterfaceExtensions", "LinearAlgebra", "Logging", "Markdown", "PrecompileTools", "Preferences", "Printf", "RecipesBase", "RecursiveArrayTools", "Reexport", "RuntimeGeneratedFunctions", "SciMLOperators", "StaticArraysCore", "Statistics", "SymbolicIndexingInterface", "Tables", "TruncatedStacktraces"]
-git-tree-sha1 = "de41474ac529bf81598e064587421cc5ebc28fa0"
+git-tree-sha1 = "e4344257d8a9dfc92e0fc113f0a5bababa8d2082"
uuid = "0bca4576-84f4-4d90-8ffe-ffa030f20462"
-version = "2.20.0"
+version = "2.22.0"
[deps.SciMLBase.extensions]
SciMLBaseChainRulesCoreExt = "ChainRulesCore"
@@ -1441,9 +1443,9 @@ weakdeps = ["OffsetArrays", "StaticArrays"]
[[deps.StaticArrays]]
deps = ["LinearAlgebra", "PrecompileTools", "Random", "StaticArraysCore"]
-git-tree-sha1 = "f68dd04d131d9a8a8eb836173ee8f105c360b0c5"
+git-tree-sha1 = "7b0e9c14c624e435076d19aea1e5cbdec2b9ca37"
uuid = "90137ffa-7385-5640-81b9-e52037218182"
-version = "1.9.1"
+version = "1.9.2"
weakdeps = ["ChainRulesCore", "Statistics"]
[deps.StaticArrays.extensions]
@@ -1500,9 +1502,9 @@ uuid = "bea87d4a-7f5b-5778-9afe-8cc45184846c"
version = "7.2.1+1"
[[deps.SymbolicIndexingInterface]]
-git-tree-sha1 = "74502f408d99fc217a9d7cd901d9ffe45af892b1"
+git-tree-sha1 = "b3103f4f50a3843e66297a2456921377c78f5e31"
uuid = "2efcf032-c050-4f8e-a9bb-153293bab1f5"
-version = "0.3.3"
+version = "0.3.5"
[[deps.TOML]]
deps = ["Dates"]
@@ -1511,9 +1513,9 @@ version = "1.0.3"
[[deps.TZJData]]
deps = ["Artifacts"]
-git-tree-sha1 = "d39314cdbaf5b90a047db33858626f8d1cc973e1"
+git-tree-sha1 = "b69f8338df046774bd975b13be9d297eca5efacb"
uuid = "dc5dba14-91b3-4cab-a142-028a31da12f7"
-version = "1.0.0+2023c"
+version = "1.1.0+2023d"
[[deps.TableTraits]]
deps = ["IteratorInterfaceExtensions"]
@@ -1656,23 +1658,11 @@ git-tree-sha1 = "49ce682769cd5de6c72dcf1b94ed7790cd08974c"
uuid = "3161d3a3-bdf6-5164-811a-617609db77b4"
version = "1.5.5+0"
-[[deps.create_binaries]]
-deps = ["Artifacts", "LibGit2", "PackageCompiler", "TOML", "TimeZones"]
-path = "build/create_binaries"
-uuid = "3cfb6a46-05f0-43df-bb16-bf763deb14b4"
-version = "0.1.0"
-
[[deps.libblastrampoline_jll]]
deps = ["Artifacts", "Libdl"]
uuid = "8e850b90-86db-534c-a0d3-1478176c7d93"
version = "5.8.0+1"
-[[deps.libribasim]]
-deps = ["BasicModelInterface", "Dates", "Ribasim", "TOML"]
-path = "build/libribasim"
-uuid = "f319f290-633d-4573-adfe-d6d5548b6388"
-version = "0.1.0"
-
[[deps.libsodium_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"]
git-tree-sha1 = "848ab3d00fe39d6fbc2a8641048f8f272af1c51e"
@@ -1688,9 +1678,3 @@ version = "1.52.0+1"
deps = ["Artifacts", "Libdl"]
uuid = "3f19e933-33d8-53b3-aaab-bd5110c3b7a0"
version = "17.4.0+2"
-
-[[deps.ribasim_cli]]
-deps = ["Dates", "Logging", "Ribasim", "SciMLBase", "TOML", "TerminalLoggers"]
-path = "build/ribasim_cli"
-uuid = "e45c999e-e944-4589-a8e6-7d0b7a60140a"
-version = "0.1.0"
diff --git a/Project.toml b/Project.toml
index ec9276c94..7c06c834c 100644
--- a/Project.toml
+++ b/Project.toml
@@ -3,37 +3,62 @@ authors = ["Deltares and contributors "]
description = "Meta-project used to share the Manifest of Ribasim and its dependents"
[deps]
+Accessors = "7d9f7c33-5ae7-4f3b-8dc6-eff91059b697"
Arrow = "69666777-d1a9-59fb-9406-91d4454c9d45"
+Artifacts = "56f22d72-fd6d-98f1-02f0-08ddc0907c33"
BasicModelInterface = "59605e27-edc0-445a-b93d-c09a3a50b330"
+CodecLz4 = "5ba52731-8f18-5e0d-9241-30f10d1ec561"
+CodecZstd = "6b39b394-51ab-5f42-8807-6242bab2b4c2"
+ComponentArrays = "b0b7db55-cfe3-40fc-9ded-d10e2dbeff66"
Configurations = "5218b696-f38b-4ac9-8b61-a12ec717816d"
+DBInterface = "a10d1c49-ce27-4219-8d33-6db1a4562965"
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
+DataInterpolations = "82cc6244-b520-54b8-b5a6-8a565e85f1d0"
+DataStructures = "864edb3b-99cc-5e75-8d2d-829cb0a9cfe8"
Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"
+Dictionaries = "85a47980-9c8c-11e8-2b9f-f7ca1fa99fb4"
+DiffEqCallbacks = "459566f4-90b8-5000-8ac3-15dfb0a30def"
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
DocumenterMarkdown = "997ab1e6-3595-5248-9280-8efb232c3433"
+EnumX = "4e289a0a-7415-4d19-859d-a7e5c4648b56"
+FiniteDiff = "6a86dc24-6348-571c-b903-95158fe2bd41"
+ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210"
Graphs = "86223c79-3864-5bf0-83f7-82e725a168b6"
+HiGHS = "87dc4568-4c63-4d18-b0c0-bb2238e4078b"
IJulia = "7073ff75-c697-5162-941a-fcdaad2a7d2a"
Infiltrator = "5903a43b-9cc3-4c30-8d17-598619ec4e9b"
InteractiveUtils = "b77e0a4c-d291-57a0-90e8-8db25a27a240"
+IterTools = "c8e1da08-722c-5040-9ed9-7db0dc04731e"
JSON3 = "0f8b85d8-7281-11e9-16c2-39a750bddbf1"
+JuMP = "4076af6c-e467-56ae-b986-b466b2749572"
Legolas = "741b9549-f6ed-4911-9fbf-4a1c0c97f0cd"
+LibGit2 = "76f85450-5226-5b5a-8eaa-529ad045b433"
Logging = "56ddb016-857b-54e1-b83d-db4d58db5568"
+LoggingExtras = "e6f89c97-d47a-5376-807f-9c37f3926c36"
MarkdownTables = "1862ce21-31c7-451e-824c-f20fa3f90fa2"
MetaGraphsNext = "fa8bd995-216d-47f1-8a91-f3b68fbeb377"
OrderedCollections = "bac558e1-5e72-5ebc-8fee-abe8a469f55d"
OrdinaryDiffEq = "1dea7af3-3e70-54e6-95c3-0bf5283fa5ed"
+PackageCompiler = "9b87118b-4619-50d2-8e1e-99f35a4d4d9d"
+PreallocationTools = "d236fae5-4411-538c-8e31-a6e3d9e00b46"
ReTestItems = "817f1d60-ba6b-4fd5-9520-3cf149f6a823"
Revise = "295af30f-e4ad-537b-8983-00126c2a3abe"
Ribasim = "aac5e3d9-0b8f-4d4f-8241-b1a7a9632635"
SQLite = "0aa819cd-b072-5ff4-a722-6bc24af294d9"
SciMLBase = "0bca4576-84f4-4d90-8ffe-ffa030f20462"
+SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
+StructArrays = "09ab397b-f2b6-538f-b94a-2f83cf4a842a"
+TOML = "fa267f1f-6049-4f14-aa54-33bafae1ed76"
Tables = "bd369af6-aec1-5ad0-b16a-f7cc5008161c"
+TerminalLoggers = "5d786b92-1e48-4d6f-9151-6b4477ca9bed"
TestEnv = "1e6cf692-eddd-4d53-88a5-2d735e33781b"
TimeZones = "f269a46b-ccf7-5d73-abea-4c690281aa53"
-create_binaries = "3cfb6a46-05f0-43df-bb16-bf763deb14b4"
-libribasim = "f319f290-633d-4573-adfe-d6d5548b6388"
-ribasim_cli = "e45c999e-e944-4589-a8e6-7d0b7a60140a"
+TimerOutputs = "a759f4b9-e2f1-59dc-863e-4aeb61b1ea8f"
+TranscodingStreams = "3bb67fe8-82b1-5028-8e26-92a6c54297fa"
[compat]
+Artifacts = "<0.0.1,1"
+BasicModelInterface = "0.1"
Configurations = "0.17"
DataFrames = "1"
Dates = "<0.0.1,1"
@@ -43,7 +68,12 @@ IJulia = "1"
InteractiveUtils = "<0.0.1,1"
JSON3 = "1.12"
Legolas = "0.5"
+LibGit2 = "<0.0.1,1"
Logging = "<0.0.1,1"
MarkdownTables = "1"
OrderedCollections = "1.6"
+PackageCompiler = "2"
+TOML = "<0.0.1,1"
+TerminalLoggers = "0.1.7"
+TimeZones = "=1.14.0, 1"
julia = "1.10"
diff --git a/build/create_binaries/README.md b/build/README.md
similarity index 100%
rename from build/create_binaries/README.md
rename to build/README.md
diff --git a/build/create_binaries/build.jl b/build/build.jl
similarity index 69%
rename from build/create_binaries/build.jl
rename to build/build.jl
index 9c27c6e84..f19181825 100644
--- a/build/create_binaries/build.jl
+++ b/build/build.jl
@@ -1,4 +1,11 @@
-using create_binaries
+using Artifacts
+using PackageCompiler
+using TOML
+using LibGit2
+
+include("src/add_metadata.jl")
+include("src/create_app.jl")
+include("src/create_lib.jl")
"""
Build the Ribasim CLI, libribasim, or both, using PackageCompiler.
diff --git a/build/create_binaries/Project.toml b/build/create_binaries/Project.toml
deleted file mode 100644
index aef92c80d..000000000
--- a/build/create_binaries/Project.toml
+++ /dev/null
@@ -1,21 +0,0 @@
-name = "create_binaries"
-uuid = "3cfb6a46-05f0-43df-bb16-bf763deb14b4"
-authors = ["Deltares and contributors "]
-description = "Build Ribasim binaries with PackageCompiler"
-manifest = "../../Manifest.toml"
-version = "0.1.0"
-
-[deps]
-Artifacts = "56f22d72-fd6d-98f1-02f0-08ddc0907c33"
-LibGit2 = "76f85450-5226-5b5a-8eaa-529ad045b433"
-PackageCompiler = "9b87118b-4619-50d2-8e1e-99f35a4d4d9d"
-TOML = "fa267f1f-6049-4f14-aa54-33bafae1ed76"
-TimeZones = "f269a46b-ccf7-5d73-abea-4c690281aa53"
-
-[compat]
-Artifacts = "<0.0.1,1"
-LibGit2 = "<0.0.1,1"
-PackageCompiler = "2"
-TOML = "<0.0.1,1"
-TimeZones = "=1.14.0, 1"
-julia = "1.10"
diff --git a/build/create_binaries/src/create_app.jl b/build/create_binaries/src/create_app.jl
deleted file mode 100644
index 056dc5b7b..000000000
--- a/build/create_binaries/src/create_app.jl
+++ /dev/null
@@ -1,32 +0,0 @@
-"Build the Ribasim CLI using PackageCompiler"
-function build_app()
- project_dir = "../ribasim_cli"
- license_file = "../../LICENSE"
- output_dir = "ribasim_cli"
- git_repo = "../.."
-
- create_app(
- project_dir,
- output_dir;
- # map from binary name to julia function name
- executables = ["ribasim" => "julia_main"],
- precompile_execution_file = "precompile.jl",
- include_lazy_artifacts = true,
- force = true,
- )
-
- add_metadata(project_dir, license_file, output_dir, git_repo)
-
- # On Windows, write ribasim.cmd in the output_dir, that starts ribasim.exe.
- # Since the bin dir contains a julia.exe and many DLLs that you may not want in your path,
- # with this script you can put output_dir in your path instead.
- if Sys.iswindows()
- cmd = raw"""
- @echo off
- "%~dp0bin\ribasim.exe" %*
- """
- open(normpath(output_dir, "ribasim.cmd"); write = true) do io
- print(io, cmd)
- end
- end
-end
diff --git a/build/create_binaries/src/create_binaries.jl b/build/create_binaries/src/create_binaries.jl
deleted file mode 100644
index 24082d8ef..000000000
--- a/build/create_binaries/src/create_binaries.jl
+++ /dev/null
@@ -1,14 +0,0 @@
-module create_binaries
-
-using Artifacts
-using PackageCompiler
-using TOML
-using LibGit2
-
-export build_app, build_lib
-
-include("add_metadata.jl")
-include("create_app.jl")
-include("create_lib.jl")
-
-end
diff --git a/build/create_binaries/src/create_lib.jl b/build/create_binaries/src/create_lib.jl
deleted file mode 100644
index 8e8b01a31..000000000
--- a/build/create_binaries/src/create_lib.jl
+++ /dev/null
@@ -1,18 +0,0 @@
-"Build libribasim using PackageCompiler"
-function build_lib()
- project_dir = "../libribasim"
- license_file = "../../LICENSE"
- output_dir = "libribasim"
- git_repo = "../.."
-
- create_library(
- project_dir,
- output_dir;
- lib_name = "libribasim",
- precompile_execution_file = "precompile.jl",
- include_lazy_artifacts = true,
- force = true,
- )
-
- add_metadata(project_dir, license_file, output_dir, git_repo)
-end
diff --git a/build/libribasim/Project.toml b/build/libribasim/Project.toml
deleted file mode 100644
index 2b7700197..000000000
--- a/build/libribasim/Project.toml
+++ /dev/null
@@ -1,17 +0,0 @@
-name = "libribasim"
-uuid = "f319f290-633d-4573-adfe-d6d5548b6388"
-authors = ["Deltares and contributors "]
-manifest = "../../Manifest.toml"
-version = "0.1.0"
-
-[deps]
-BasicModelInterface = "59605e27-edc0-445a-b93d-c09a3a50b330"
-Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"
-Ribasim = "aac5e3d9-0b8f-4d4f-8241-b1a7a9632635"
-TOML = "fa267f1f-6049-4f14-aa54-33bafae1ed76"
-
-[compat]
-BasicModelInterface = "0.1"
-Dates = "<0.0.1,1"
-TOML = "<0.0.1,1"
-julia = "1.10"
diff --git a/build/create_binaries/precompile.jl b/build/precompile.jl
similarity index 80%
rename from build/create_binaries/precompile.jl
rename to build/precompile.jl
index 73cd6c6f2..b12cc0ce8 100644
--- a/build/create_binaries/precompile.jl
+++ b/build/precompile.jl
@@ -1,7 +1,7 @@
# Workflow that will compile a lot of the code we will need.
# With the purpose of reducing the latency for compiled binaries.
-using Ribasim, Dates, TOML
+using Ribasim
toml_path = normpath(@__DIR__, "../../generated_testmodels/basic/ribasim.toml")
-Ribasim.run(toml_path)
+Ribasim.main(toml_path)
diff --git a/build/ribasim_cli/Project.toml b/build/ribasim_cli/Project.toml
deleted file mode 100644
index 728a085ca..000000000
--- a/build/ribasim_cli/Project.toml
+++ /dev/null
@@ -1,21 +0,0 @@
-name = "ribasim_cli"
-uuid = "e45c999e-e944-4589-a8e6-7d0b7a60140a"
-authors = ["Deltares and contributors "]
-manifest = "../../Manifest.toml"
-version = "0.1.0"
-
-[deps]
-Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"
-Logging = "56ddb016-857b-54e1-b83d-db4d58db5568"
-Ribasim = "aac5e3d9-0b8f-4d4f-8241-b1a7a9632635"
-SciMLBase = "0bca4576-84f4-4d90-8ffe-ffa030f20462"
-TOML = "fa267f1f-6049-4f14-aa54-33bafae1ed76"
-TerminalLoggers = "5d786b92-1e48-4d6f-9151-6b4477ca9bed"
-
-[compat]
-Dates = "<0.0.1,1"
-Logging = "<0.0.1,1"
-SciMLBase = "1.60, 2"
-TOML = "<0.0.1,1"
-TerminalLoggers = "0.1.7"
-julia = "1.10"
diff --git a/build/ribasim_cli/README.md b/build/ribasim_cli/README.md
deleted file mode 100644
index b51c5e27f..000000000
--- a/build/ribasim_cli/README.md
+++ /dev/null
@@ -1,23 +0,0 @@
-# Ribasim CLI
-
-This is a [Julia](https://julialang.org/) project that uses the
-[Ribasim](https://github.com/Deltares/Ribasim) Julia package, puts a simple command line
-interface (cli) on top, and packages this into a standalone application using
-[PackageCompiler.jl](https://github.com/JuliaLang/PackageCompiler.jl).
-
-This enables using Ribasim without having to install Julia, and thus makes it more
-convenient to use in certain settings where installation must be simple and no interactive
-Julia session is needed.
-
-If you have installed Julia and Ribasim, a simulation can also be started from the command
-line as follows:
-
-```
-julia --eval 'using Ribasim; Ribasim.run("path/to/model/ribasim.toml")'
-```
-
-With a Ribasim CLI build this becomes:
-
-```
-ribasim path/to/model/ribasim.toml
-```
diff --git a/build/ribasim_cli/src/ribasim_cli.jl b/build/ribasim_cli/src/ribasim_cli.jl
deleted file mode 100644
index 6e28f8507..000000000
--- a/build/ribasim_cli/src/ribasim_cli.jl
+++ /dev/null
@@ -1,7 +0,0 @@
-module ribasim_cli
-
-using Ribasim
-
-julia_main()::Cint = Ribasim.main(ARGS)
-
-end # module
diff --git a/build/create_binaries/src/add_metadata.jl b/build/src/add_metadata.jl
similarity index 94%
rename from build/create_binaries/src/add_metadata.jl
rename to build/src/add_metadata.jl
index 27f3585ce..45e2ed836 100644
--- a/build/create_binaries/src/add_metadata.jl
+++ b/build/src/add_metadata.jl
@@ -7,7 +7,7 @@ Add the following metadata files to the newly created build:
- README.md
- LICENSE
"""
-function add_metadata(project_dir, license_file, output_dir, git_repo)
+function add_metadata(project_dir, license_file, output_dir, git_repo, readme)
# save some environment variables in a Build.toml file for debugging purposes
vars = ["BUILD_NUMBER", "BUILD_VCS_NUMBER"]
dict = Dict(var => ENV[var] for var in vars if haskey(ENV, var))
@@ -31,8 +31,9 @@ function add_metadata(project_dir, license_file, output_dir, git_repo)
# put the LICENSE in the top level directory
cp(license_file, normpath(output_dir, "LICENSE"); force = true)
- cp(normpath(project_dir, "README.md"), normpath(output_dir, "README.md"); force = true)
- open(normpath(output_dir, "README.md"), "a") do io
+ open(normpath(output_dir, "README.md"), "w") do io
+ println(io, readme)
+
# since the exact Ribasim version may be hard to find in the Manifest.toml file
# we can also extract that information, and add it to the README.md
manifest = TOML.parsefile(normpath(git_repo, "Manifest.toml"))
diff --git a/build/src/create_app.jl b/build/src/create_app.jl
new file mode 100644
index 000000000..90da2d131
--- /dev/null
+++ b/build/src/create_app.jl
@@ -0,0 +1,57 @@
+"""
+# Ribasim CLI
+
+This is a [Julia](https://julialang.org/) project that uses the
+[Ribasim](https://github.com/Deltares/Ribasim) Julia package, puts a simple command line
+interface (cli) on top, and packages this into a standalone application using
+[PackageCompiler.jl](https://github.com/JuliaLang/PackageCompiler.jl).
+
+This enables using Ribasim without having to install Julia, and thus makes it more
+convenient to use in certain settings where installation must be simple and no interactive
+Julia session is needed.
+
+If you have installed Julia and Ribasim, a simulation can also be started from the command
+line as follows:
+
+```
+julia --eval 'using Ribasim; Ribasim.main("path/to/model/ribasim.toml")'
+```
+
+With a Ribasim CLI build this becomes:
+
+```
+ribasim path/to/model/ribasim.toml
+```
+"""
+function build_app()
+ project_dir = "../core"
+ license_file = "../LICENSE"
+ output_dir = "ribasim_cli"
+ git_repo = ".."
+
+ create_app(
+ project_dir,
+ output_dir;
+ # map from binary name to julia function name
+ executables = ["ribasim" => "main"],
+ precompile_execution_file = "precompile.jl",
+ include_lazy_artifacts = true,
+ force = true,
+ )
+
+ readme = @doc(build_app)
+ add_metadata(project_dir, license_file, output_dir, git_repo, readme)
+
+ # On Windows, write ribasim.cmd in the output_dir, that starts ribasim.exe.
+ # Since the bin dir contains a julia.exe and many DLLs that you may not want in your path,
+ # with this script you can put output_dir in your path instead.
+ if Sys.iswindows()
+ cmd = raw"""
+ @echo off
+ "%~dp0bin\ribasim.exe" %*
+ """
+ open(normpath(output_dir, "ribasim.cmd"); write = true) do io
+ print(io, cmd)
+ end
+ end
+end
diff --git a/build/libribasim/README.md b/build/src/create_lib.jl
similarity index 59%
rename from build/libribasim/README.md
rename to build/src/create_lib.jl
index 5906696a7..5044d91b8 100644
--- a/build/libribasim/README.md
+++ b/build/src/create_lib.jl
@@ -1,13 +1,14 @@
+"""
# Libribasim
Libribasim is a shared library that exposes Ribasim functionality to external (non-Julian)
programs. It can be compiled using [PackageCompiler's
-create_lib](https://julialang.github.io/PackageCompiler.jl/stable/libs.html) , which is set
-up in this directory. The C API that is offered to control Ribasim is the C API of the [Basic
-Model Interface](https://bmi.readthedocs.io/en/latest/), also known as BMI.
+create_lib](https://julialang.github.io/PackageCompiler.jl/stable/libs.html), which is set
+up in this directory. The C API that is offered to control Ribasim is the C API of the
+[Basic Model Interface](https://bmi.readthedocs.io/en/latest/), also known as BMI.
Not all BMI functions are implemented yet, this has been set up as a proof of concept to
-demonstrate that we could use other software such as
+demonstrate that we can use other software such as
[`imod_coupler`](https://github.com/Deltares/imod_coupler) to control Ribasim and couple it to
other models.
@@ -30,3 +31,22 @@ Out[5]: 0
In [6]: c_dll.update()
Out[6]: 0
```
+"""
+function build_lib()
+ project_dir = "../core"
+ license_file = "../LICENSE"
+ output_dir = "libribasim"
+ git_repo = ".."
+
+ create_library(
+ project_dir,
+ output_dir;
+ lib_name = "libribasim",
+ precompile_execution_file = "precompile.jl",
+ include_lazy_artifacts = true,
+ force = true,
+ )
+
+ readme = @doc(build_app)
+ add_metadata(project_dir, license_file, output_dir, git_repo, readme)
+end
diff --git a/build/ribasim_cli/tests/test_models.py b/build/tests/test_models.py
similarity index 83%
rename from build/ribasim_cli/tests/test_models.py
rename to build/tests/test_models.py
index 2a005c3e8..f4d23bb41 100644
--- a/build/ribasim_cli/tests/test_models.py
+++ b/build/tests/test_models.py
@@ -19,11 +19,7 @@ def test_ribasim_cli(model_constructor, tmp_path):
extension = ".exe" if platform.system() == "Windows" else ""
executable = (
- Path(__file__).parents[2]
- / "create_binaries"
- / "ribasim_cli"
- / "bin"
- / f"ribasim{extension}"
+ Path(__file__).parents[1] / "ribasim_cli" / "bin" / f"ribasim{extension}"
)
result = subprocess.run([executable, tmp_path / "ribasim.toml"])
diff --git a/core/src/Ribasim.jl b/core/src/Ribasim.jl
index 79947b8a6..ca675a366 100644
--- a/core/src/Ribasim.jl
+++ b/core/src/Ribasim.jl
@@ -44,7 +44,9 @@ using Graphs:
inneighbors,
nv,
outneighbors,
- rem_edge!
+ rem_edge!,
+ induced_subgraph,
+ is_connected
using Legolas: Legolas, @schema, @version, validate, SchemaVersion, declared
using Logging: with_logger, LogLevel, AbstractLogger
@@ -68,6 +70,8 @@ using Tables: Tables, AbstractRow, columntable, getcolumn
using TerminalLoggers: TerminalLogger
using TimerOutputs
+export libribasim
+
const to = TimerOutput()
TimerOutputs.complement!()
@@ -84,5 +88,6 @@ include("create.jl")
include("bmi.jl")
include("consts.jl")
include("main.jl")
+include("libribasim.jl")
end # module Ribasim
diff --git a/core/src/create.jl b/core/src/create.jl
index 46a5f9ada..66e331e06 100644
--- a/core/src/create.jl
+++ b/core/src/create.jl
@@ -199,6 +199,12 @@ const nonconservative_nodetypes =
function generate_allocation_models!(p::Parameters, config::Config)::Nothing
(; graph, allocation_models) = p
+ errors = non_positive_allocation_network_id(graph)
+
+ if errors
+ error("Allocation network initialization failed.")
+ end
+
for allocation_network_id in keys(graph[].node_ids)
push!(
allocation_models,
diff --git a/build/libribasim/src/libribasim.jl b/core/src/libribasim.jl
similarity index 99%
rename from build/libribasim/src/libribasim.jl
rename to core/src/libribasim.jl
index 448d68d02..e8af88f50 100644
--- a/build/libribasim/src/libribasim.jl
+++ b/core/src/libribasim.jl
@@ -1,7 +1,7 @@
module libribasim
import BasicModelInterface as BMI
-using Ribasim
+import ..Ribasim
# globals
model::Union{Ribasim.Model, Nothing} = nothing
diff --git a/core/src/main.jl b/core/src/main.jl
index fb621c0e9..465dfe4be 100644
--- a/core/src/main.jl
+++ b/core/src/main.jl
@@ -5,9 +5,13 @@ function help(x::AbstractString)::Cint
end
main(toml_path::AbstractString)::Cint = main([toml_path])
+main()::Cint = main(ARGS)
"""
+ main(toml_path::AbstractString)::Cint
main(ARGS::Vector{String})::Cint
+ main()::Cint
+
This is the main entry point of the application.
Performs argument parsing and sets up logging for both terminal and file.
Calls Ribasim.run() and handles exceptions to convert to exit codes.
diff --git a/core/src/solve.jl b/core/src/solve.jl
index f93a76ad5..2087f2f35 100644
--- a/core/src/solve.jl
+++ b/core/src/solve.jl
@@ -415,6 +415,32 @@ struct User <: AbstractParameterNode
allocated::Vector{Float64},
abstracted::Vector{Float64},
}
+
+ function User(
+ node_id,
+ active,
+ demand,
+ allocated,
+ return_factor,
+ min_level,
+ priorities,
+ record,
+ )
+ if valid_demand(node_id, demand, priorities)
+ return new(
+ node_id,
+ active,
+ demand,
+ allocated,
+ return_factor,
+ min_level,
+ priorities,
+ record,
+ )
+ else
+ error("Invalid demand")
+ end
+ end
end
"Subgrid linearly interpolates basin levels."
diff --git a/core/src/utils.jl b/core/src/utils.jl
index b2fda3d4f..d3a341602 100644
--- a/core/src/utils.jl
+++ b/core/src/utils.jl
@@ -101,6 +101,10 @@ function create_graph(db::DB, config::Config, chunk_sizes::Vector{Int})::MetaGra
end
end
+ if incomplete_subnetwork(graph, node_ids)
+ error("Incomplete connectivity in subnetwork")
+ end
+
flow = zeros(flow_counter)
flow_vertical = zeros(flow_vertical_counter)
if config.solver.autodiff
diff --git a/core/src/validation.jl b/core/src/validation.jl
index 7a11305ae..29aee6cec 100644
--- a/core/src/validation.jl
+++ b/core/src/validation.jl
@@ -636,3 +636,46 @@ function valid_subgrid(
return !errors
end
+
+function valid_demand(
+ node_id::Vector{NodeID},
+ demand::Vector{
+ Vector{LinearInterpolation{Vector{Float64}, Vector{Float64}, true, Float64}},
+ },
+ priorities::Vector{Int},
+)::Bool
+ errors = false
+
+ for (col, id) in zip(demand, node_id)
+ for (demand_p_itp, p_itp) in zip(col, priorities)
+ if any(demand_p_itp.u .< 0.0)
+ @error "Demand of user node $id with priority $p_itp should be non-negative"
+ errors = true
+ end
+ end
+ end
+ return !errors
+end
+
+function incomplete_subnetwork(graph::MetaGraph, node_ids::Dict{Int, Set{NodeID}})::Bool
+ errors = false
+ for (allocation_network_id, subnetwork_node_ids) in node_ids
+ subnetwork, _ = induced_subgraph(graph, code_for.(Ref(graph), subnetwork_node_ids))
+ if !is_connected(subnetwork)
+ @error "All nodes in subnetwork $allocation_network_id should be connected"
+ errors = true
+ end
+ end
+ return errors
+end
+
+function non_positive_allocation_network_id(graph::MetaGraph)::Bool
+ errors = false
+ for allocation_network_id in keys(graph[].node_ids)
+ if (allocation_network_id <= 0)
+ @error "Allocation network id $allocation_network_id needs to be a positive integer."
+ errors = true
+ end
+ end
+ return errors
+end
diff --git a/core/test/create_test.jl b/core/test/create_test.jl
new file mode 100644
index 000000000..946d6664f
--- /dev/null
+++ b/core/test/create_test.jl
@@ -0,0 +1,89 @@
+@testitem "Non-positive allocation network ID" begin
+ using MetaGraphsNext
+ using Graphs
+ using Logging
+ using Ribasim
+ using Accessors: @set
+
+ graph = MetaGraph(
+ DiGraph();
+ label_type = Ribasim.NodeID,
+ vertex_data_type = Ribasim.NodeMetadata,
+ edge_data_type = Symbol,
+ graph_data = Tuple,
+ )
+
+ graph[Ribasim.NodeID(1)] = Ribasim.NodeMetadata(Symbol(:delft), 1)
+ graph[Ribasim.NodeID(2)] = Ribasim.NodeMetadata(Symbol(:denhaag), -1)
+
+ graph[1, 2] = :yes
+
+ node_ids = Dict{Int, Set{Ribasim.NodeID}}()
+ node_ids[0] = Set{Ribasim.NodeID}()
+ node_ids[-1] = Set{Ribasim.NodeID}()
+ push!(node_ids[0], Ribasim.NodeID(1))
+ push!(node_ids[-1], Ribasim.NodeID(2))
+
+ graph_data = (; node_ids,)
+ graph = @set graph.graph_data = graph_data
+
+ logger = TestLogger()
+ with_logger(logger) do
+ Ribasim.non_positive_allocation_network_id(graph)
+ end
+
+ @test length(logger.logs) == 2
+ @test logger.logs[1].level == Error
+ @test logger.logs[1].message ==
+ "Allocation network id 0 needs to be a positive integer."
+ @test logger.logs[2].level == Error
+ @test logger.logs[2].message ==
+ "Allocation network id -1 needs to be a positive integer."
+end
+
+@testitem "Incomplete subnetwork" begin
+ using MetaGraphsNext
+ using Graphs
+ using Logging
+ using Ribasim
+
+ graph = MetaGraph(
+ DiGraph();
+ label_type = Ribasim.NodeID,
+ vertex_data_type = Ribasim.NodeMetadata,
+ edge_data_type = Symbol,
+ graph_data = Tuple,
+ )
+
+ node_ids = Dict{Int, Set{Ribasim.NodeID}}()
+ node_ids[1] = Set{Ribasim.NodeID}()
+ push!(node_ids[1], Ribasim.NodeID(1))
+ push!(node_ids[1], Ribasim.NodeID(2))
+ push!(node_ids[1], Ribasim.NodeID(3))
+ node_ids[2] = Set{Ribasim.NodeID}()
+ push!(node_ids[2], Ribasim.NodeID(4))
+ push!(node_ids[2], Ribasim.NodeID(5))
+ push!(node_ids[2], Ribasim.NodeID(6))
+
+ graph[Ribasim.NodeID(1)] = Ribasim.NodeMetadata(Symbol(:delft), 1)
+ graph[Ribasim.NodeID(2)] = Ribasim.NodeMetadata(Symbol(:denhaag), 1)
+ graph[Ribasim.NodeID(3)] = Ribasim.NodeMetadata(Symbol(:rdam), 1)
+ graph[Ribasim.NodeID(4)] = Ribasim.NodeMetadata(Symbol(:adam), 2)
+ graph[Ribasim.NodeID(5)] = Ribasim.NodeMetadata(Symbol(:utrecht), 2)
+ graph[Ribasim.NodeID(6)] = Ribasim.NodeMetadata(Symbol(:leiden), 2)
+
+ graph[Ribasim.NodeID(1), Ribasim.NodeID(2)] = :yes
+ graph[Ribasim.NodeID(1), Ribasim.NodeID(3)] = :yes
+ graph[4, 5] = :yes
+
+ logger = TestLogger()
+
+ with_logger(logger) do
+ errors = Ribasim.incomplete_subnetwork(graph, node_ids)
+ @test errors == true
+ end
+
+ @test length(logger.logs) == 1
+ @test logger.logs[1].level == Error
+ @test logger.logs[1].message == "All nodes in subnetwork 2 should be connected"
+end
diff --git a/core/test/libribasim_test.jl b/core/test/libribasim_test.jl
index 3bcac1fc0..1eb42f431 100644
--- a/core/test/libribasim_test.jl
+++ b/core/test/libribasim_test.jl
@@ -1,8 +1,4 @@
@testitem "libribasim" begin
- import BasicModelInterface as BMI
-
- include("../../build/libribasim/src/libribasim.jl")
-
toml_path = normpath(@__DIR__, "../../generated_testmodels/basic/ribasim.toml")
# data from which we create pointers for libribasim
diff --git a/core/test/validation_test.jl b/core/test/validation_test.jl
index 97b782b6d..62d8cfeb7 100644
--- a/core/test/validation_test.jl
+++ b/core/test/validation_test.jl
@@ -401,3 +401,27 @@ end
@test logger.logs[2].message ==
"Basin / subgrid_level subgrid_id 1 has repeated element levels, this cannot be interpolated."
end
+
+@testitem "negative demand" begin
+ using Logging
+ using DataInterpolations: LinearInterpolation
+ logger = TestLogger()
+
+ with_logger(logger) do
+ @test_throws "Invalid demand" Ribasim.User(
+ [Ribasim.NodeID(1)],
+ [true],
+ [[LinearInterpolation([-5.0, -5.0], [-1.8, 1.8])]],
+ [0.0, -0.0],
+ [0.9],
+ [0.9],
+ [1],
+ [],
+ )
+ end
+
+ @test length(logger.logs) == 1
+ @test logger.logs[1].level == Error
+ @test logger.logs[1].message ==
+ "Demand of user node #1 with priority 1 should be non-negative"
+end
diff --git a/docs/src/docs.jl b/docs/src/docs.jl
deleted file mode 100644
index 12701a5c9..000000000
--- a/docs/src/docs.jl
+++ /dev/null
@@ -1,4 +0,0 @@
-__precompile__(false)
-
-# This is not really a package, but needs to be set up like one so we can run
-# `dev build/create_binaries` from the root project.
diff --git a/pixi.toml b/pixi.toml
index fe84712ae..e29bfb276 100644
--- a/pixi.toml
+++ b/pixi.toml
@@ -61,15 +61,15 @@ lint = { depends_on = [
"mypy-ribasim-qgis",
] }
# Build
-build-ribasim-cli = { cmd = "julia --project build.jl --app", cwd = "build/create_binaries", depends_on = [
+build-ribasim-cli = { cmd = "julia --project build.jl --app", cwd = "build", depends_on = [
"generate-testmodels",
"initialize-julia",
] }
-build-libribasim = { cmd = "julia --project build.jl --lib", cwd = "build/create_binaries", depends_on = [
+build-libribasim = { cmd = "julia --project build.jl --lib", cwd = "build", depends_on = [
"generate-testmodels",
"initialize-julia",
] }
-build = { "cmd" = "julia --project build.jl --app --lib", cwd = "build/create_binaries", depends_on = [
+build = { "cmd" = "julia --project build.jl --app --lib", cwd = "build", depends_on = [
"generate-testmodels",
"initialize-julia",
] }
@@ -78,7 +78,7 @@ remove-artifacts = "julia --eval 'rm(joinpath(Base.DEPOT_PATH[1], \"artifacts\")
# Test
test-ribasim-python = "pytest --numprocesses=4 python/ribasim/tests"
test-ribasim-api = "pytest --basetemp=python/ribasim_api/tests/temp --junitxml=report.xml python/ribasim_api/tests"
-test-ribasim-cli = "pytest --numprocesses=4 --basetemp=build/ribasim_cli/tests/temp --junitxml=report.xml build/ribasim_cli/tests"
+test-ribasim-cli = "pytest --numprocesses=4 --basetemp=build/tests/temp --junitxml=report.xml build/tests"
test-ribasim-core = { cmd = "julia --project=core --eval 'using Pkg; Pkg.test()'", depends_on = [
"generate-testmodels",
] }
diff --git a/python/ribasim_api/tests/conftest.py b/python/ribasim_api/tests/conftest.py
index f46288486..b69fe8167 100644
--- a/python/ribasim_api/tests/conftest.py
+++ b/python/ribasim_api/tests/conftest.py
@@ -12,7 +12,7 @@ def libribasim_paths() -> tuple[Path, Path]:
repo_root = Path(__file__).parents[3].resolve()
lib_or_bin = "bin" if platform.system() == "Windows" else "lib"
extension = ".dll" if platform.system() == "Windows" else ".so"
- lib_folder = repo_root / "build" / "create_binaries" / "libribasim" / lib_or_bin
+ lib_folder = repo_root / "build" / "libribasim" / lib_or_bin
lib_path = lib_folder / f"libribasim{extension}"
return lib_path, lib_folder