-
Notifications
You must be signed in to change notification settings - Fork 43
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 the LID_USAGE section #193
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,6 +19,7 @@ | |
|
||
from swmmio.utils.functions import trim_section_to_nodes | ||
from swmmio.utils.text import get_inp_sections_details, get_rpt_sections_details, get_rpt_metadata | ||
import swmmio.utils.text | ||
|
||
pd.set_option('display.max_columns', 5) | ||
|
||
|
@@ -498,6 +499,20 @@ def headers(self): | |
|
||
return self._rpt_section_details | ||
|
||
@property | ||
def external_outflow_volume(self): | ||
""" | ||
Return the external outflow from rpt file in mm or inches | ||
""" | ||
return float(swmmio.utils.text.get_rpt_value(self.path, "External Outflow")) | ||
|
||
@property | ||
def flooding_loss_volume(self): | ||
""" | ||
Return the flooding loss from rpt file in mm or inches | ||
""" | ||
return float(swmmio.utils.text.get_rpt_value(self.path, "Flooding Loss")) | ||
|
||
|
||
# setattr(rpt, 'link_flow_summary', property(get_rpt_df('Link Flow Summary'))) | ||
|
||
|
@@ -515,6 +530,7 @@ def __init__(self, file_path): | |
self._report_df = None | ||
self._conduits_df = None | ||
self._xsections_df = None | ||
self._lid_usage_df = None | ||
self._pollutants_df = None | ||
self._landuses_df = None | ||
self._buildup_df = None | ||
|
@@ -586,6 +602,7 @@ def __init__(self, file_path): | |
'[INFLOWS]', | ||
'[Polygons]', | ||
'[TIMESERIES]', | ||
'[LID_USAGE]', | ||
'[TAGS]', | ||
'[STREETS]', | ||
'[INLETS]', | ||
|
@@ -611,10 +628,12 @@ def save(self, target_path=None): | |
else: | ||
target_path = self.path | ||
|
||
|
||
for section in self._sections: | ||
# reformate the [SECTION] to section (and _section_df) | ||
sect_id = section.translate({ord(i): None for i in '[]'}).lower() | ||
sect_id_private = '_{}_df'.format(sect_id) | ||
#print(sect_id_private) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you remove this commented line? |
||
data = getattr(self, sect_id_private) | ||
if data is not None: | ||
replace_inp_section(target_path, section, data) | ||
|
@@ -857,6 +876,31 @@ def xsections(self, df): | |
"""Set inp.xsections DataFrame.""" | ||
self._xsections_df = df | ||
|
||
|
||
@property | ||
def lid_usage(self): | ||
""" | ||
Get/set LID_USAGE section of the INP file. | ||
""" | ||
if self._lid_usage_df is None: | ||
self._lid_usage_df = dataframe_from_inp(self.path, "[LID_USAGE]") | ||
return self._lid_usage_df | ||
|
||
@property | ||
def raingages(self): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This raingages getter section is already defined above around line 731. Please remove this property. |
||
""" | ||
Get/set RAINGAGES section of the INP file. | ||
""" | ||
if self._raingages_df is None: | ||
self._raingages_df = dataframe_from_inp(self.path, "[RAINGAGES]") | ||
return self._raingages_df | ||
|
||
|
||
@lid_usage.setter | ||
def lid_usage(self, df): | ||
"""Set inp.lid_usage DataFrame.""" | ||
self._lid_usage_df = df | ||
|
||
@property | ||
def pollutants(self): | ||
""" | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -63,7 +63,9 @@ inp_file_objects: | |
XSECTIONS: [Link, Shape, Geom1, Geom2, Geom3, Geom4, Barrels, XX] | ||
POLLUTANTS: [Name, MassUnits, RainConcen, GWConcen, I&IConcen, DecayCoeff, SnowOnly, | ||
CoPollutName, CoPollutFraction, DWFConcen, InitConcen] | ||
|
||
INFLOWS: [Node, Constituent, Time Series, Type, Mfactor, Sfactor, Baseline, Pattern] | ||
LID_USAGE: [Subcatchment, 'LID_Process', Number, Area, Width, InitSat, FromImp, ToPerv, RptFile, DrainTo, FromPerv,] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please replace this line with the following: LID_USAGE: [Subcatchment, LID_Process, Number, Area, Width, InitSat, FromImp, ToPerv, RptFile, DrainTo, FromPerv,] This edit just removes the extra white space. Thanks! |
||
|
||
TIMESERIES: [Name, Date, Time, Value] | ||
COORDINATES: [Name, X, Y] | ||
|
@@ -82,7 +84,7 @@ inp_file_objects: | |
|
||
|
||
inp_section_tags: | ||
['[TITLE', '[OPTION', '[FILE', '[RAINGAGE', '[TEMPERATURE', '[EVAP', | ||
['[TITLE', '[OPTION', '[FILE', '[RAINGAGES', '[TEMPERATURE', '[EVAP', | ||
'[SUBCATCHMENT', '[SUBAREA', '[INFIL', '[AQUIFER', '[GROUNDWATER', '[SNOWPACK', | ||
'[JUNC', '[OUTFALL', '[STORAGE', '[DIVIDER', '[CONDUIT', '[PUMP', '[ORIFICE', '[WEIR', | ||
'[OUTLET', '[XSECT', '[TRANSECT', '[LOSS', '[CONTROL', '[POLLUT', '[LANDUSE', '[BUILDUP', | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is really cool! It is making think, though, that we need to provide coverage for the whole
Flow Routing Continuity
section of the rpt file. What do you think?If you agree, maybe we can tackle that in a separate issue.
Then we could extend that logic to provide coverage for the rest of the rpt sections that follow this structure.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could be handled in #194