Skip to content

Commit d80828e

Browse files
author
nguyenta
committed
add option: extract output from lsunit_wb file for SWAT+
1 parent 815794c commit d80828e

File tree

2 files changed

+24
-4
lines changed

2 files changed

+24
-4
lines changed

R/defaultValue.R

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,27 +97,39 @@ dataOutputExtractionSWATPlus <- data.frame(FileType = c('channel_sd_day.txt',
9797
'channel_sdmorph_day.txt',
9898
'channel_sdmorph_mon.txt',
9999
'channel_sdmorph_yr.txt',
100+
'lsunit_wb_day.txt',
101+
'lsunit_wb_mon.txt',
102+
'lsunit_wb_yr.txt',
100103
'userReadSwatOutput'),
101104
FileName = c('channel_sd_day.txt',
102105
'channel_sd_mon.txt',
103106
'channel_sd_yr.txt',
104107
'channel_sdmorph_day.txt',
105108
'channel_sdmorph_mon.txt',
106109
'channel_sdmorph_yr.txt',
110+
'lsunit_wb_day.txt',
111+
'lsunit_wb_mon.txt',
112+
'lsunit_wb_yr.txt',
107113
NA),
108114
Column = c("48, 53",
109115
"48, 53",
110116
"48, 53",
111117
"48, 53",
112118
"48, 53",
113119
"48, 53",
120+
"48, 53",
121+
"48, 53",
122+
"48, 53",
114123
"1"),
115124
Reach = c("1, 2 * 1, 2, 3",
116125
"1, 2 * 1, 2, 3",
117126
"1, 2 * 1, 2, 3",
118127
"1, 2 * 1, 2, 3",
119128
"1, 2 * 1, 2, 3",
120129
"1, 2 * 1, 2, 3",
130+
"1, 2 * 1, 2, 3",
131+
"1, 2 * 1, 2, 3",
132+
"1, 2 * 1, 2, 3",
121133
NA)
122134
)
123135

@@ -129,6 +141,9 @@ columnsOutputExtractionSWATPlus <- data.frame(title= colnames(dataOutputExtracti
129141
'channel_sdmorph_day.txt',
130142
'channel_sdmorph_mon.txt',
131143
'channel_sdmorph_yr.txt',
144+
'lsunit_wb_day.txt',
145+
'lsunit_wb_mon.txt',
146+
'lsunit_wb_yr.txt',
132147
'userReadSwatOutput'),
133148
NA,
134149
NA,

R/readSaveOutput.R

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,10 @@ saveOutput <- function(workingDirectory,
161161
fileType[i] == "channel_sd_yr.txt" |
162162
fileType[i] == "channel_sdmorph_day.txt" |
163163
fileType[i] == "channel_sdmorph_mon.txt" |
164-
fileType[i] == "channel_sdmorph_yr.txt"){
164+
fileType[i] == "channel_sdmorph_yr.txt" |
165+
fileType[i] == "lsunit_wb_day.txt" |
166+
fileType[i] == "lsunit_wb_mon.txt" |
167+
fileType[i] == "lsunit_wb_yr.txt"){
165168
output <- readChannelFile(workingDirectory,
166169
coreNumber,
167170
fileName[i],
@@ -337,8 +340,7 @@ appendListObject <- function(listA, listB){
337340
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
338341

339342
#-------------------------------------------------------------------------------
340-
# Read channel_sd_xxx.txt file, data is always at daily timestep
341-
# xxx could be "day", "month", or "yr" readChannel_sd_dayFile
343+
# Read channel and lsunit data at daily, monthly, yearly time step
342344
# ------------------------------------------------------------------------------
343345
readChannelFile <- function(workingDirectory,
344346
coreNumber,
@@ -354,7 +356,10 @@ readChannelFile <- function(workingDirectory,
354356
"channel_sd_yr.txt",
355357
"channel_sdmorph_day.txt",
356358
"channel_sdmorph_mon.txt",
357-
"channel_sdmorph_yr.txt")
359+
"channel_sdmorph_yr.txt",
360+
"lsunit_wb_day.txt",
361+
"lsunit_wb_mon.txt",
362+
"lsunit_wb_yr.txt")
358363

359364
filePath <- paste(workingDirectory, "/TxtInOut_", coreNumber, "/",
360365
fileName, sep = "")

0 commit comments

Comments
 (0)