From 51a7fcc0910859a3da4aaba2d414aa55472fbfa8 Mon Sep 17 00:00:00 2001 From: Martijn Visser Date: Tue, 16 Jul 2024 11:41:42 +0200 Subject: [PATCH] Remove urban_runoff from Basin (#1611) This takes care of the removing `urban_runoff` part of #1071. Technically breaking if people had this unused column in their Basin tables. --- core/src/schema.jl | 2 -- docs/concept/modelconcept.qmd | 4 ++-- docs/guide/examples.ipynb | 7 ------- docs/reference/node/basin.qmd | 1 - python/ribasim/ribasim/schemas.py | 2 -- python/ribasim/tests/test_io.py | 2 +- python/ribasim_testmodels/ribasim_testmodels/basic.py | 1 - python/ribasim_testmodels/ribasim_testmodels/bucket.py | 2 -- .../ribasim_testmodels/ribasim_testmodels/doc_example.py | 4 ---- ribasim_qgis/core/nodes.py | 2 -- 10 files changed, 3 insertions(+), 24 deletions(-) diff --git a/core/src/schema.jl b/core/src/schema.jl index e36d4d128..0b1e47a2e 100644 --- a/core/src/schema.jl +++ b/core/src/schema.jl @@ -91,7 +91,6 @@ end potential_evaporation::Union{Missing, Float64} infiltration::Union{Missing, Float64} precipitation::Union{Missing, Float64} - urban_runoff::Union{Missing, Float64} end @version BasinTimeV1 begin @@ -101,7 +100,6 @@ end potential_evaporation::Union{Missing, Float64} infiltration::Union{Missing, Float64} precipitation::Union{Missing, Float64} - urban_runoff::Union{Missing, Float64} end @version BasinConcentrationV1 begin diff --git a/docs/concept/modelconcept.qmd b/docs/concept/modelconcept.qmd index 7e3fc91aa..53f02c9b2 100644 --- a/docs/concept/modelconcept.qmd +++ b/docs/concept/modelconcept.qmd @@ -18,12 +18,12 @@ $$ \frac{\mathrm{d}S}{\mathrm{d}t} = Q_{in} - Q_{out} $$ -We can split out the fluxes into separate terms, such as precipitation $P$, evapotranspiration $ET$ and runoff $R$. +We can split out the fluxes into separate terms, such as precipitation $P$ and evapotranspiration $ET$. For now other fluxes are combined into $Q_{rest}$. If we define all fluxes entering our reservoir as positive, and those leaving the system as negative, all fluxes can be summed up. $$ -\frac{\mathrm{d}S}{\mathrm{d}t} = R + P + ET + Q_{rest} +\frac{\mathrm{d}S}{\mathrm{d}t} = P + ET + Q_{rest} $$ ## Time diff --git a/docs/guide/examples.ipynb b/docs/guide/examples.ipynb index 2aaf4ce88..818a8f5ff 100644 --- a/docs/guide/examples.ipynb +++ b/docs/guide/examples.ipynb @@ -115,7 +115,6 @@ " potential_evaporation=evaporation,\n", " infiltration=0.0,\n", " precipitation=precipitation,\n", - " urban_runoff=0.0,\n", " ),\n", " basin.State(level=[1.4]),\n", "]\n", @@ -1450,7 +1449,6 @@ " potential_evaporation=[0.0, 0.0],\n", " infiltration=[0.0, 0.0],\n", " precipitation=[1e-6, 0.0],\n", - " urban_runoff=[0.0, 0.0],\n", " ),\n", " ],\n", ")\n", @@ -1463,7 +1461,6 @@ " potential_evaporation=[0.0],\n", " infiltration=[0.0],\n", " precipitation=[0.0],\n", - " urban_runoff=[0.0],\n", " ),\n", " ],\n", ")" @@ -1756,7 +1753,6 @@ " potential_evaporation=evaporation,\n", " infiltration=0.0,\n", " precipitation=precipitation,\n", - " urban_runoff=0.0,\n", " ),\n", "]\n", "\n", @@ -1767,7 +1763,6 @@ " potential_evaporation=evaporation,\n", " infiltration=0.0,\n", " precipitation=precipitation,\n", - " urban_runoff=0.0,\n", " ),\n", "]\n", "basin_time3 = [\n", @@ -1777,7 +1772,6 @@ " potential_evaporation=evaporation,\n", " infiltration=0.0,\n", " precipitation=precipitation,\n", - " urban_runoff=0.0,\n", " ),\n", "]\n", "\n", @@ -1792,7 +1786,6 @@ " potential_evaporation=0.0,\n", " infiltration=0.0,\n", " precipitation=0.0,\n", - " urban_runoff=0.0,\n", " ),\n", " ],\n", ")\n", diff --git a/docs/reference/node/basin.qmd b/docs/reference/node/basin.qmd index 8483c28c6..8efe00fa4 100644 --- a/docs/reference/node/basin.qmd +++ b/docs/reference/node/basin.qmd @@ -22,7 +22,6 @@ precipitation | Float64 | $m s^{-1}$ | non-negative potential_evaporation | Float64 | $m s^{-1}$ | non-negative drainage | Float64 | $m^3 s^{-1}$ | non-negative infiltration | Float64 | $m^3 s^{-1}$ | non-negative -urban_runoff | Float64 | $m^3 s^{-1}$ | non-negative Note that if variables are not set in the static table, default values are used when possible. These are generally zero, e.g. no precipitation, no inflow. If it is not possible diff --git a/python/ribasim/ribasim/schemas.py b/python/ribasim/ribasim/schemas.py index cf1bb4477..2b10d2b4c 100644 --- a/python/ribasim/ribasim/schemas.py +++ b/python/ribasim/ribasim/schemas.py @@ -49,7 +49,6 @@ class BasinStaticSchema(_BaseSchema): potential_evaporation: Series[float] = pa.Field(nullable=True) infiltration: Series[float] = pa.Field(nullable=True) precipitation: Series[float] = pa.Field(nullable=True) - urban_runoff: Series[float] = pa.Field(nullable=True) class BasinSubgridSchema(_BaseSchema): @@ -66,7 +65,6 @@ class BasinTimeSchema(_BaseSchema): potential_evaporation: Series[float] = pa.Field(nullable=True) infiltration: Series[float] = pa.Field(nullable=True) precipitation: Series[float] = pa.Field(nullable=True) - urban_runoff: Series[float] = pa.Field(nullable=True) class DiscreteControlConditionSchema(_BaseSchema): diff --git a/python/ribasim/tests/test_io.py b/python/ribasim/tests/test_io.py index fe7b9aa62..5b9db6f73 100644 --- a/python/ribasim/tests/test_io.py +++ b/python/ribasim/tests/test_io.py @@ -65,7 +65,7 @@ def test_basic_transient(basic_transient, tmp_path): assert model_orig.basin.time.df.time.iloc[0] == time.df.time.iloc[0] assert time.df.node_id.dtype == np.int32 __assert_equal(model_orig.basin.time.df, time.df) - assert time.df.shape == (1468, 7) + assert time.df.shape == (1468, 6) @pytest.mark.xfail(reason="Needs implementation") diff --git a/python/ribasim_testmodels/ribasim_testmodels/basic.py b/python/ribasim_testmodels/ribasim_testmodels/basic.py index 9f9305340..c887b9464 100644 --- a/python/ribasim_testmodels/ribasim_testmodels/basic.py +++ b/python/ribasim_testmodels/ribasim_testmodels/basic.py @@ -236,7 +236,6 @@ def basic_transient_model() -> ribasim.Model: "potential_evaporation": evaporation, "infiltration": 0.0, "precipitation": precipitation, - "urban_runoff": 0.0, } ) df = model.basin.static.df diff --git a/python/ribasim_testmodels/ribasim_testmodels/bucket.py b/python/ribasim_testmodels/ribasim_testmodels/bucket.py index 87fb28e07..8634e8b1d 100644 --- a/python/ribasim_testmodels/ribasim_testmodels/bucket.py +++ b/python/ribasim_testmodels/ribasim_testmodels/bucket.py @@ -30,7 +30,6 @@ def bucket_model() -> ribasim.Model: potential_evaporation=[np.nan], infiltration=[np.nan], precipitation=[np.nan], - urban_runoff=[np.nan], ), ], ) @@ -61,7 +60,6 @@ def leaky_bucket_model() -> ribasim.Model: potential_evaporation=np.nan, infiltration=[np.nan, 0.001, 0.002, 0.0, 0.0], precipitation=np.nan, - urban_runoff=0.0, ), ], ) diff --git a/python/ribasim_testmodels/ribasim_testmodels/doc_example.py b/python/ribasim_testmodels/ribasim_testmodels/doc_example.py index ea6a562e1..d22f3d9a0 100644 --- a/python/ribasim_testmodels/ribasim_testmodels/doc_example.py +++ b/python/ribasim_testmodels/ribasim_testmodels/doc_example.py @@ -45,7 +45,6 @@ def local_pidcontrolled_cascade_model(): potential_evaporation=evaporation, infiltration=0.0, precipitation=precipitation, - urban_runoff=0.0, ), ] @@ -56,7 +55,6 @@ def local_pidcontrolled_cascade_model(): potential_evaporation=evaporation, infiltration=0.0, precipitation=precipitation, - urban_runoff=0.0, ), ] basin_time3 = [ @@ -66,7 +64,6 @@ def local_pidcontrolled_cascade_model(): potential_evaporation=evaporation, infiltration=0.0, precipitation=precipitation, - urban_runoff=0.0, ), ] @@ -81,7 +78,6 @@ def local_pidcontrolled_cascade_model(): potential_evaporation=0.0, infiltration=0.0, precipitation=0.0, - urban_runoff=0.0, ), ], ) diff --git a/ribasim_qgis/core/nodes.py b/ribasim_qgis/core/nodes.py index 776438dcb..fb9ce1cff 100644 --- a/ribasim_qgis/core/nodes.py +++ b/ribasim_qgis/core/nodes.py @@ -380,7 +380,6 @@ def attributes(cls) -> list[QgsField]: QgsField("potential_evaporation", QVariant.Double), QgsField("infiltration", QVariant.Double), QgsField("precipitation", QVariant.Double), - QgsField("urban_runoff", QVariant.Double), ] @@ -402,7 +401,6 @@ def attributes(cls) -> list[QgsField]: QgsField("potential_evaporation", QVariant.Double), QgsField("infiltration", QVariant.Double), QgsField("precipitation", QVariant.Double), - QgsField("urban_runoff", QVariant.Double), ]