dleutnant / swmmr

R Interface for US EPA's SWMM
https://cran.r-project.org/package=swmmr
39 stars 15 forks source link

read_inp does not support SWMM section "TRANSECTS" #33

Open laltuashu opened 5 years ago

laltuashu commented 5 years ago

Can anybody suggest me why "parse_section.default(x) : Unknown class: data.frame" warning is occuring?

dleutnant commented 5 years ago

Yep, most probably because your inp file contains a section which is currently/accidentally not implemented in {swmmr}. Can you share your model file?

dleutnant commented 5 years ago

A vector with allowed sections can be obtained via swmmr:::input_sections.

dleutnant commented 5 years ago
# read lines
inp_lines <- readr::read_lines("https://github.com/dleutnant/swmmr/files/3168584/swmm3_2.txt")

# delete leading whitespaces in strings
inp_lines <- gsub("^\\s+", "", inp_lines)

# find section start
section_start <- grep("\\[", inp_lines, value = F)

# get section names
section_names <- gsub(pattern = "\\[|\\]",
                      replacement = "",
                      x = inp_lines[section_start])

# which section is not parsed?
section_names[!tolower(section_names) %in% swmmr:::input_sections]
#> [1] "TRANSECTS"

Created on 2019-05-11 by the reprex package (v0.2.1)

So section "TRANSECTS" it is.

laltuashu commented 5 years ago

Thank you sir for your prompt reply and suggestion on the query.
So, if "transects" is not allowed in swmmr, then how do I use natural sections in the model (swmm3_2) ?

laltuashu commented 5 years ago

Hello all, I have tried to give approximate cross section data to "xsections" , and the previous error while reading inp file is over now. But while calibrating using the parallel processing feature in "DEoptim" package, I am getting error as "Error in checkForRemoteErrors(val) : 4 nodes produced errors; first error: cannot coerce class 'c("xts", "zoo")' to a data.frame". Could anybody suggest some solutions on this issue ? Regards. Ashu

dleutnant commented 5 years ago
  1. {swmmr} will support TRANSECTS in its next dev version.
  2. The coercing error you are facing is hard to reproduce without seeing the code. It is however more likely that the error does not originate from {swmmr}. I reckon it is related to your objective function...
laltuashu commented 5 years ago

Hello all, Previously as I have mentioned when I run the model using parallel mode in DEoptim, the error is as given in the previous reply, but when I run the model without parallel mode in DEoptim, I got the errors like

Error in [.xts(x, , 2) : subscript out of bounds In addition: Warning messages: 1: In normalizePath(path.expand(path), winslash, mustWork) : path[1]="C:/Users/ratnakar/AppData/Local/Temp/RtmpkNMgOy/fileca41c942dd9.out": The system cannot find the file specified 2: In read_out(file = swmm_files$out, iType = 1, object_name = "621", : error reading out file

Any suggestions in this regard will be highly appreciated. Regards, Ashu

dleutnant commented 5 years ago

@laltuashu Please make sure your model is running correctly. Again, without seeing the code, people cannot reproduce the error and can only make guess. Apropos, I reckon your model does not run properly and therefore no .out file is generated. Did you check the .rpt file for potential errors?

dleutnant commented 5 years ago

@laltuashu Could you please post different issues as new issues as this one here has a specific topic and shouldn‘t cover general optimization issues. Thank you!

laltuashu commented 5 years ago

Ok @dleutnant sir. I will add this query to a new issue.

Regards Ashu

collinsemmalise commented 5 years ago

If swmmr does not support transects, how is it currently handling conduits with "irregular" geometry?