swmmr icon indicating copy to clipboard operation
swmmr copied to clipboard

BugReport: Total Inflow Not Correctly Read from .out File

Open robermei opened this issue 5 years ago • 34 comments

Hi

I noticed a discrepancy between the total-inflow values delivered by SWMM/PCSWMM and the ones read out via swmmr.

To reproduce the error I first ran the following simple script to manually read out the total inflow at node "370595" (re-naming did not solve the issue):

files <- run_swmm("model.inp") flows <- read_out(file = files$out, iType = 1, object_name = "370595", vIndex = 4)[["370595"]]$total_inflow

Afterwards I ran the simulation in PCSWMM and compared the values to the ones given by swmmr. Here just a small excerpt of observed values:

Result SWMMR: 2019-06-08 03:00:00 6.977733e-04 2019-06-08 03:01:00 8.808837e-04 2019-06-08 03:02:00 3.345804e-05 2019-06-08 03:03:00 0.000000e+00 2019-06-08 03:04:00 0.000000e+00 2019-06-08 03:05:00 8.340256e-06 2019-06-08 03:06:00 6.539986e-04 2019-06-08 03:07:00 2.752108e-04 2019-06-08 03:08:00 0.000000e+00 2019-06-08 03:09:00 2.639531e-02 2019-06-08 03:10:00 2.516844e-03

Result PCSWMM: 6/8/2019 3:00:00 AM 61.44199 6/8/2019 3:01:00 AM 59.80343 6/8/2019 3:02:00 AM 61.03724 6/8/2019 3:03:00 AM 59.52657 6/8/2019 3:04:00 AM 57.62031 6/8/2019 3:05:00 AM 58.26693 6/8/2019 3:06:00 AM 57.04595 6/8/2019 3:07:00 AM 55.9104 6/8/2019 3:08:00 AM 55.7011 6/8/2019 3:09:00 AM 55.64355 6/8/2019 3:10:00 AM 53.72362

Attached you'll find the model where the issue occurs (to upload, I had to add the ".txt" extension...), when trying to read out the inflow at node "370595".

Some additional information about my environment:

OS: Windows 10 Education R Version: 4.02 R Studio: 1.3.959 swmmr Version: 0.9.1 swmm engine: SWMM5.1.013 PCSWMM Version: 7.2.2785 (64-bit)

Do you need additional information?

Could this be an issue in the library, or does it stem from incorrect use?

Best regards Robert model.inp.txt

robermei avatar Jul 08 '20 08:07 robermei

I get the the same results like PCSWMM...


library(swmmr)

model <- "/Users/dominik/Downloads/model.inp"

files <- run_swmm(inp = model)
#> Argumente 'minimized' und 'invisible' sind nur für Windows

flows <- read_out(file = files$out, iType = 1, object_name = "370595", vIndex = 4)[["370595"]]$total_inflow

head(flows["2019-06-08 03:00:00/"])
#> Warning: timezone of object (GMT) is different than current timezone ().
#>                         [,1]
#> 2019-06-08 03:00:00 61.44199
#> 2019-06-08 03:01:00 59.80343
#> 2019-06-08 03:02:00 61.03724
#> 2019-06-08 03:03:00 59.52657
#> 2019-06-08 03:04:00 57.62031
#> 2019-06-08 03:05:00 58.26693

Created on 2020-07-08 by the reprex package (v0.3.0)

dleutnant avatar Jul 08 '20 13:07 dleutnant

Is there any additional information I can provide to help reproduce the error?

robermei avatar Jul 09 '20 06:07 robermei

Could you test SWMM 5.1.014? (which would be highly surprising, if the error would still occur...)

dleutnant avatar Jul 09 '20 06:07 dleutnant

Are you using R 32 or 64 bit?

dleutnant avatar Jul 09 '20 06:07 dleutnant

The error unfortunately still occurs with SWMM 5.1.014. I use a 64bit R version: platform x86_64-w64-mingw32 arch x86_64 os mingw32 system x86_64, mingw32 status major 4 minor 0.2 year 2020 month 06 day 22 svn rev 78730 language R version.string R version 4.0.2 (2020-06-22)

I attached my out-file as well (again, added the .txt ending), maybe that helps. This file was generated by swmmr, using SWMM 5.1.014 for the model attached in the first post.

model.out.txt

robermei avatar Jul 09 '20 07:07 robermei

Your .out file seems to be ok?! Could you eventually restart R and your system?

library(swmmr)
flows <- read_out(file = "/Users/dominik/Downloads/model.out.txt", iType = 1, object_name = "370595", vIndex = 4)[["370595"]]$total_inflow

head(flows["2019-06-08 03:00:00/"])
#> Warning: timezone of object (GMT) is different than current timezone ().
#>                         [,1]
#> 2019-06-08 03:00:00 61.44199
#> 2019-06-08 03:01:00 59.80343
#> 2019-06-08 03:02:00 61.03724
#> 2019-06-08 03:03:00 59.52657
#> 2019-06-08 03:04:00 57.62031
#> 2019-06-08 03:05:00 58.26693

Created on 2020-07-09 by the reprex package (v0.3.0)

dleutnant avatar Jul 09 '20 07:07 dleutnant

Did you install {swmmr} from CRAN or GitHub?

dleutnant avatar Jul 09 '20 07:07 dleutnant

Hi I also have the same problem. I downloaded the out file and have used your code: flows <- read_out(file = "model.out.txt", iType = 1, object_name = "370595", vIndex = 4)[["370595"]]$total_inflow and I get the as output: head(flows["2019-06-08 03:00:00/"]) [,1] 2019-06-08 03:00:00 6.977733e-04 2019-06-08 03:01:00 8.808837e-04 2019-06-08 03:02:00 3.345804e-05 2019-06-08 03:03:00 0.000000e+00 2019-06-08 03:04:00 0.000000e+00 2019-06-08 03:05:00 8.340256e-06

swmmr from CRAN

FranzTG avatar Jul 09 '20 08:07 FranzTG

Interesting. Are all of your packages updated? I still cannot reproduce the error (now used Mac OS and Win OS (cf. below)).


library(swmmr)
#> Warning: package 'swmmr' was built under R version 3.6.3

flows <- read_out(file = "c:/Users/leutnant/Downloads/model.out.txt", iType = 1, object_name = "370595", vIndex = 4)[["370595"]]$total_inflow

head(flows["2019-06-08 03:00:00/"])
#> Warning: timezone of object (GMT) is different than current timezone ().
#>                         [,1]
#> 2019-06-08 03:00:00 61.44199
#> 2019-06-08 03:01:00 59.80343
#> 2019-06-08 03:02:00 61.03724
#> 2019-06-08 03:03:00 59.52657
#> 2019-06-08 03:04:00 57.62031
#> 2019-06-08 03:05:00 58.26693

Created on 2020-07-09 by the reprex package (v0.3.0)

Session info
devtools::session_info()
#> - Session info ---------------------------------------------------------------
#>  setting  value                       
#>  version  R version 3.6.1 (2019-07-05)
#>  os       Windows Server x64          
#>  system   x86_64, mingw32             
#>  ui       RTerm                       
#>  language (EN)                        
#>  collate  German_Germany.1252         
#>  ctype    German_Germany.1252         
#>  tz       Europe/Berlin               
#>  date     2020-07-09                  
#> 
#> - Packages -------------------------------------------------------------------
#>  package     * version date       lib source        
#>  assertthat    0.2.1   2019-03-21 [1] CRAN (R 3.6.1)
#>  backports     1.1.8   2020-06-17 [1] CRAN (R 3.6.1)
#>  callr         3.4.3   2020-03-28 [1] CRAN (R 3.6.3)
#>  cli           2.0.2   2020-02-28 [1] CRAN (R 3.6.3)
#>  crayon        1.3.4   2017-09-16 [1] CRAN (R 3.6.1)
#>  desc          1.2.0   2018-05-01 [1] CRAN (R 3.6.2)
#>  devtools      2.3.0   2020-04-10 [1] CRAN (R 3.6.3)
#>  digest        0.6.25  2020-02-23 [1] CRAN (R 3.6.3)
#>  ellipsis      0.3.1   2020-05-15 [1] CRAN (R 3.6.3)
#>  evaluate      0.14    2019-05-28 [1] CRAN (R 3.6.1)
#>  fansi         0.4.1   2020-01-08 [1] CRAN (R 3.6.2)
#>  fs            1.4.2   2020-06-30 [1] CRAN (R 3.6.3)
#>  glue          1.4.1   2020-05-13 [1] CRAN (R 3.6.3)
#>  highr         0.8     2019-03-20 [1] CRAN (R 3.6.1)
#>  htmltools     0.5.0   2020-06-16 [1] CRAN (R 3.6.3)
#>  knitr         1.29    2020-06-23 [1] CRAN (R 3.6.3)
#>  lattice       0.20-38 2018-11-04 [2] CRAN (R 3.6.1)
#>  magrittr      1.5     2014-11-22 [1] CRAN (R 3.6.1)
#>  memoise       1.1.0   2017-04-21 [1] CRAN (R 3.6.2)
#>  pkgbuild      1.0.8   2020-05-07 [1] CRAN (R 3.6.3)
#>  pkgload       1.1.0   2020-05-29 [1] CRAN (R 3.6.3)
#>  prettyunits   1.1.1   2020-01-24 [1] CRAN (R 3.6.2)
#>  processx      3.4.3   2020-07-05 [1] CRAN (R 3.6.3)
#>  ps            1.3.3   2020-05-08 [1] CRAN (R 3.6.3)
#>  purrr         0.3.4   2020-04-17 [1] CRAN (R 3.6.3)
#>  R6            2.4.1   2019-11-12 [1] CRAN (R 3.6.2)
#>  Rcpp          1.0.5   2020-07-06 [1] CRAN (R 3.6.1)
#>  remotes       2.1.1   2020-02-15 [1] CRAN (R 3.6.3)
#>  rlang         0.4.6   2020-05-02 [1] CRAN (R 3.6.3)
#>  rmarkdown     2.3     2020-06-18 [1] CRAN (R 3.6.3)
#>  rprojroot     1.3-2   2018-01-03 [1] CRAN (R 3.6.2)
#>  sessioninfo   1.1.1   2018-11-05 [1] CRAN (R 3.6.2)
#>  stringi       1.4.6   2020-02-17 [1] CRAN (R 3.6.2)
#>  stringr       1.4.0   2019-02-10 [1] CRAN (R 3.6.1)
#>  swmmr       * 0.9.1   2020-03-02 [1] CRAN (R 3.6.3)
#>  testthat      2.3.2   2020-03-02 [1] CRAN (R 3.6.3)
#>  usethis       1.6.1   2020-04-29 [1] CRAN (R 3.6.3)
#>  withr         2.2.0   2020-04-20 [1] CRAN (R 3.6.3)
#>  xfun          0.15    2020-06-21 [1] CRAN (R 3.6.3)
#>  xts           0.12-0  2020-01-19 [1] CRAN (R 3.6.2)
#>  yaml          2.2.1   2020-02-01 [1] CRAN (R 3.6.1)
#>  zoo           1.8-8   2020-05-02 [1] CRAN (R 3.6.3)
#> 
#> [1] C:/Users/leutnant/library
#> [2] C:/Program Files/R/R-3.6.1/library

dleutnant avatar Jul 09 '20 08:07 dleutnant

That is my session info.

  • Session info -------------------------------------------------------------------------------------------------------- setting value
    version R version 4.0.2 (2020-06-22) os Windows 10 x64
    system x86_64, mingw32
    ui RStudio
    language (EN)
    collate English_United States.1252
    ctype English_United States.1252
    tz Europe/Berlin
    date 2020-07-09

  • Packages ------------------------------------------------------------------------------------------------------------ package * version date lib source
    assertthat 0.2.1 2019-03-21 [1] CRAN (R 4.0.2) backports 1.1.8 2020-06-17 [1] CRAN (R 4.0.2) callr 3.4.3 2020-03-28 [1] CRAN (R 4.0.2) cli 2.0.2 2020-02-28 [1] CRAN (R 4.0.2) crayon 1.3.4 2017-09-16 [1] CRAN (R 4.0.2) desc 1.2.0 2018-05-01 [1] CRAN (R 4.0.2) devtools * 2.3.0 2020-04-10 [1] CRAN (R 4.0.2) digest 0.6.25 2020-02-23 [1] CRAN (R 4.0.2) ellipsis 0.3.1 2020-05-15 [1] CRAN (R 4.0.2) fansi 0.4.1 2020-01-08 [1] CRAN (R 4.0.2) fs 1.4.2 2020-06-30 [1] CRAN (R 4.0.2) glue 1.4.1 2020-05-13 [1] CRAN (R 4.0.2) lattice 0.20-41 2020-04-02 [2] CRAN (R 4.0.2) magrittr 1.5 2014-11-22 [1] CRAN (R 4.0.2) memoise 1.1.0 2017-04-21 [1] CRAN (R 4.0.2) pkgbuild 1.0.8 2020-05-07 [1] CRAN (R 4.0.2) pkgload 1.1.0 2020-05-29 [1] CRAN (R 4.0.2) prettyunits 1.1.1 2020-01-24 [1] CRAN (R 4.0.2) processx 3.4.3 2020-07-05 [1] CRAN (R 4.0.2) ps 1.3.3 2020-05-08 [1] CRAN (R 4.0.2) purrr 0.3.4 2020-04-17 [1] CRAN (R 4.0.2) R6 2.4.1 2019-11-12 [1] CRAN (R 4.0.2) Rcpp 1.0.5 2020-07-06 [1] CRAN (R 4.0.2) remotes 2.1.1 2020-02-15 [1] CRAN (R 4.0.2) rlang 0.4.6 2020-05-02 [1] CRAN (R 4.0.2) rprojroot 1.3-2 2018-01-03 [1] CRAN (R 4.0.2) rstudioapi 0.11 2020-02-07 [1] CRAN (R 4.0.2) sessioninfo 1.1.1 2018-11-05 [1] CRAN (R 4.0.2) swmmr * 0.9.1 2020-03-02 [1] CRAN (R 4.0.2) testthat 2.3.2 2020-03-02 [1] CRAN (R 4.0.2) usethis * 1.6.1 2020-04-29 [1] CRAN (R 4.0.2) withr 2.2.0 2020-04-20 [1] CRAN (R 4.0.2) xts 0.12-0 2020-01-19 [1] CRAN (R 4.0.2) zoo 1.8-8 2020-05-02 [1] CRAN (R 4.0.2)

FranzTG avatar Jul 09 '20 08:07 FranzTG

Re-booting and re-installing the library via CRAN did not help. I also re-installed the library from github via remotes::install_github("dleutnant/swmmr") (+reboot) without effect.

BUT

after seeing your session info, I reverted my R version: version R version 3.6.1 (2019-07-05)

and now it works fine:

...
print(head(flows["2019-06-08 03:00:00/"]))
                      
2019-06-08 03:00:00 61.44199
2019-06-08 03:01:00 59.80343
2019-06-08 03:02:00 61.03724

so the error seems to be connected to the new R version @FranzTG and I were using (4.02).

robermei avatar Jul 09 '20 09:07 robermei

Confirmed. Using R 4.0.2 on a Win OS machine I get the same incorrect results. With Mac OS and R 4.0.2. the results are OK...

dleutnant avatar Jul 09 '20 09:07 dleutnant

The issue is related to the new rtools40 toolchain. Following the steps given here https://cran.r-project.org/bin/windows/Rtools/ and finally executing install.packages("swmmr", type = "source") I was able to solve this issue.


library(swmmr)

flows <- read_out(file = "c:/Users/leutnant/Downloads/model.out.txt", iType = 1, object_name = "370595", vIndex = 4)[["370595"]]$total_inflow

head(flows["2019-06-08 03:00:00/"])
#> Warning: timezone of object (GMT) is different than current timezone ().
#>                         [,1]
#> 2019-06-08 03:00:00 61.44199
#> 2019-06-08 03:01:00 59.80343
#> 2019-06-08 03:02:00 61.03724
#> 2019-06-08 03:03:00 59.52657
#> 2019-06-08 03:04:00 57.62031
#> 2019-06-08 03:05:00 58.26693

Created on 2020-07-09 by the reprex package (v0.3.0)

Session info
devtools::session_info()
#> - Session info ---------------------------------------------------------------
#>  setting  value                       
#>  version  R version 4.0.2 (2020-06-22)
#>  os       Windows Server x64          
#>  system   x86_64, mingw32             
#>  ui       RTerm                       
#>  language (EN)                        
#>  collate  German_Germany.1252         
#>  ctype    German_Germany.1252         
#>  tz       Europe/Berlin               
#>  date     2020-07-09                  
#> 
#> - Packages -------------------------------------------------------------------
#>  package     * version date       lib source        
#>  assertthat    0.2.1   2019-03-21 [1] CRAN (R 4.0.2)
#>  backports     1.1.7   2020-05-13 [1] CRAN (R 4.0.0)
#>  callr         3.4.3   2020-03-28 [1] CRAN (R 4.0.2)
#>  cli           2.0.2   2020-02-28 [1] CRAN (R 4.0.2)
#>  crayon        1.3.4   2017-09-16 [1] CRAN (R 4.0.2)
#>  desc          1.2.0   2018-05-01 [1] CRAN (R 4.0.2)
#>  devtools      2.3.0   2020-04-10 [1] CRAN (R 4.0.2)
#>  digest        0.6.25  2020-02-23 [1] CRAN (R 4.0.2)
#>  ellipsis      0.3.1   2020-05-15 [1] CRAN (R 4.0.2)
#>  evaluate      0.14    2019-05-28 [1] CRAN (R 4.0.2)
#>  fansi         0.4.1   2020-01-08 [1] CRAN (R 4.0.2)
#>  fs            1.4.2   2020-06-30 [1] CRAN (R 4.0.2)
#>  glue          1.4.1   2020-05-13 [1] CRAN (R 4.0.2)
#>  highr         0.8     2019-03-20 [1] CRAN (R 4.0.2)
#>  htmltools     0.5.0   2020-06-16 [1] CRAN (R 4.0.2)
#>  knitr         1.29    2020-06-23 [1] CRAN (R 4.0.2)
#>  lattice       0.20-41 2020-04-02 [2] CRAN (R 4.0.2)
#>  magrittr      1.5     2014-11-22 [1] CRAN (R 4.0.2)
#>  memoise       1.1.0   2017-04-21 [1] CRAN (R 4.0.2)
#>  pkgbuild      1.0.8   2020-05-07 [1] CRAN (R 4.0.2)
#>  pkgload       1.1.0   2020-05-29 [1] CRAN (R 4.0.2)
#>  prettyunits   1.1.1   2020-01-24 [1] CRAN (R 4.0.2)
#>  processx      3.4.3   2020-07-05 [1] CRAN (R 4.0.2)
#>  ps            1.3.3   2020-05-08 [1] CRAN (R 4.0.2)
#>  purrr         0.3.4   2020-04-17 [1] CRAN (R 4.0.2)
#>  R6            2.4.1   2019-11-12 [1] CRAN (R 4.0.2)
#>  Rcpp          1.0.5   2020-07-06 [1] CRAN (R 4.0.2)
#>  remotes       2.1.1   2020-02-15 [1] CRAN (R 4.0.2)
#>  rlang         0.4.6   2020-05-02 [1] CRAN (R 4.0.2)
#>  rmarkdown     2.3     2020-06-18 [1] CRAN (R 4.0.2)
#>  rprojroot     1.3-2   2018-01-03 [1] CRAN (R 4.0.2)
#>  sessioninfo   1.1.1   2018-11-05 [1] CRAN (R 4.0.2)
#>  stringi       1.4.6   2020-02-17 [1] CRAN (R 4.0.0)
#>  stringr       1.4.0   2019-02-10 [1] CRAN (R 4.0.2)
#>  swmmr       * 0.9.1   2020-03-02 [1] CRAN (R 4.0.2)
#>  testthat      2.3.2   2020-03-02 [1] CRAN (R 4.0.2)
#>  usethis       1.6.1   2020-04-29 [1] CRAN (R 4.0.2)
#>  withr         2.2.0   2020-04-20 [1] CRAN (R 4.0.2)
#>  xfun          0.15    2020-06-21 [1] CRAN (R 4.0.2)
#>  xts           0.12-0  2020-01-19 [1] CRAN (R 4.0.2)
#>  yaml          2.2.1   2020-02-01 [1] CRAN (R 4.0.0)
#>  zoo           1.8-8   2020-05-02 [1] CRAN (R 4.0.2)
#> 
#> [1] C:/Users/leutnant/library
#> [2] C:/Program Files/R/R-4.0.2/library

dleutnant avatar Jul 09 '20 10:07 dleutnant

Unfortunately these steps did not solve the issue for me, but for now I can live with the workaround of the earlier version.

Thanks in any case for the help in narrowing down the problem!

robermei avatar Jul 09 '20 11:07 robermei

Same here. The issue persists with 4.02. Thanks still for the quick response and the workaround.

FranzTG avatar Jul 09 '20 11:07 FranzTG

Did you put Rtools on the PATH variable as required (i.e. writeLines('PATH="${RTOOLS40_HOME}\\usr\\bin;${PATH}"', con = "~/.Renviron") and check via Sys.which("make")?

dleutnant avatar Jul 09 '20 12:07 dleutnant

Yes.

Sys.which("make") make "C:\rtools40\usr\bin\make.exe"

FranzTG avatar Jul 09 '20 12:07 FranzTG

Restart?

dleutnant avatar Jul 09 '20 12:07 dleutnant

What is the output of install.packages("swmmr", type = "source")?

dleutnant avatar Jul 09 '20 12:07 dleutnant

Restart was done. > install.packages("swmmr", type = "source") Installing package into ‘C:/Users/franzt/Documents/R/win-library/4.0’ (as ‘lib’ is unspecified) trying URL 'https://cran.rstudio.com/src/contrib/swmmr_0.9.1.tar.gz' Content type 'application/x-gzip' length 212828 bytes (207 KB) downloaded 207 KB

  • installing source package 'swmmr' ... ** package 'swmmr' successfully unpacked and MD5 sums checked ** using staged installation ** libs

*** arch - i386 "C:/rtools40/mingw32/bin/"g++ -std=gnu++11 -I"C:/PROGRA~1/R/R-4.0.2/include" -DNDEBUG -I'C:/Users/franzt/Documents/R/win-library/4.0/Rcpp/include' -O2 -Wall -mfpmath=sse -msse2 -mstackrealign -c RcppExports.cpp -o RcppExports.o "C:/rtools40/mingw32/bin/"g++ -std=gnu++11 -I"C:/PROGRA~1/R/R-4.0.2/include" -DNDEBUG -I'C:/Users/franzt/Documents/R/win-library/4.0/Rcpp/include' -O2 -Wall -mfpmath=sse -msse2 -mstackrealign -c swmm5_iface.cpp -o swmm5_iface.o swmm5_iface.cpp: In function 'Rcpp::List OpenSwmmOutFile(const char*)': swmm5_iface.cpp:43:10: warning: variable 'size' set but not used [-Wunused-but-set-variable] size_t size; ^~~~ swmm5_iface.cpp: In function 'Rcpp::NumericVector GetSwmmResult(int, int, int)': swmm5_iface.cpp:176:10: warning: variable 'size' set but not used [-Wunused-but-set-variable] size_t size; ^~~~ C:/rtools40/mingw32/bin/g++ -std=gnu++11 -shared -s -static-libgcc -o swmmr.dll tmp.def RcppExports.o swmm5_iface.o -LC:/PROGRA~1/R/R-4.0.2/bin/i386 -lR installing to C:/Users/franzt/Documents/R/win-library/4.0/00LOCK-swmmr/00new/swmmr/libs/i386

*** arch - x64 "C:/rtools40/mingw64/bin/"g++ -std=gnu++11 -I"C:/PROGRA~1/R/R-4.0.2/include" -DNDEBUG -I'C:/Users/franzt/Documents/R/win-library/4.0/Rcpp/include' -O2 -Wall -mfpmath=sse -msse2 -mstackrealign -c RcppExports.cpp -o RcppExports.o "C:/rtools40/mingw64/bin/"g++ -std=gnu++11 -I"C:/PROGRA~1/R/R-4.0.2/include" -DNDEBUG -I'C:/Users/franzt/Documents/R/win-library/4.0/Rcpp/include' -O2 -Wall -mfpmath=sse -msse2 -mstackrealign -c swmm5_iface.cpp -o swmm5_iface.o swmm5_iface.cpp: In function 'Rcpp::List OpenSwmmOutFile(const char*)': swmm5_iface.cpp:43:10: warning: variable 'size' set but not used [-Wunused-but-set-variable] size_t size; ^~~~ swmm5_iface.cpp: In function 'Rcpp::NumericVector GetSwmmResult(int, int, int)': swmm5_iface.cpp:176:10: warning: variable 'size' set but not used [-Wunused-but-set-variable] size_t size; ^~~~ C:/rtools40/mingw64/bin/g++ -std=gnu++11 -shared -s -static-libgcc -o swmmr.dll tmp.def RcppExports.o swmm5_iface.o -LC:/PROGRA~1/R/R-4.0.2/bin/x64 -lR installing to C:/Users/franzt/Documents/R/win-library/4.0/00LOCK-swmmr/00new/swmmr/libs/x64 ** R ** inst ** byte-compile and prepare package for lazy loading ** help *** installing help indices converting help for package 'swmmr' finding HTML links ... done add_column_if_missing html
add_columns_if_missing html
assign_parameters html
assign_parameters.conduits html
assign_parameters.coordinates html
assign_parameters.coverages html
assign_parameters.curves html
assign_parameters.default html
assign_parameters.evaporation html
assign_parameters.infiltration html
assign_parameters.junction html
assign_parameters.options html
assign_parameters.outfalls html
assign_parameters.polygons html
assign_parameters.pumps html
assign_parameters.report html
assign_parameters.storage html
assign_parameters.subareas html
assign_parameters.subcatchments html
assign_parameters.weirs html
assign_parameters.xsections html
check_package_and_class html
check_pkg_avail html
compare_to_dictionary html
convert_to_sf html
create_sf_of_linestring html
create_sf_of_pt html
curves_to_txt html
dot-get_exec_on_linux_or_mac html
dot-get_exec_on_windows html
dot-get_iIndex html
dot-get_iType html
dot-get_os html
dot-get_vIndex html
get_column_defaults html
get_out_content html
get_out_version html
has_incomplete_features html
inp_to_files html
options_to_txt html
parse_section html
parse_section.analysis_options html
parse_section.aquifers html
parse_section.backdrop html
parse_section.buildup html
parse_section.conduit_surcharge_summary html
parse_section.conduits html
parse_section.controls html
parse_section.coordinates html
parse_section.coverages html
parse_section.cross_section_summary html
parse_section.curves html
parse_section.default html
parse_section.dividers html
parse_section.dwf html
parse_section.element_count html
parse_section.evaporation html
parse_section.events html
parse_section.files html
parse_section.flow_classification_summary html
parse_section.flow_routing_continuity html
parse_section.groundwater html
parse_section.groundwater_continuity html
parse_section.groundwater_summary html
parse_section.highest_continuity_errors html
parse_section.highest_flow_instability_indexes html
parse_section.hydrographs html
parse_section.iiflows html
parse_section.infiltration html
parse_section.inflows html
parse_section.junctions html
parse_section.labels html
parse_section.landuse_summary html
parse_section.landuses html
parse_section.lid_control_summary html
parse_section.lid_controls html
parse_section.lid_performance_summary html
parse_section.lid_usage html
parse_section.link_flow_summary html
parse_section.link_pollutant_load_summary html
parse_section.link_summary html
parse_section.loadings html
parse_section.losses html
parse_section.map html
parse_section.node_depth_summary html
parse_section.node_flooding_summary html
parse_section.node_inflow_summary html
parse_section.node_summary html
parse_section.node_surcharge_summary html
parse_section.options html
parse_section.orifices html
parse_section.outfall_loading_summary html
parse_section.outfalls html
parse_section.outlets html
parse_section.patterns html
parse_section.pollutant_summary html
parse_section.pollutants html
parse_section.polygons html
parse_section.profiles html
parse_section.pumping_summary html
parse_section.pumps html
parse_section.quality_routing_continuity html
parse_section.raingage_summary html
parse_section.raingages html
parse_section.report html
parse_section.routing_time_step_summary html
parse_section.rpt_error html
parse_section.runoff_quality_continuity html
parse_section.runoff_quantity_continuity html
parse_section.snowpacks html
parse_section.storage html
parse_section.storage_volume_summary html
parse_section.subareas html
parse_section.subcatchment_runoff_summary html
parse_section.subcatchment_summary html
parse_section.subcatchment_washoff_summary html
parse_section.subcatchments html
parse_section.symbols html
parse_section.tags html
parse_section.temperature html
parse_section.time_step_critical_elements html
parse_section.timeseries html
parse_section.title html
parse_section.treatment html
parse_section.vertices html
parse_section.washoff html
parse_section.weirs html
parse_section.xsections html
plot html
Rd warning: C:/Users/franzt/AppData/Local/Temp/RtmpOQWp1J/R.INSTALL188c708325c/swmmr/man/plot.Rd:16: file link 'inp_to_sf' in package 'swmmr' does not exist and so has been treated as a topic read_inp html
read_lid_rpt html
Rd warning: C:/Users/franzt/AppData/Local/Temp/RtmpOQWp1J/R.INSTALL188c708325c/swmmr/man/read_lid_rpt.Rd:15: file link 'read_table2' in package 'readr' does not exist and so has been treated as a topic read_out html
read_rpt html
run_swmm html
section_to_tbl html
sections_to_shp html
separate_into html
shp_to_inp html
skip_head html
summary html
swmmr html
timeseries_to_dat html
write_inp html
*** copying figures ** building package indices ** installing vignettes ** testing if installed package can be loaded from temporary location *** arch - i386 *** arch - x64 ** testing if installed package can be loaded from final location *** arch - i386 *** arch - x64 ** testing if installed package keeps a record of temporary installation path

  • DONE (swmmr)

The downloaded source packages are in ‘C:\Users\franzt\AppData\Local\Temp\Rtmpa45xW9\downloaded_packages’

FranzTG avatar Jul 09 '20 12:07 FranzTG

This looks ok.... 🤔

dleutnant avatar Jul 09 '20 12:07 dleutnant

What if you call now install.packages("swmmr") directly?

dleutnant avatar Jul 09 '20 12:07 dleutnant

install.packages("swmmr") Installing package into ‘C:/Users/franzt/Documents/R/win-library/4.0’ (as ‘lib’ is unspecified) trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.0/swmmr_0.9.1.zip' Content type 'application/zip' length 1177497 bytes (1.1 MB) downloaded 1.1 MB

package ‘swmmr’ successfully unpacked and MD5 sums checked

The downloaded binary packages are in C:\Users\franzt\AppData\Local\Temp\RtmpUJaK0m\downloaded_packages

FranzTG avatar Jul 09 '20 12:07 FranzTG

flows <- read_out(file = "/Users/franzt/Desktop/Model_test/model.out.txt", iType = 1, object_name = "370595", vIndex = 4)[["370595"]]$total_inflow

head(flows["2019-06-08 03:00:00/"]) [,1] 2019-06-08 03:00:00 6.977733e-04 2019-06-08 03:01:00 8.808837e-04 2019-06-08 03:02:00 3.345804e-05 2019-06-08 03:03:00 0.000000e+00 2019-06-08 03:04:00 0.000000e+00 2019-06-08 03:05:00 8.340256e-06 Warning message: timezone of object (GMT) is different than current timezone ().

FranzTG avatar Jul 09 '20 12:07 FranzTG

@FranzTG @robermei Any update about how you solve this problem? I have the same problem since I have switched to use R 4.0.0 or 4.0.2.

I followed the guideline @dleutnant explained : """ The issue is related to the new rtools40 toolchain. Following the steps given here https://cran.r-project.org/bin/windows/Rtools/ and finally executing install.packages("swmmr", type = "source") I was able to solve this issue. """

But it did not solve my problem. The read_out() function is not working properly. However, I tried to use the older version of R (as recommended in this issue) in my Rstudio (R 3.6.0), but whenever I wanna run my model, I get this error: 3

Do I need to completely remove R 4.0.0 to be able to use R 3.6.0?

In another attempt, I am using AWS (Amazon web services) to run my R code which is under Linux: """" platform x86_64-pc-linux-gnu arch x86_64 os linux-gnu system x86_64, linux-gnu version.string R version 3.6.0 (2019-04-26) """

As you can see, in AWS the R version is 3.6.0, but the problem of using the read_out() function is still there. @dleutnant Do you know any other ways to solve this problem in all R versions in both Windows and Linux?

If I want to make it short:

  • in my local computer (windows): previously I could use read_out() function properly without any problem (R version 3.6.0), but when I updated my R (4.0.0), It does not work.
  • in AWS (Linux based): the R version is 3.6.0 and this function does not work properly and it gives me wrong results.

So, is the problem from the R version? or operation system (Windows or Linux)? or is it from both? In these cases, how can I solve this? is there any sustainable way to solve it? My first priority is to solve it in AWS. So any suggestion on how to solve it in AWS since it is using R 3.6.0?

HamedGhodsi90 avatar Jul 21 '20 16:07 HamedGhodsi90

@HamedGhodsi90 No update from my side. The workaround with the older R version works for me. The procedure with the new one does not. Not sure why, as I also don't get any error.

FranzTG avatar Aug 03 '20 06:08 FranzTG

Hi @HamedGhodsi90

Also no update from my side - I'm using the older version and experience no problems there. When trying the new version, I start getting the same problems.

robermei avatar Aug 04 '20 07:08 robermei

I'm back from holidays and about to work on this issue. Any updates or insights from you @robermei @FranzTG before I dive in to it?

dleutnant avatar Aug 27 '20 13:08 dleutnant

Hi @dleutnant no updates from my side - because using the old version is ok for me, I did not look further into the issue.

robermei avatar Aug 27 '20 13:08 robermei

Hi @dleutnant. I am glad you are back. I have serious problem here. I turned to use the old version of R (3.6.1) in my local computer (windows), and everything is fine. The "read_out()" function works properly. But, when I use AWS (Linux system) to run my code, even though it uses R version 3.6.0, but there is a problem in "read_out()" function. The system I use in AWS is: """ platform x86_64-pc-linux-gnu arch x86_64 os linux-gnu system x86_64, linux-gnu version.string R version 3.6.0 (2019-04-26) """

Do you have any idea how to solve this problem in Linux? The R version (3.6) in windows and Linux is the same, but in windows, it works and in Linux it does not. Please help me to solve this problem. I really need to solve it. Thank you very much.

HamedGhodsi90 avatar Aug 27 '20 17:08 HamedGhodsi90