read.inp {epanetReader} | R Documentation |
Read .inp file
Description
Read an Epanet .inp file into R
Usage
read.inp(file)
Arguments
file |
the name of the file to read |
Details
This function reads a text file in Epanet's .inp format and returns an S3 object with entries for sections of the .inp file. Sections of the .inp file that are implemented appear in the Value section.
Fields for node or link ID are stored as characters not factors or integers. However, some fields are stored as factors to allow more informative summaries. Examples include valve type and pipe status.
Sections that are absent from the .inp file are NULL in the list.
Columns of data.frames use the headings exported by the Epanet GUI.
The [OPTIONS] section in the .inp file is used to update a list of Epanet's default options. In this way if an option such as units is not specified by the .inp file, the units that would be used by default are provided.
In the [PATTERNS] and [CURVES] sections, integers used as names of list elements are backquoted according to the default behavior in R. So if the .inp file has a pattern "1" this pattern will appear as element '1' in the list that is returned. A warning is issued in this case.
Value
Returns an epanet.inp S3 object with elements of the following names and types corresponding to sections of the .inp file. Sections missing from the .inp file have a value of NULL.
Title |
character |
Junctions |
data.frame |
Tanks |
data.frame |
Reservoirs |
data.frame |
Pipes |
data.frame |
Pumps |
data.frame |
Valves |
data.frame |
Demands |
data.frame |
Status |
data.frame |
Emitters |
data.frame |
Quality |
data.frame |
Sources |
data.frame |
Reactions |
character |
Mixing |
data.frame |
Patterns |
list |
Curves |
list |
Controls |
character |
Rules |
character |
Energy |
character |
Times |
character |
Report |
character |
Options |
list |
Coordinates |
data.frame |
Vertices |
data.frame |
Labels |
data.frame |
Backdrop |
character |
Tags |
character |
References
Rossman, L. A. (2000). Epanet 2 users manual. US EPA, Cincinnati, Ohio.
http://nepis.epa.gov/Adobe/PDF/P1007WWU.pdf
Examples
# path to Net1.inp example file included with this package
inp <- file.path( find.package("epanetReader"), "extdata","Net1.inp")
#read the network file into R
n1 <- read.inp(inp)
summary(n1)
names(n1)
summary(n1$Junctions)
summary(n1$Pipes)
plot(n1)