Skip to content

Commit

Permalink
Remove urban_runoff from Basin (#1611)
Browse files Browse the repository at this point in the history
This takes care of the removing `urban_runoff` part of #1071.
Technically breaking if people had this unused column in their Basin
tables.
  • Loading branch information
visr authored Jul 16, 2024
1 parent 95663da commit 51a7fcc
Show file tree
Hide file tree
Showing 10 changed files with 3 additions and 24 deletions.
2 changes: 0 additions & 2 deletions core/src/schema.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions docs/concept/modelconcept.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 0 additions & 7 deletions docs/guide/examples.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand All @@ -1463,7 +1461,6 @@
" potential_evaporation=[0.0],\n",
" infiltration=[0.0],\n",
" precipitation=[0.0],\n",
" urban_runoff=[0.0],\n",
" ),\n",
" ],\n",
")"
Expand Down Expand Up @@ -1756,7 +1753,6 @@
" potential_evaporation=evaporation,\n",
" infiltration=0.0,\n",
" precipitation=precipitation,\n",
" urban_runoff=0.0,\n",
" ),\n",
"]\n",
"\n",
Expand All @@ -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",
Expand All @@ -1777,7 +1772,6 @@
" potential_evaporation=evaporation,\n",
" infiltration=0.0,\n",
" precipitation=precipitation,\n",
" urban_runoff=0.0,\n",
" ),\n",
"]\n",
"\n",
Expand All @@ -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",
Expand Down
1 change: 0 additions & 1 deletion docs/reference/node/basin.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 0 additions & 2 deletions python/ribasim/ribasim/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion python/ribasim/tests/test_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
1 change: 0 additions & 1 deletion python/ribasim_testmodels/ribasim_testmodels/basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 0 additions & 2 deletions python/ribasim_testmodels/ribasim_testmodels/bucket.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ def bucket_model() -> ribasim.Model:
potential_evaporation=[np.nan],
infiltration=[np.nan],
precipitation=[np.nan],
urban_runoff=[np.nan],
),
],
)
Expand Down Expand Up @@ -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,
),
],
)
Expand Down
4 changes: 0 additions & 4 deletions python/ribasim_testmodels/ribasim_testmodels/doc_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ def local_pidcontrolled_cascade_model():
potential_evaporation=evaporation,
infiltration=0.0,
precipitation=precipitation,
urban_runoff=0.0,
),
]

Expand All @@ -56,7 +55,6 @@ def local_pidcontrolled_cascade_model():
potential_evaporation=evaporation,
infiltration=0.0,
precipitation=precipitation,
urban_runoff=0.0,
),
]
basin_time3 = [
Expand All @@ -66,7 +64,6 @@ def local_pidcontrolled_cascade_model():
potential_evaporation=evaporation,
infiltration=0.0,
precipitation=precipitation,
urban_runoff=0.0,
),
]

Expand All @@ -81,7 +78,6 @@ def local_pidcontrolled_cascade_model():
potential_evaporation=0.0,
infiltration=0.0,
precipitation=0.0,
urban_runoff=0.0,
),
],
)
Expand Down
2 changes: 0 additions & 2 deletions ribasim_qgis/core/nodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -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),
]


Expand All @@ -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),
]


Expand Down

0 comments on commit 51a7fcc

Please sign in to comment.