From 77ab19d8cc4cf8dedccab9059902a30de981ddc0 Mon Sep 17 00:00:00 2001 From: Adam Erispaha Date: Wed, 13 Nov 2024 10:01:31 -0500 Subject: [PATCH 1/5] partial implementation of outlets inp coverage --- swmmio/core.py | 30 +++++++++++++++++++++++++ swmmio/defs/section_headers.yml | 2 +- swmmio/tests/data/test_inlet_drains.inp | 5 +++++ 3 files changed, 36 insertions(+), 1 deletion(-) diff --git a/swmmio/core.py b/swmmio/core.py index 2da7c5b..cf9d89f 100644 --- a/swmmio/core.py +++ b/swmmio/core.py @@ -599,6 +599,7 @@ def __init__(self, file_path): self._tags_df = None self._streets_df = None self._inlets_df = None + self._outlets_df = None self._inlet_usage_df = None self._patterns_df = None self._controls_df = None @@ -645,6 +646,7 @@ def __init__(self, file_path): '[TAGS]', '[STREETS]', '[INLETS]', + '[OUTLETS]', '[INLET_USAGE]', '[PATTERNS]', '[CONTROLS]', @@ -1677,6 +1679,34 @@ def inlets(self): def inlets(self, df): """Set inp.inlets DataFrame.""" self._inlets_df = df + + @property + def outlets(self): + """ + Get/set outlets section of the INP file. + + Returns + ------- + pandas.DataFrame + + Examples + -------- + Access the outlets section of the inp file + + >>> from swmmio.examples import streets + >>> streets.inp.outlets #doctest: +NORMALIZE_WHITESPACE + InletNode OutletNode ... Qcoeff/QTable Qexpon + Name ... + TestOutlet J100 J101 ... TestOutletTB YES + """ + if self._outlets_df is None: + self._outlets_df = dataframe_from_inp(self.path, "[OUTLETS]") + return self._outlets_df + + @outlets.setter + def outlets(self, df): + """Set inp.outlets DataFrame.""" + self._outlets_df = df @property def inlet_usage(self): diff --git a/swmmio/defs/section_headers.yml b/swmmio/defs/section_headers.yml index f93658a..8b28151 100644 --- a/swmmio/defs/section_headers.yml +++ b/swmmio/defs/section_headers.yml @@ -175,7 +175,7 @@ composite: rpt_sections: [Link Flow Summary] outfalls: [Name, Elevation, Type, Stage Data, Gated, Route To] links: - inp_sections: [CONDUITS, WEIRS, ORIFICES, PUMPS] + inp_sections: [CONDUITS, WEIRS, ORIFICES, PUMPS, OUTFALLS] join_sections: [XSECTIONS] rpt_sections: [Link Flow Summary] pumps: diff --git a/swmmio/tests/data/test_inlet_drains.inp b/swmmio/tests/data/test_inlet_drains.inp index f224c4b..d775707 100644 --- a/swmmio/tests/data/test_inlet_drains.inp +++ b/swmmio/tests/data/test_inlet_drains.inp @@ -187,6 +187,11 @@ Street3 ComboInlet J2a 1 0 0 Street4 ComboInlet J2 1 0 0 0 0 Street5 ComboInlet J11 2 0 0 0 0 +[OUTLETS] +;;Name From Node To Node Offset Type QTable/Qcoeff Qexpon Gated +;;-------------- ---------------- ---------------- ---------- --------------- ---------------- ---------- -------- +TestOutlet J100 J101 1.07 TABULAR/DEPTH TestOutletTB YES + [TIMESERIES] ;;Name Date Time Value ;;-------------- ---------- ---------- ---------- From 0ffd8b719534c8db70b99f31d43d9c281174f950 Mon Sep 17 00:00:00 2001 From: Adam Erispaha Date: Wed, 27 Nov 2024 11:44:39 -0500 Subject: [PATCH 2/5] fix typo in links composite definition --- swmmio/defs/section_headers.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/swmmio/defs/section_headers.yml b/swmmio/defs/section_headers.yml index 8b28151..65a8d83 100644 --- a/swmmio/defs/section_headers.yml +++ b/swmmio/defs/section_headers.yml @@ -175,7 +175,7 @@ composite: rpt_sections: [Link Flow Summary] outfalls: [Name, Elevation, Type, Stage Data, Gated, Route To] links: - inp_sections: [CONDUITS, WEIRS, ORIFICES, PUMPS, OUTFALLS] + inp_sections: [CONDUITS, WEIRS, ORIFICES, PUMPS, OUTLETS] join_sections: [XSECTIONS] rpt_sections: [Link Flow Summary] pumps: From c273d173fa5a398d06b18e8fe5eb6eb7beda5349 Mon Sep 17 00:00:00 2001 From: Adam Erispaha Date: Wed, 27 Nov 2024 11:51:42 -0500 Subject: [PATCH 3/5] add outlet for testing to test_inlet_drains.inp --- swmmio/tests/data/test_inlet_drains.inp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/swmmio/tests/data/test_inlet_drains.inp b/swmmio/tests/data/test_inlet_drains.inp index d775707..b73500f 100644 --- a/swmmio/tests/data/test_inlet_drains.inp +++ b/swmmio/tests/data/test_inlet_drains.inp @@ -129,7 +129,6 @@ C7 J6 J8 95.0 0.016 0 C8 J8 J9 166.0 0.05 0 0 0 0 C9 J9 J10 320.0 0.05 0 6 0 0 C10 J10 J11 145.0 0.05 6 6 0 0 -C11 J11 O1 89.0 0.016 0 0 0 0 C_Aux3 Aux3 J3 444.75 0.05 6 0 0 0 P1 J1 J5 185.39 0.016 0 0 0 0 P2 J2a J2 157.48 0.016 0 0 0 0 @@ -140,6 +139,12 @@ P6 J4 J7 360.39 0.016 0 P7 J7 J10 507.76 0.016 0 0 0 0 P8 J10 J11 144.50 0.016 0 0 0 0 +[OUTLETS] +;;Name From Node To Node Offset Type QTable/Qcoeff Qexpon Gated +;;-------------- ---------------- ---------------- ---------- ---------------- ---------------- ---------- -------- +C11 J11 O1 0 FUNCTIONAL/DEPTH 10 0.5 NO + + [XSECTIONS] ;;Link Shape Geom1 Geom2 Geom3 Geom4 Barrels Culvert ;;-------------- ------------ ---------------- ---------- ---------- ---------- ---------- ---------- @@ -156,7 +161,6 @@ C7 CIRCULAR 3.5 0 0 0 C8 TRAPEZOIDAL 3 5 5 5 1 C9 TRAPEZOIDAL 3 5 5 5 1 C10 TRAPEZOIDAL 3 5 5 5 1 -C11 CIRCULAR 4.75 0 0 0 1 C_Aux3 TRAPEZOIDAL 3 5 5 5 1 P1 CIRCULAR 0.5 0 0 0 1 P2 CIRCULAR 1.5 0 0 0 1 @@ -187,11 +191,6 @@ Street3 ComboInlet J2a 1 0 0 Street4 ComboInlet J2 1 0 0 0 0 Street5 ComboInlet J11 2 0 0 0 0 -[OUTLETS] -;;Name From Node To Node Offset Type QTable/Qcoeff Qexpon Gated -;;-------------- ---------------- ---------------- ---------- --------------- ---------------- ---------- -------- -TestOutlet J100 J101 1.07 TABULAR/DEPTH TestOutletTB YES - [TIMESERIES] ;;Name Date Time Value ;;-------------- ---------- ---------- ---------- From 72b41dc9153f610db5af1756cee80c42bd1fd873 Mon Sep 17 00:00:00 2001 From: Adam Erispaha Date: Wed, 27 Nov 2024 12:08:48 -0500 Subject: [PATCH 4/5] fix outlets doctest benchmark data --- swmmio/core.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/swmmio/core.py b/swmmio/core.py index cf9d89f..49a3839 100644 --- a/swmmio/core.py +++ b/swmmio/core.py @@ -1694,10 +1694,15 @@ def outlets(self): Access the outlets section of the inp file >>> from swmmio.examples import streets - >>> streets.inp.outlets #doctest: +NORMALIZE_WHITESPACE - InletNode OutletNode ... Qcoeff/QTable Qexpon - Name ... - TestOutlet J100 J101 ... TestOutletTB YES + >>> streets.inp.outlets.loc['C11'] #doctest: +NORMALIZE_WHITESPACE + InletNode J11 + OutletNode O1 + OutflowHeight 0 + OutletType FUNCTIONAL/DEPTH + Qcoeff/QTable 10 + Qexpon 0.5 + FlapGate NO + Name: C11, dtype: object """ if self._outlets_df is None: self._outlets_df = dataframe_from_inp(self.path, "[OUTLETS]") From 9c2b2c48ad1eb8c8203a62f97f93183b61a536f0 Mon Sep 17 00:00:00 2001 From: Adam Erispaha Date: Wed, 27 Nov 2024 12:16:03 -0500 Subject: [PATCH 5/5] uncomment docs deploy condition --- .github/workflows/documentation.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml index 212a8d9..2160f1e 100644 --- a/.github/workflows/documentation.yml +++ b/.github/workflows/documentation.yml @@ -44,7 +44,7 @@ jobs: path: './docs/build' deploy: - # if: startsWith(github.event.ref, 'refs/tags/v') + if: startsWith(github.event.ref, 'refs/tags/v') environment: name: github-pages url: ${{ steps.deployment.outputs.page_url }}