Open mrustl opened 3 years ago
There seems to be already some issues with the output file reading in swmmr which is open for months: https://github.com/dleutnant/swmmr/issues/48
Total runoff volume given in gallons?
Total runoff volume (million gallons or million liters) https://www.epa.gov/sites/production/files/2019-02/documents/epaswmm5_1_manual_master_8-2-15.pdf, page 138
@mrustl: I have now integrated get_out_content()
into hsonne/swmmr@mydev
. Can you now use kwb.swmmr with my version of swmmr from that branch?
Total runoff volume given in gallons?
Total runoff volume (million gallons or million liters) https://www.epa.gov/sites/production/files/2019-02/documents/epaswmm5_1_manual_master_8-2-15.pdf, page 138
Units are LPS
I updated the reproducible example below:
repexp_swmmr_bug_read_outputfile.zip
pkgs_cran <- c("dplyr", "remotes", "sessioninfo")
install.packages(pkgs_cran, repos = "https://cran.rstudio.org")
#> Installiere Pakete nach 'C:/Users/mrustl/Documents/R/win-library/4.1'
#> (da 'lib' nicht spezifiziert)
#> package 'dplyr' successfully unpacked and MD5 sums checked
#> Warning: cannot remove prior installation of package 'dplyr'
#> Warning in file.copy(savedcopy, lib, recursive = TRUE): Problem C:
#> \Users\mrustl\Documents\R\win-library\4.1\00LOCK\dplyr\libs\x64\dplyr.dll
#> nach C:\Users\mrustl\Documents\R\win-library\4.1\dplyr\libs\x64\dplyr.dll zu
#> kopieren: Permission denied
#> Warning: restored 'dplyr'
#> package 'remotes' successfully unpacked and MD5 sums checked
#> package 'sessioninfo' successfully unpacked and MD5 sums checked
#>
#> The downloaded binary packages are in
#> C:\Users\mrustl\AppData\Local\Temp\Rtmp48tTGs\downloaded_packages
remotes::install_github("kwb-r/kwb.swmm")
#> Using github PAT from envvar GITHUB_PAT
#> Skipping install of 'kwb.swmm' from a github remote, the SHA1 (422cf550) has not changed since last install.
#> Use `force = TRUE` to force installation
paths_list <- list(
model_name = "zone-1_bioretention_cell.mulde_no-drainage_lidshare-0.00",
input = "<model_name>.inp",
output = "<model_name>.out",
report = "<model_name>.rpt"
)
paths <- kwb.utils::resolve(paths_list)
results_swmmr <- swmmr::read_out(file = paths$output,
iType = 3,
vIndex = c(1,4))
library(dplyr)
#>
#> Attache Paket: 'dplyr'
#> Die folgenden Objekte sind maskiert von 'package:stats':
#>
#> filter, lag
#> Die folgenden Objekte sind maskiert von 'package:base':
#>
#> intersect, setdiff, setequal, union
results_system <- kwb.swmm::get_results(path_out = paths$output) %>%
dplyr::select(- .data$datetime) %>%
dplyr::summarise(dplyr::across(tidyselect::everything(), list(sum = sum)))
identical(results_system$total_rainfall_sum,
sum(results_swmmr$system_variable$total_rainfall)
)
#> [1] TRUE
identical(sum(results_system$total_runoff_sum),
sum(results_swmmr$system_variable$total_runoff)
)
#> [1] TRUE
#### Input file for SWMM
readLines(paths$input)
#> [1] "[OPTIONS]"
#> [2] "FLOW_UNITS LPS"
#> [3] "INFILTRATION HORTON"
#> [4] "FLOW_ROUTING KINWAVE"
#> [5] "LINK_OFFSETS DEPTH"
#> [6] "MIN_SLOPE 0"
#> [7] "ALLOW_PONDING NO"
#> [8] "SKIP_STEADY_STATE NO"
#> [9] "IGNORE_SNOWMELT YES"
#> [10] "START_DATE 04/30/2008"
#> [11] "START_TIME 00:00:00"
#> [12] "REPORT_START_DATE 04/30/2008"
#> [13] "REPORT_START_TIME 00:00:00"
#> [14] "END_DATE 10/15/2019"
#> [15] "END_TIME 23:00:00"
#> [16] "SWEEP_START 01/01"
#> [17] "SWEEP_END 12/31"
#> [18] "DRY_DAYS 0"
#> [19] "REPORT_STEP 01:00:00"
#> [20] "WET_STEP 01:00:00"
#> [21] "DRY_STEP 01:00:00"
#> [22] "ROUTING_STEP 01:00:00"
#> [23] "RULE_STEP 00:00:00"
#> [24] "INERTIAL_DAMPING PARTIAL"
#> [25] "NORMAL_FLOW_LIMITED BOTH"
#> [26] "FORCE_MAIN_EQUATION H-W"
#> [27] "VARIABLE_STEP 0.75"
#> [28] "LENGTHENING_STEP 0"
#> [29] "MIN_SURFAREA 1.14"
#> [30] "MAX_TRIALS 8"
#> [31] "HEAD_TOLERANCE 0.0015"
#> [32] "SYS_FLOW_TOL 5"
#> [33] "LAT_FLOW_TOL 5"
#> [34] "MINIMUM_STEP 0.5"
#> [35] "THREADS 1"
#> [36] ""
#> [37] "[EVAPORATION]"
#> [38] " TEMPERATURE"
#> [39] "DRY_ONLY NO"
#> [40] ""
#> [41] "[TEMPERATURE]"
#> [42] "FILE \"C:\\Users\\mrustl\\Documents\\R\\win-library\\4.1\\keys.lid\\extdata\\rawdata\\weather_sponge_regions\\swmm_climeng_zone1_temp.txt\""
#> [43] "WINDSPEED FILE "
#> [44] "SNOWMELT 0 0.5 0.6 18 39 0"
#> [45] "ADC IMPERVIOUS 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0"
#> [46] "ADC PERVIOUS 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0"
#> [47] ""
#> [48] "[RAINGAGES]"
#> [49] "RainGage VOLUME 1:00 1 FILE \"C:\\Users\\mrustl\\Documents\\R\\win-library\\4.1\\keys.lid\\extdata\\rawdata\\weather_sponge_regions\\swmm_bwsti_zone1_rain_hourly.txt\" BWSTI MM"
#> [50] ""
#> [51] "[SUBCATCHMENTS]"
#> [52] "S1 RainGage Out1 0.1 100 6 0.5 0 snowPack1"
#> [53] ""
#> [54] "[SUBAREAS]"
#> [55] "S1 0.01 0.1 1 25 0 OUTLET "
#> [56] ""
#> [57] "[INFILTRATION]"
#> [58] "S1 700 350 80 5 90"
#> [59] ""
#> [60] "[LID_CONTROLS]"
#> [61] "bioretention_cell.mulde_no-drainage BC "
#> [62] "bioretention_cell.mulde_no-drainage SURFACE 300 0.05 0.3 4 5 "
#> [63] "bioretention_cell.mulde_no-drainage SOIL 500 0.437 0.105 0.047 30 0.5 0.047"
#> [64] ""
#> [65] "[LID_USAGE]"
#> [66] "S1 bioretention_cell.mulde_no-drainage 1 0 6 0 0 0 * * 0"
#> [67] ""
#> [68] "[SNOWPACKS]"
#> [69] "snowPack1 PLOWABLE 0.0001 0.0002 4 0.5 0.00 0.00 0.0"
#> [70] "snowPack1 IMPERVIOUS 0.0001 0.0002 4 0.5 0.00 0.00 50"
#> [71] "snowPack1 PERVIOUS 0.0001 0.0002 4 0.5 0.00 0.00 50"
#> [72] "snowPack1 REMOVAL 1.0 0.0 0.0 0.0 0.0 0.0"
#> [73] ""
#> [74] "[OUTFALLS]"
#> [75] "Out1 0 FREE NO "
#> [76] ""
#> [77] "[PATTERNS]"
#> [78] "Recovery MONTHLY 1.5 1.5 1.5 1.5 1.5 1.5"
#> [79] "Recovery 1.5 1.5 1.5 1.5 1.5 1.5"
#> [80] ""
#> [81] "[REPORT]"
#> [82] "SUBCATCHMENTS ALL"
#> [83] "NODES ALL"
#> [84] "LINKS ALL"
#> [85] ""
#> [86] "[MAP]"
#> [87] "DIMENSIONS 0.000 0.000 10000.000 10000.000"
#> [88] "Units None"
#> [89] ""
#> [90] "[COORDINATES]"
#> [91] "Out1 3384.528 6666.667"
#> [92] ""
#> [93] "[POLYGONS]"
#> [94] "S1 4613.197 6416.382"
#> [95] "S1 4670.08 4232.082"
#> [96] "S1 1985.21 4288.965"
#> [97] "S1 1962.457 6439.135"
#> [98] ""
#> [99] "[SYMBOLS]"
#> [100] "RainGage 1598.407 5426.621"
#> [101] ""
#### Report file by SWMM
readLines(paths$report)
#> Warning in readLines(paths$report): unvollständige letzte Zeile in
#> 'zone-1_bioretention_cell.mulde_no-drainage_lidshare-0.00.rpt' gefunden
#> [1] ""
#> [2] " EPA STORM WATER MANAGEMENT MODEL - VERSION 5.1 (Build 5.1.015)"
#> [3] " --------------------------------------------------------------"
#> [4] ""
#> [5] " "
#> [6] " *********************"
#> [7] " Rainfall File Summary"
#> [8] " *********************"
#> [9] " Station First Last Recording Periods Periods Periods"
#> [10] " ID Date Date Frequency w/Precip Missing Malfunc."
#> [11] " -------------------------------------------------------------------------------"
#> [12] " BWSTI 04/30/2008 10/15/2019 60 min 52957 0 0"
#> [13] ""
#> [14] " "
#> [15] " *********************************************************"
#> [16] " NOTE: The summary statistics displayed in this report are"
#> [17] " based on results found at every computational time step, "
#> [18] " not just on results from each reporting time step."
#> [19] " *********************************************************"
#> [20] " "
#> [21] " ****************"
#> [22] " Analysis Options"
#> [23] " ****************"
#> [24] " Flow Units ............... LPS"
#> [25] " Process Models:"
#> [26] " Rainfall/Runoff ........ YES"
#> [27] " RDII ................... NO"
#> [28] " Snowmelt ............... NO"
#> [29] " Groundwater ............ NO"
#> [30] " Flow Routing ........... NO"
#> [31] " Water Quality .......... NO"
#> [32] " Infiltration Method ...... HORTON"
#> [33] " Starting Date ............ 04/30/2008 00:00:00"
#> [34] " Ending Date .............. 10/15/2019 23:00:00"
#> [35] " Antecedent Dry Days ...... 0.0"
#> [36] " Report Time Step ......... 01:00:00"
#> [37] " Wet Time Step ............ 01:00:00"
#> [38] " Dry Time Step ............ 01:00:00"
#> [39] " "
#> [40] " "
#> [41] " ************************** Volume Depth"
#> [42] " Runoff Quantity Continuity hectare-m mm"
#> [43] " ************************** --------- -------"
#> [44] " Initial Snow Cover ....... 0.000 0.000"
#> [45] " Total Precipitation ...... 0.665 6654.460"
#> [46] " Evaporation Loss ......... 0.187 1874.825"
#> [47] " Infiltration Loss ........ 0.000 0.000"
#> [48] " Surface Runoff ........... 0.514 5140.936"
#> [49] " Snow Removed ............. 0.000 0.000"
#> [50] " Final Snow Cover ......... 0.000 0.000"
#> [51] " Final Storage ............ 0.000 0.000"
#> [52] " Continuity Error (%) ..... -5.429"
#> [53] " "
#> [54] " "
#> [55] " ************************** Volume Volume"
#> [56] " Flow Routing Continuity hectare-m 10^6 ltr"
#> [57] " ************************** --------- ---------"
#> [58] " Dry Weather Inflow ....... 0.000 0.000"
#> [59] " Wet Weather Inflow ....... 0.514 5.141"
#> [60] " Groundwater Inflow ....... 0.000 0.000"
#> [61] " RDII Inflow .............. 0.000 0.000"
#> [62] " External Inflow .......... 0.000 0.000"
#> [63] " External Outflow ......... 0.514 5.141"
#> [64] " Flooding Loss ............ 0.000 0.000"
#> [65] " Evaporation Loss ......... 0.000 0.000"
#> [66] " Exfiltration Loss ........ 0.000 0.000"
#> [67] " Initial Stored Volume .... 0.000 0.000"
#> [68] " Final Stored Volume ...... 0.000 0.000"
#> [69] " Continuity Error (%) ..... 0.000"
#> [70] " "
#> [71] " "
#> [72] " ***************************"
#> [73] " Subcatchment Runoff Summary"
#> [74] " ***************************"
#> [75] " "
#> [76] " ------------------------------------------------------------------------------------------------------------------------------"
#> [77] " Total Total Total Total Imperv Perv Total Total Peak Runoff"
#> [78] " Precip Runon Evap Infil Runoff Runoff Runoff Runoff Runoff Coeff"
#> [79] " Subcatchment mm mm mm mm mm mm mm 10^6 ltr LPS"
#> [80] " ------------------------------------------------------------------------------------------------------------------------------"
#> [81] " S1 6654.46 0.00 1874.83 0.00 5140.94 0.00 5140.94 5.14 5.79 0.773"
#> [82] " "
#> [83] ""
#> [84] " ***********************"
#> [85] " LID Performance Summary"
#> [86] " ***********************"
#> [87] ""
#> [88] " --------------------------------------------------------------------------------------------------------------------"
#> [89] " Total Evap Infil Surface Drain Initial Final Continuity"
#> [90] " Inflow Loss Loss Outflow Outflow Storage Storage Error"
#> [91] " Subcatchment LID Control mm mm mm mm mm mm mm %"
#> [92] " --------------------------------------------------------------------------------------------------------------------"
#> [93] ""
#> [94] " Analysis begun on: Tue Jun 15 20:01:34 2021"
#> [95] " Analysis ended on: Tue Jun 15 20:01:49 2021"
#> [96] " Total elapsed time: 00:00:15"
#### Report file by swmmr
rpt_file <- swmmr::read_rpt(x = paths$report)
swmmr_meta <- sessioninfo::package_info(pkgs = "swmmr", dependencies = FALSE)
knitr::kable(rpt_file$subcatchment_runoff_summary,
caption = sprintf("SWMM report file (imported with swmmr v %s, %s",
swmmr_meta$version,
swmmr_meta$source))
#> Error in if (!is.null(caption) && !is.na(caption) && !is.na(label)) caption = paste0(create_label(opts_knit$get("label.prefix")[["table"]], : Fehlender Wert, wo TRUE/FALSE nötig ist
## Different reporting in .rpt file and .out file ?
## bug in swmmr ????
rpt_file$subcatchment_runoff_summary$Total_Precip
#> [1] 6654.46
sum(results_swmmr$system_variable$total_rainfall)
#> [1] 6654.46
sum(results_system$total_rainfall)
#> Warning: Unknown or uninitialised column: `total_rainfall`.
#> [1] 0
rpt_file$subcatchment_runoff_summary$Total_Runoff_Depth
#> [1] 5140.94
sum(results_swmmr$system_variable$total_runoff)
#> [1] 1426.281
sum(results_system$total_runoff)
#> Warning: Unknown or uninitialised column: `total_runoff`.
#> [1] 0
#### Output file by swmmr
knitr::kable(results_system,
caption = sprintf("SWMM output file (imported with swmmr v %s, %s",
swmmr_meta$version,
swmmr_meta$source))
#> Error in if (!is.null(caption) && !is.na(caption) && !is.na(label)) caption = paste0(create_label(opts_knit$get("label.prefix")[["table"]], : Fehlender Wert, wo TRUE/FALSE nötig ist
### Sessioninfo
sessioninfo::session_info()
#> - Session info ---------------------------------------------------------------
#> setting value
#> version R version 4.1.0 (2021-05-18)
#> os Windows 10 x64
#> system x86_64, mingw32
#> ui RTerm
#> language (EN)
#> collate German_Germany.1252
#> ctype German_Germany.1252
#> tz Europe/Berlin
#> date 2021-06-16
#>
#> - Packages -------------------------------------------------------------------
#> package * version date lib source
#> cli 2.5.0 2021-04-26 [1] CRAN (R 4.1.0)
#> crayon 1.4.1 2021-02-08 [1] CRAN (R 4.1.0)
#> curl 4.3.1 2021-04-30 [1] CRAN (R 4.1.0)
#> data.table 1.14.0 2021-02-21 [1] CRAN (R 4.1.0)
#> digest 0.6.27 2020-10-24 [1] CRAN (R 4.1.0)
#> dplyr * 1.0.6 2021-05-05 [1] CRAN (R 4.1.0)
#> ellipsis 0.3.2 2021-04-29 [1] CRAN (R 4.1.0)
#> evaluate 0.14 2019-05-28 [1] CRAN (R 4.1.0)
#> fansi 0.5.0 2021-05-25 [1] CRAN (R 4.1.0)
#> fs 1.5.0 2020-07-31 [1] CRAN (R 4.1.0)
#> generics 0.1.0 2020-10-31 [1] CRAN (R 4.1.0)
#> glue 1.4.2 2020-08-27 [1] CRAN (R 4.1.0)
#> highr 0.9 2021-04-16 [1] CRAN (R 4.1.0)
#> hms 1.1.0 2021-05-17 [1] CRAN (R 4.1.0)
#> htmltools 0.5.1.1 2021-01-22 [1] CRAN (R 4.1.0)
#> knitr 1.33 2021-04-24 [1] CRAN (R 4.1.0)
#> kwb.event 0.3.0 2021-06-15 [1] Github (kwb-r/kwb.event@90cccfe)
#> kwb.swmm 0.0.0.9000 2021-06-16 [1] Github (kwb-r/kwb.swmm@422cf55)
#> kwb.utils 0.8.0 2021-06-16 [1] Github (kwb-r/kwb.utils@f58dba7)
#> lattice 0.20-44 2021-05-02 [2] CRAN (R 4.1.0)
#> lifecycle 1.0.0 2021-02-15 [1] CRAN (R 4.1.0)
#> magrittr 2.0.1 2020-11-17 [1] CRAN (R 4.1.0)
#> pillar 1.6.1 2021-05-16 [1] CRAN (R 4.1.0)
#> pkgconfig 2.0.3 2019-09-22 [1] CRAN (R 4.1.0)
#> ps 1.6.0 2021-02-28 [1] CRAN (R 4.1.0)
#> purrr 0.3.4 2020-04-17 [1] CRAN (R 4.1.0)
#> R6 2.5.0 2020-10-28 [1] CRAN (R 4.1.0)
#> Rcpp 1.0.6 2021-01-15 [1] CRAN (R 4.1.0)
#> readr 1.4.0 2020-10-05 [1] CRAN (R 4.1.0)
#> remotes 2.4.0 2021-06-02 [1] CRAN (R 4.1.0)
#> reprex 2.0.0 2021-04-02 [1] CRAN (R 4.1.0)
#> rlang 0.4.11 2021-04-30 [1] CRAN (R 4.1.0)
#> rmarkdown 2.8 2021-05-07 [1] CRAN (R 4.1.0)
#> rstudioapi 0.13 2020-11-12 [1] CRAN (R 4.1.0)
#> sessioninfo 1.1.1 2018-11-05 [1] CRAN (R 4.1.0)
#> stringi 1.6.1 2021-05-10 [1] CRAN (R 4.1.0)
#> stringr 1.4.0 2019-02-10 [1] CRAN (R 4.1.0)
#> swmmr 0.9.1 2020-03-02 [1] CRAN (R 4.1.0)
#> tibble 3.1.2 2021-05-16 [1] CRAN (R 4.1.0)
#> tidyr 1.1.3 2021-03-03 [1] CRAN (R 4.1.0)
#> tidyselect 1.1.1 2021-04-30 [1] CRAN (R 4.1.0)
#> utf8 1.2.1 2021-03-12 [1] CRAN (R 4.1.0)
#> vctrs 0.3.8 2021-04-29 [1] CRAN (R 4.1.0)
#> withr 2.4.2 2021-04-18 [1] CRAN (R 4.1.0)
#> xfun 0.23 2021-05-15 [1] CRAN (R 4.1.0)
#> xts 0.12.1 2020-09-09 [1] CRAN (R 4.1.0)
#> yaml 2.2.1 2020-02-01 [1] CRAN (R 4.1.0)
#> zoo 1.8-9 2021-03-09 [1] CRAN (R 4.1.0)
#>
#> [1] C:/Users/mrustl/Documents/R/win-library/4.1
#> [2] C:/Program Files/R/R-4.1.0/library
Created on 2021-06-16 by the reprex package (v2.0.0)
Now also switched to https://github.com/hsonne/swmmr/mydev ....
repexp_hsonne-swmmr-mydev_bug_read_outputfile.zip
pkgs_cran <- c("dplyr", "remotes", "sessioninfo")
install.packages(pkgs_cran, repos = "https://cran.rstudio.org")
#> Installiere Pakete nach 'C:/Users/mrustl/Documents/R/win-library/4.1'
#> (da 'lib' nicht spezifiziert)
#> package 'dplyr' successfully unpacked and MD5 sums checked
#> Warning: cannot remove prior installation of package 'dplyr'
#> Warning in file.copy(savedcopy, lib, recursive = TRUE): Problem C:
#> \Users\mrustl\Documents\R\win-library\4.1\00LOCK\dplyr\libs\x64\dplyr.dll
#> nach C:\Users\mrustl\Documents\R\win-library\4.1\dplyr\libs\x64\dplyr.dll zu
#> kopieren: Permission denied
#> Warning: restored 'dplyr'
#> package 'remotes' successfully unpacked and MD5 sums checked
#> package 'sessioninfo' successfully unpacked and MD5 sums checked
#>
#> The downloaded binary packages are in
#> C:\Users\mrustl\AppData\Local\Temp\RtmpknXncO\downloaded_packages
remotes::install_github("kwb-r/kwb.swmm")
#> Using github PAT from envvar GITHUB_PAT
#> Skipping install of 'kwb.swmm' from a github remote, the SHA1 (422cf550) has not changed since last install.
#> Use `force = TRUE` to force installation
paths_list <- list(
model_name = "zone-1_bioretention_cell.mulde_no-drainage_lidshare-0.00",
input = "<model_name>.inp",
output = "<model_name>.out",
report = "<model_name>.rpt"
)
paths <- kwb.utils::resolve(paths_list)
results_swmmr <- swmmr::read_out(file = paths$output,
iType = 3,
vIndex = c(1,4))
#> Reading time series 1/2 ... ok.
#> Reading time series 2/2 ... ok.
library(dplyr)
#>
#> Attache Paket: 'dplyr'
#> Die folgenden Objekte sind maskiert von 'package:stats':
#>
#> filter, lag
#> Die folgenden Objekte sind maskiert von 'package:base':
#>
#> intersect, setdiff, setequal, union
results_system <- kwb.swmm::get_results(path_out = paths$output) %>%
dplyr::select(- .data$datetime) %>%
dplyr::summarise(dplyr::across(tidyselect::everything(), list(sum = sum)))
#> Reading time series 1/14 ... ok.
#> Reading time series 2/14 ... ok.
#> Reading time series 3/14 ... ok.
#> Reading time series 4/14 ... ok.
#> Reading time series 5/14 ... ok.
#> Reading time series 6/14 ... ok.
#> Reading time series 7/14 ... ok.
#> Reading time series 8/14 ... ok.
#> Reading time series 9/14 ... ok.
#> Reading time series 10/14 ... ok.
#> Reading time series 11/14 ... ok.
#> Reading time series 12/14 ... ok.
#> Reading time series 13/14 ... ok.
#> Reading time series 14/14 ... ok.
identical(results_system$total_rainfall_sum,
sum(results_swmmr$system_variable$total_rainfall)
)
#> [1] TRUE
identical(sum(results_system$total_runoff_sum),
sum(results_swmmr$system_variable$total_runoff)
)
#> [1] TRUE
#### Input file for SWMM
readLines(paths$input)
#> [1] "[OPTIONS]"
#> [2] "FLOW_UNITS LPS"
#> [3] "INFILTRATION HORTON"
#> [4] "FLOW_ROUTING KINWAVE"
#> [5] "LINK_OFFSETS DEPTH"
#> [6] "MIN_SLOPE 0"
#> [7] "ALLOW_PONDING NO"
#> [8] "SKIP_STEADY_STATE NO"
#> [9] "IGNORE_SNOWMELT YES"
#> [10] "START_DATE 04/30/2008"
#> [11] "START_TIME 00:00:00"
#> [12] "REPORT_START_DATE 04/30/2008"
#> [13] "REPORT_START_TIME 00:00:00"
#> [14] "END_DATE 10/15/2019"
#> [15] "END_TIME 23:00:00"
#> [16] "SWEEP_START 01/01"
#> [17] "SWEEP_END 12/31"
#> [18] "DRY_DAYS 0"
#> [19] "REPORT_STEP 01:00:00"
#> [20] "WET_STEP 01:00:00"
#> [21] "DRY_STEP 01:00:00"
#> [22] "ROUTING_STEP 01:00:00"
#> [23] "RULE_STEP 00:00:00"
#> [24] "INERTIAL_DAMPING PARTIAL"
#> [25] "NORMAL_FLOW_LIMITED BOTH"
#> [26] "FORCE_MAIN_EQUATION H-W"
#> [27] "VARIABLE_STEP 0.75"
#> [28] "LENGTHENING_STEP 0"
#> [29] "MIN_SURFAREA 1.14"
#> [30] "MAX_TRIALS 8"
#> [31] "HEAD_TOLERANCE 0.0015"
#> [32] "SYS_FLOW_TOL 5"
#> [33] "LAT_FLOW_TOL 5"
#> [34] "MINIMUM_STEP 0.5"
#> [35] "THREADS 1"
#> [36] ""
#> [37] "[EVAPORATION]"
#> [38] " TEMPERATURE"
#> [39] "DRY_ONLY NO"
#> [40] ""
#> [41] "[TEMPERATURE]"
#> [42] "FILE \"C:\\Users\\mrustl\\Documents\\R\\win-library\\4.1\\keys.lid\\extdata\\rawdata\\weather_sponge_regions\\swmm_climeng_zone1_temp.txt\""
#> [43] "WINDSPEED FILE "
#> [44] "SNOWMELT 0 0.5 0.6 18 39 0"
#> [45] "ADC IMPERVIOUS 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0"
#> [46] "ADC PERVIOUS 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0"
#> [47] ""
#> [48] "[RAINGAGES]"
#> [49] "RainGage VOLUME 1:00 1 FILE \"C:\\Users\\mrustl\\Documents\\R\\win-library\\4.1\\keys.lid\\extdata\\rawdata\\weather_sponge_regions\\swmm_bwsti_zone1_rain_hourly.txt\" BWSTI MM"
#> [50] ""
#> [51] "[SUBCATCHMENTS]"
#> [52] "S1 RainGage Out1 0.1 100 6 0.5 0 snowPack1"
#> [53] ""
#> [54] "[SUBAREAS]"
#> [55] "S1 0.01 0.1 1 25 0 OUTLET "
#> [56] ""
#> [57] "[INFILTRATION]"
#> [58] "S1 700 350 80 5 90"
#> [59] ""
#> [60] "[LID_CONTROLS]"
#> [61] "bioretention_cell.mulde_no-drainage BC "
#> [62] "bioretention_cell.mulde_no-drainage SURFACE 300 0.05 0.3 4 5 "
#> [63] "bioretention_cell.mulde_no-drainage SOIL 500 0.437 0.105 0.047 30 0.5 0.047"
#> [64] ""
#> [65] "[LID_USAGE]"
#> [66] "S1 bioretention_cell.mulde_no-drainage 1 0 6 0 0 0 * * 0"
#> [67] ""
#> [68] "[SNOWPACKS]"
#> [69] "snowPack1 PLOWABLE 0.0001 0.0002 4 0.5 0.00 0.00 0.0"
#> [70] "snowPack1 IMPERVIOUS 0.0001 0.0002 4 0.5 0.00 0.00 50"
#> [71] "snowPack1 PERVIOUS 0.0001 0.0002 4 0.5 0.00 0.00 50"
#> [72] "snowPack1 REMOVAL 1.0 0.0 0.0 0.0 0.0 0.0"
#> [73] ""
#> [74] "[OUTFALLS]"
#> [75] "Out1 0 FREE NO "
#> [76] ""
#> [77] "[PATTERNS]"
#> [78] "Recovery MONTHLY 1.5 1.5 1.5 1.5 1.5 1.5"
#> [79] "Recovery 1.5 1.5 1.5 1.5 1.5 1.5"
#> [80] ""
#> [81] "[REPORT]"
#> [82] "SUBCATCHMENTS ALL"
#> [83] "NODES ALL"
#> [84] "LINKS ALL"
#> [85] ""
#> [86] "[MAP]"
#> [87] "DIMENSIONS 0.000 0.000 10000.000 10000.000"
#> [88] "Units None"
#> [89] ""
#> [90] "[COORDINATES]"
#> [91] "Out1 3384.528 6666.667"
#> [92] ""
#> [93] "[POLYGONS]"
#> [94] "S1 4613.197 6416.382"
#> [95] "S1 4670.08 4232.082"
#> [96] "S1 1985.21 4288.965"
#> [97] "S1 1962.457 6439.135"
#> [98] ""
#> [99] "[SYMBOLS]"
#> [100] "RainGage 1598.407 5426.621"
#> [101] ""
#### Report file by SWMM
readLines(paths$report)
#> Warning in readLines(paths$report): unvollständige letzte Zeile in
#> 'zone-1_bioretention_cell.mulde_no-drainage_lidshare-0.00.rpt' gefunden
#> [1] ""
#> [2] " EPA STORM WATER MANAGEMENT MODEL - VERSION 5.1 (Build 5.1.015)"
#> [3] " --------------------------------------------------------------"
#> [4] ""
#> [5] " "
#> [6] " *********************"
#> [7] " Rainfall File Summary"
#> [8] " *********************"
#> [9] " Station First Last Recording Periods Periods Periods"
#> [10] " ID Date Date Frequency w/Precip Missing Malfunc."
#> [11] " -------------------------------------------------------------------------------"
#> [12] " BWSTI 04/30/2008 10/15/2019 60 min 52957 0 0"
#> [13] ""
#> [14] " "
#> [15] " *********************************************************"
#> [16] " NOTE: The summary statistics displayed in this report are"
#> [17] " based on results found at every computational time step, "
#> [18] " not just on results from each reporting time step."
#> [19] " *********************************************************"
#> [20] " "
#> [21] " ****************"
#> [22] " Analysis Options"
#> [23] " ****************"
#> [24] " Flow Units ............... LPS"
#> [25] " Process Models:"
#> [26] " Rainfall/Runoff ........ YES"
#> [27] " RDII ................... NO"
#> [28] " Snowmelt ............... NO"
#> [29] " Groundwater ............ NO"
#> [30] " Flow Routing ........... NO"
#> [31] " Water Quality .......... NO"
#> [32] " Infiltration Method ...... HORTON"
#> [33] " Starting Date ............ 04/30/2008 00:00:00"
#> [34] " Ending Date .............. 10/15/2019 23:00:00"
#> [35] " Antecedent Dry Days ...... 0.0"
#> [36] " Report Time Step ......... 01:00:00"
#> [37] " Wet Time Step ............ 01:00:00"
#> [38] " Dry Time Step ............ 01:00:00"
#> [39] " "
#> [40] " "
#> [41] " ************************** Volume Depth"
#> [42] " Runoff Quantity Continuity hectare-m mm"
#> [43] " ************************** --------- -------"
#> [44] " Initial Snow Cover ....... 0.000 0.000"
#> [45] " Total Precipitation ...... 0.665 6654.460"
#> [46] " Evaporation Loss ......... 0.187 1874.825"
#> [47] " Infiltration Loss ........ 0.000 0.000"
#> [48] " Surface Runoff ........... 0.514 5140.936"
#> [49] " Snow Removed ............. 0.000 0.000"
#> [50] " Final Snow Cover ......... 0.000 0.000"
#> [51] " Final Storage ............ 0.000 0.000"
#> [52] " Continuity Error (%) ..... -5.429"
#> [53] " "
#> [54] " "
#> [55] " ************************** Volume Volume"
#> [56] " Flow Routing Continuity hectare-m 10^6 ltr"
#> [57] " ************************** --------- ---------"
#> [58] " Dry Weather Inflow ....... 0.000 0.000"
#> [59] " Wet Weather Inflow ....... 0.514 5.141"
#> [60] " Groundwater Inflow ....... 0.000 0.000"
#> [61] " RDII Inflow .............. 0.000 0.000"
#> [62] " External Inflow .......... 0.000 0.000"
#> [63] " External Outflow ......... 0.514 5.141"
#> [64] " Flooding Loss ............ 0.000 0.000"
#> [65] " Evaporation Loss ......... 0.000 0.000"
#> [66] " Exfiltration Loss ........ 0.000 0.000"
#> [67] " Initial Stored Volume .... 0.000 0.000"
#> [68] " Final Stored Volume ...... 0.000 0.000"
#> [69] " Continuity Error (%) ..... 0.000"
#> [70] " "
#> [71] " "
#> [72] " ***************************"
#> [73] " Subcatchment Runoff Summary"
#> [74] " ***************************"
#> [75] " "
#> [76] " ------------------------------------------------------------------------------------------------------------------------------"
#> [77] " Total Total Total Total Imperv Perv Total Total Peak Runoff"
#> [78] " Precip Runon Evap Infil Runoff Runoff Runoff Runoff Runoff Coeff"
#> [79] " Subcatchment mm mm mm mm mm mm mm 10^6 ltr LPS"
#> [80] " ------------------------------------------------------------------------------------------------------------------------------"
#> [81] " S1 6654.46 0.00 1874.83 0.00 5140.94 0.00 5140.94 5.14 5.79 0.773"
#> [82] " "
#> [83] ""
#> [84] " ***********************"
#> [85] " LID Performance Summary"
#> [86] " ***********************"
#> [87] ""
#> [88] " --------------------------------------------------------------------------------------------------------------------"
#> [89] " Total Evap Infil Surface Drain Initial Final Continuity"
#> [90] " Inflow Loss Loss Outflow Outflow Storage Storage Error"
#> [91] " Subcatchment LID Control mm mm mm mm mm mm mm %"
#> [92] " --------------------------------------------------------------------------------------------------------------------"
#> [93] ""
#> [94] " Analysis begun on: Tue Jun 15 20:01:34 2021"
#> [95] " Analysis ended on: Tue Jun 15 20:01:49 2021"
#> [96] " Total elapsed time: 00:00:15"
#### Report file by swmmr
rpt_file <- swmmr::read_rpt(x = paths$report)
swmmr_meta <- sessioninfo::package_info(pkgs = "swmmr", dependencies = FALSE)
knitr::kable(rpt_file$subcatchment_runoff_summary,
caption = sprintf("SWMM output file (imported with swmmr v %s, %s",
swmmr_meta$loadedversion,
swmmr_meta$source))
Subcatchment | Total_Precip | Total_Runon | Total_Evap | Total_Infil | Total_Runoff_Depth | Total_Runoff_Volume | Total_Peak_Runoff | Total_Runoff_Coeff |
---|---|---|---|---|---|---|---|---|
S1 | 6654.46 | 0 | 1874.83 | 0 | 5140.94 | 0 | 5140.94 | 5.14 5.79 0.773 |
SWMM output file (imported with swmmr v 0.8.1.9000, Github (hsonne/swmmr@2ede3fa)
## Different reporting in .rpt file and .out file ?
## bug in swmmr ????
rpt_file$subcatchment_runoff_summary$Total_Precip
#> [1] 6654.46
sum(results_swmmr$system_variable$total_rainfall)
#> [1] 6654.46
sum(results_system$total_rainfall)
#> Warning: Unknown or uninitialised column: `total_rainfall`.
#> [1] 0
rpt_file$subcatchment_runoff_summary$Total_Runoff_Depth
#> [1] 5140.94
sum(results_swmmr$system_variable$total_runoff)
#> [1] 1426.281
sum(results_system$total_runoff)
#> Warning: Unknown or uninitialised column: `total_runoff`.
#> [1] 0
#### Output file by swmmr
knitr::kable(results_system,
caption = sprintf("SWMM output file (imported with swmmr v %s, %s",
swmmr_meta$loadedversion,
swmmr_meta$source))
total_rainfall_sum | total_snow_depth_sum | average_losses_sum | total_runoff_sum | total_dry_weather_inflow_sum | total_groundwater_inflow_sum | total_RDII_inflow_sum | total_external_inflow_sum | total_direct_inflow_sum | total_external_flooding_sum | total_outflow_from_outfalls_sum | total_nodal_storage_volume_sum | potential_evaporation_sum | actual_evaporation_sum |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
6654.46 | 0 | 0 | 1426.281 | 0 | 0 | 0 | 0 | 1426.281 | 0 | 1428.046 | 0 | 44995.81 | 233296 |
SWMM output file (imported with swmmr v 0.8.1.9000, Github (hsonne/swmmr@2ede3fa)
### Sessioninfo
sessioninfo::session_info()
#> - Session info ---------------------------------------------------------------
#> setting value
#> version R version 4.1.0 (2021-05-18)
#> os Windows 10 x64
#> system x86_64, mingw32
#> ui RTerm
#> language (EN)
#> collate German_Germany.1252
#> ctype German_Germany.1252
#> tz Europe/Berlin
#> date 2021-06-16
#>
#> - Packages -------------------------------------------------------------------
#> package * version date lib source
#> cli 2.5.0 2021-04-26 [1] CRAN (R 4.1.0)
#> crayon 1.4.1 2021-02-08 [1] CRAN (R 4.1.0)
#> curl 4.3.1 2021-04-30 [1] CRAN (R 4.1.0)
#> data.table 1.14.0 2021-02-21 [1] CRAN (R 4.1.0)
#> digest 0.6.27 2020-10-24 [1] CRAN (R 4.1.0)
#> dplyr * 1.0.6 2021-05-05 [1] CRAN (R 4.1.0)
#> ellipsis 0.3.2 2021-04-29 [1] CRAN (R 4.1.0)
#> evaluate 0.14 2019-05-28 [1] CRAN (R 4.1.0)
#> fansi 0.5.0 2021-05-25 [1] CRAN (R 4.1.0)
#> fs 1.5.0 2020-07-31 [1] CRAN (R 4.1.0)
#> generics 0.1.0 2020-10-31 [1] CRAN (R 4.1.0)
#> glue 1.4.2 2020-08-27 [1] CRAN (R 4.1.0)
#> highr 0.9 2021-04-16 [1] CRAN (R 4.1.0)
#> hms 1.1.0 2021-05-17 [1] CRAN (R 4.1.0)
#> htmltools 0.5.1.1 2021-01-22 [1] CRAN (R 4.1.0)
#> knitr 1.33 2021-04-24 [1] CRAN (R 4.1.0)
#> kwb.event 0.3.0 2021-06-15 [1] Github (kwb-r/kwb.event@90cccfe)
#> kwb.swmm 0.0.0.9000 2021-06-16 [1] Github (kwb-r/kwb.swmm@422cf55)
#> kwb.utils 0.8.0 2021-06-16 [1] Github (kwb-r/kwb.utils@f58dba7)
#> lattice 0.20-44 2021-05-02 [2] CRAN (R 4.1.0)
#> lifecycle 1.0.0 2021-02-15 [1] CRAN (R 4.1.0)
#> magrittr 2.0.1 2020-11-17 [1] CRAN (R 4.1.0)
#> pillar 1.6.1 2021-05-16 [1] CRAN (R 4.1.0)
#> pkgconfig 2.0.3 2019-09-22 [1] CRAN (R 4.1.0)
#> ps 1.6.0 2021-02-28 [1] CRAN (R 4.1.0)
#> purrr 0.3.4 2020-04-17 [1] CRAN (R 4.1.0)
#> R6 2.5.0 2020-10-28 [1] CRAN (R 4.1.0)
#> Rcpp 1.0.6 2021-01-15 [1] CRAN (R 4.1.0)
#> readr 1.4.0 2020-10-05 [1] CRAN (R 4.1.0)
#> remotes 2.4.0 2021-06-02 [1] CRAN (R 4.1.0)
#> reprex 2.0.0 2021-04-02 [1] CRAN (R 4.1.0)
#> rlang 0.4.11 2021-04-30 [1] CRAN (R 4.1.0)
#> rmarkdown 2.8 2021-05-07 [1] CRAN (R 4.1.0)
#> rstudioapi 0.13 2020-11-12 [1] CRAN (R 4.1.0)
#> sessioninfo 1.1.1 2018-11-05 [1] CRAN (R 4.1.0)
#> stringi 1.6.1 2021-05-10 [1] CRAN (R 4.1.0)
#> stringr 1.4.0 2019-02-10 [1] CRAN (R 4.1.0)
#> swmmr 0.8.1.9000 2021-06-16 [1] Github (hsonne/swmmr@2ede3fa)
#> tibble 3.1.2 2021-05-16 [1] CRAN (R 4.1.0)
#> tidyr 1.1.3 2021-03-03 [1] CRAN (R 4.1.0)
#> tidyselect 1.1.1 2021-04-30 [1] CRAN (R 4.1.0)
#> utf8 1.2.1 2021-03-12 [1] CRAN (R 4.1.0)
#> vctrs 0.3.8 2021-04-29 [1] CRAN (R 4.1.0)
#> withr 2.4.2 2021-04-18 [1] CRAN (R 4.1.0)
#> xfun 0.23 2021-05-15 [1] CRAN (R 4.1.0)
#> xts 0.12.1 2020-09-09 [1] CRAN (R 4.1.0)
#> yaml 2.2.1 2020-02-01 [1] CRAN (R 4.1.0)
#> zoo 1.8-9 2021-03-09 [1] CRAN (R 4.1.0)
#>
#> [1] C:/Users/mrustl/Documents/R/win-library/4.1
#> [2] C:/Program Files/R/R-4.1.0/library
Created on 2021-06-16 by the reprex package (v2.0.0)
I am stupid .... units in output file are different for different variables....ideally the unit harmonisation
should be done in kwb.swmm
in order to work with a clean
dataset ?
Reproducible example for bug identified with @amatzi in
keys.lid
(see https://github.com/KWB-R/keys.lid/issues/17). Output files in attachment swmmr_bug_read_outputfile.zipNeeds to be fixed in upstream R package https://github.com/dleutnant/swmmr/ and an issue should be opened....
Created on 2021-06-15 by the reprex package (v2.0.0)