diff --git a/R/readAllOutVar.R b/R/readAllOutVar.R index 18ee603..dfc501c 100644 --- a/R/readAllOutVar.R +++ b/R/readAllOutVar.R @@ -45,7 +45,7 @@ readAllOutVar <- function(workingFolder, numTimesteps){ outVarFiles <- list.files(coreFolders[1], full.names = TRUE) output <- list() - for (ifolder in 1:length(coreFolder)){ + for (ifolder in 1:length(coreFolders)){ # Loop over each outVarfiles for (var in 1:length(outVarFiles)){ # Read content of each file and store diff --git a/README.md b/README.md index d20b830..a0aa976 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ ## RSWAT -[![DOI](https://zenodo.org/badge/395115735.svg)](https://zenodo.org/badge/latestdoi/395115735) [![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://github.com/tamnva/R-SWAT/blob/master/LICENSE) [![Release](https://img.shields.io/github/release/tamnva/R-SWAT.svg?style=flat-square)](https://github.com/tamnva/R-SWAT/releases) [![R-CMD-check](https://github.com/tamnva/R-SWAT/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/tamnva/R-SWAT/actions/workflows/R-CMD-check.yaml) +[![DOI](https://zenodo.org/badge/395115735.svg)](https://zenodo.org/badge/latestdoi/395115735) [![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://github.com/tamnva/R-SWAT/blob/master/LICENSE) [![Release](https://img.shields.io/github/release/tamnva/R-SWAT.svg?style=flat-square)](https://github.com/tamnva/R-SWAT/releases) [![R-CMD-check](https://github.com/tamnva/R-SWAT/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/tamnva/R-SWAT/actions/workflows/R-CMD-check.yaml) [![status](https://joss.theoj.org/papers/89a04bc6f9a2a2b08cbac33fcd91c0c6/status.svg)](https://joss.theoj.org/papers/89a04bc6f9a2a2b08cbac33fcd91c0c6) - This is an R package with a graphical user interface (GUI) for parallel parameter calibration, sensitivity, and uncertainty analyses with the Soil and Water Assessment Tool models (e.g., [SWAT](https://swat.tamu.edu/), [SWAT+](https://swat.tamu.edu/software/plus/), [SWAT-Carbon](https://sites.google.com/view/swat-carbon), and its other modified versions). - RSWAT can also be used without the GUI, please see the RSWAT vignettes (see Quick Start section). diff --git a/vignettes/run_SWATplus_with_given_parametersets.R b/vignettes/run_SWATplus_user_parameters.R similarity index 94% rename from vignettes/run_SWATplus_with_given_parametersets.R rename to vignettes/run_SWATplus_user_parameters.R index deffa7c..1e499ea 100644 --- a/vignettes/run_SWATplus_with_given_parametersets.R +++ b/vignettes/run_SWATplus_user_parameters.R @@ -51,8 +51,12 @@ knitr::opts_chunk$set( # FileType = c("channel_sd_day.txt"), # FileName = c("channel_sd_day.txt"), # Column = c("48"), -# Reach = c("1") +# Reach = c("1") # E.g., for 100 reaches use: Reach = paste(as.character(c(1:100)), collapse = ",") # ) +# # NOTE: if you want to extract for many reaches (e.g., for the first 100 reaches), create variable for th +# +# reach <- paste(as.character(c(1:100)), collapse = ",") +# # # # 10. Date range for extraction (TODO: change this) # dateRangeCali <- as.Date(c("2003-01-01", "2012-12-31"), format = "%Y-%m-%d") diff --git a/vignettes/run_SWATplus_with_given_parametersets.Rmd b/vignettes/run_SWATplus_user_parameters.Rmd similarity index 95% rename from vignettes/run_SWATplus_with_given_parametersets.Rmd rename to vignettes/run_SWATplus_user_parameters.Rmd index f101ffd..d9d7071 100644 --- a/vignettes/run_SWATplus_with_given_parametersets.Rmd +++ b/vignettes/run_SWATplus_user_parameters.Rmd @@ -75,8 +75,12 @@ outputExtraction <- data.frame( FileType = c("channel_sd_day.txt"), FileName = c("channel_sd_day.txt"), Column = c("48"), - Reach = c("1") + Reach = c("1") # E.g., for 100 reaches use: Reach = paste(as.character(c(1:100)), collapse = ",") ) +# NOTE: if you want to extract for many reaches (e.g., for the first 100 reaches), create variable for th + +reach <- paste(as.character(c(1:100)), collapse = ",") + # 10. Date range for extraction (TODO: change this) dateRangeCali <- as.Date(c("2003-01-01", "2012-12-31"), format = "%Y-%m-%d") diff --git a/vignettes/run_SWATplus_with_given_parametersets.html b/vignettes/run_SWATplus_user_parameters.html similarity index 93% rename from vignettes/run_SWATplus_with_given_parametersets.html rename to vignettes/run_SWATplus_user_parameters.html index 77a5f43..76dcc89 100644 --- a/vignettes/run_SWATplus_with_given_parametersets.html +++ b/vignettes/run_SWATplus_user_parameters.html @@ -408,31 +408,35 @@

3. Input configuration

FileType = c("channel_sd_day.txt"), FileName = c("channel_sd_day.txt"), Column = c("48"), - Reach = c("1") + Reach = c("1") # E.g., for 100 reaches use: Reach = paste(as.character(c(1:100)), collapse = ",") ) - -# 10. Date range for extraction (TODO: change this) -dateRangeCali <- as.Date(c("2003-01-01", "2012-12-31"), format = "%Y-%m-%d") +# NOTE: if you want to extract for many reaches (e.g., for the first 100 reaches), create variable for th + +reach <- paste(as.character(c(1:100)), collapse = ",") -# 11. Number of parallel runs (TODO: change this) -ncores <- 2 - -# 12. Generate parameter samples using Latin Hypercube Sampling (TODO: change this) -parameterValue <- as.matrix(read.table(file = "C:/data/user_parameter_values.txt", - header = TRUE, sep ="")) + +# 10. Date range for extraction (TODO: change this) +dateRangeCali <- as.Date(c("2003-01-01", "2012-12-31"), format = "%Y-%m-%d") + +# 11. Number of parallel runs (TODO: change this) +ncores <- 2 -# Here is the content of my user_parameter_values.txt" -#cn2.hru canmax.hru -#0.10 1.5 -#-0.20 3.0 -#-0.10 0.2 -#0.22 1.0 -# - -# Remove the column names and number these parametersets from 1 to n. DONOT change this -parameterValue <- cbind(c(1:nrow(parameterValue)),parameterValue) -colnames(parameterValue) <- NULL -rownames(parameterValue) <- NULL +# 12. Generate parameter samples using Latin Hypercube Sampling (TODO: change this) +parameterValue <- as.matrix(read.table(file = "C:/data/user_parameter_values.txt", + header = TRUE, sep ="")) + +# Here is the content of my user_parameter_values.txt" +#cn2.hru canmax.hru +#0.10 1.5 +#-0.20 3.0 +#-0.10 0.2 +#0.22 1.0 +# + +# Remove the column names and number these parametersets from 1 to n. DONOT change this +parameterValue <- cbind(c(1:nrow(parameterValue)),parameterValue) +colnames(parameterValue) <- NULL +rownames(parameterValue) <- NULL

4. Run SWAT+