US EPA’s Stormwater Management Model (SWMM) stores all relevant data in the so called *.inp file. This plain ASCII coded file contains information about model structure (e.g., subcatchments) and model options (e.g. flow units, flow routing, simulation period). The file itself is structured into sections which starts and ends with opening and closing squared brackets ([, ]).
Currently, 51 sections are recognized. These are:
#> [1] "aquifers" "backdrop" "buildup" "conduits"
#> [5] "controls" "coordinates" "coverages" "curves"
#> [9] "dividers" "dwf" "evaporation" "events"
#> [13] "files" "groundwater" "hydrographs" "iiflows"
#> [17] "infiltration" "inflows" "junctions" "labels"
#> [21] "landuses" "lid_controls" "lid_usage" "loadings"
#> [25] "losses" "map" "options" "orifices"
#> [29] "outfalls" "outlets" "patterns" "pollutants"
#> [33] "polygons" "profiles" "pumps" "raingages"
#> [37] "report" "snowpacks" "storage" "subareas"
#> [41] "subcatchments" "symbols" "tags" "temperature"
#> [45] "timeseries" "title" "treatment" "vertices"
#> [49] "washoff" "weirs" "xsections"
read_inp?swmmr’s inp parser walks through the file and separates the file into section blocks. A section is recognized if its name is enclosed by squared brackets. Each section has an own parsing scheme, which especially holds header information (i.e. colnames). The result of a parsed section is always a tibble, which subsequently leads to a list of tibbles for the entire inp file.
write_inp?The benefit of parsing the inp file into a list of tibbles becomes clearly if a new inp file has to be written to disk: swmmr’s inp writer just walks through the inp object and writes each tibble (whitespace separated) into one file. However, column names of sections are not written to clearly indicate the origin of file (i.e. swmmr). If column names are really required, the new generated inp file can still be opened with SWMM and saved back with the GUI.
After each SWMM simulation run, a report file (*.rpt) is generated containing status reports and result summaries.
Currently, 24 report sections are recognized. These are:
#> [1] "Element Count" "Pollutant Summary"
#> [3] "Landuse Summary" "Raingage Summary"
#> [5] "Subcatchment Summary" "Node Summary"
#> [7] "Link Summary" "Cross Section Summary"
#> [9] "Analysis Options" "Runoff Quantity Continuity"
#> [11] "Runoff Quality Continuity" "Flow Routing Continuity"
#> [13] "Quality Routing Continuity" "Highest Flow Instability Indexes"
#> [15] "Routing Time Step Summary" "Subcatchment Runoff Summary"
#> [17] "Subcatchment Washoff Summary" "Node Depth Summary"
#> [19] "Node Inflow Summary" "Node Flooding Summary"
#> [21] "Outfall Loading Summary" "Link Flow Summary"
#> [23] "Conduit Surcharge Summary" "Link Pollutant Load Summary"
read_rpt?Report files are read in the same manner like inp files. The output will be a tibble for each summary, which results as a list of tibbles for a single rpt file.