Skip to content

Commit

Permalink
Merge pull request #229 from pyswmm/feature/add-outlets
Browse files Browse the repository at this point in the history
Add coverage for OUTLETS INP section
  • Loading branch information
aerispaha authored Nov 27, 2024
2 parents 342e77c + 9c2b2c4 commit 93148c0
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
35 changes: 35 additions & 0 deletions swmmio/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -645,6 +646,7 @@ def __init__(self, file_path):
'[TAGS]',
'[STREETS]',
'[INLETS]',
'[OUTLETS]',
'[INLET_USAGE]',
'[PATTERNS]',
'[CONTROLS]',
Expand Down Expand Up @@ -1677,6 +1679,39 @@ 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.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]")
return self._outlets_df

@outlets.setter
def outlets(self, df):
"""Set inp.outlets DataFrame."""
self._outlets_df = df

@property
def inlet_usage(self):
Expand Down
2 changes: 1 addition & 1 deletion swmmio/defs/section_headers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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, OUTLETS]
join_sections: [XSECTIONS]
rpt_sections: [Link Flow Summary]
pumps:
Expand Down
8 changes: 6 additions & 2 deletions swmmio/tests/data/test_inlet_drains.inp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
;;-------------- ------------ ---------------- ---------- ---------- ---------- ---------- ----------
Expand All @@ -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
Expand Down

0 comments on commit 93148c0

Please sign in to comment.