Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add coverage for OUTLETS INP section #229

Merged
merged 6 commits into from
Nov 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading