/R-SWAT

This is an interactive web-based app for parallel parameter sensitivity, calibration, and uncertainty analysis with the Soil and Water Assessment Tool

Primary LanguageRGNU General Public License v3.0GPL-3.0

R-SWAT

  • This is an interactive web-based app (written in R language with shiny package) for parallel parameter sensitivity, calibration, and uncertainty analysis with the Soil and Water Assessment Tool (SWAT). The official name of this app is R-SWAT (initially its name was SWATshiny)
  • The latest version of this app is always in the "master" branch.
  • If you would like to contribute to the code, have any suggestions, want to report errors, and have scientific collaboration, please contact me. The best way to contact me is via the google group specially designed for this app. Tutorial videos can be found in R-SWAT youtube channel
  • This is the first version, the app will be continued to be developed to serve the SWAT community. If you would like to contribute to the development of this app, please let me know. Together we can make this app much better as my time and R knowledge for this app are very limited.
  • This work has not been published in any journal. If you use this program for your publication and want to know the technical behind this app, please contact me.
  • A full documentation of R-SWAT with examples is in its wiki page.

Quick Start!

This app is designed for R beginner to advance users, you can use this app even you don't know anything about R.

To run this app, install latest R version 4.1.1 or newer version (If you use old version of R this might NOT work). Then install R studio. Then do the following steps:

  • Step 1: Click here to download the whole code of this app.
  • Step 2: Extract the downloaded file => Open RStudio
  • Step 3: Open the file ./R/loadPackages.R with R studio and install all packages list in this file (take 5-10 minutes).
  • Step 4: Open the file server.R or ui.R in R studio => then click the green button named Run App

Next time when you use this app just step 4 is needed or you can download the latest app and run it using the following commands

# Load shiny package
library(shiny)

# Automatically download this R-SWAT app (code + data) to your local machine and run it
runGitHub("R-SWAT", "tamnva")

# If you already manually downloaded it from the github, you can run the app using this command
# runApp("RSWAT_folder")

The following interface (attached screenshot on the end of this document) will appear and you can start using this app. Start with Tab '1. General setting' => '2. Parameter sampling' => and so on. On each tab there are subitems (e.g., in the first figure, start with '1. Working folder' => '2. TxtInOut folder' => and so on)

If you don't know which input is required, simply clicking to "Help?" at the right side of each respective input field. A sample of data for running this app can be downloaded from my GitHub repository, including:

  1. /data/TxtInOut: A TxtInOut folder and all associated files created by ArcSWAT
  2. swatParam.txt: An input file describing all SWAT parameters that you will need for the input field 1. General Setting => 4. Files with list of all SWAT Parameters
  3. obs_var_1.txt: Observed data file (streamflow) at the catchment outlet that you might need to input to evaluate the model performance 4.1. Objective function => 2. Get observed data files
  4. data/examples: you will see examples how to include new parameters in new files (e.g., this could be the case if you modify SWAT code)

R-SWAT user interface