Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Download the revision notes for the model below.
The latest long term release of QGIS (currently 3.34.6) uses Python 3.12 instead of 3.9. The change to Python requires a change to QSWAT+, and the latest installer is named QSWATPlus3_12. You can download it from Github.
There are no significant changes to QSWAT+ itself, so there is no urgency to change your current version of QGIS and QSWATPlus3_9.
The latest long term release of QGIS is version 3.28. For Windows, the standalone installer we recommend comes as an MSI installer. Some users may be aware of the older .exe installers, for which the last version is 3.16. It is possible to use the latest version 2.4 of QSWAT+ with a .exe installer of QGIS but you need to download, for example, QSWATPlus3_64install2.4.1.exe from the Bitbucket repository. The QSWAT+ installers for .exe versions of QGIS have 3_64 in their names. The QSWAT+ installers for MSI versions of QGIS have 3_9 in their names. The two are incompatible because QGIS has changed Python versions in the MSI installers.
If you already have a project under development it is generally not a good idea to switch to new versions of software, but if you do move to the latest version you will need to update the plant table in your project database. The easy way to do this is to use the 'Use csv' option for the plant database, and select SWATPlus/Databases/plant.csv as the csv file. This will create and select a new table plant0 in your project database, and this will automatically be the default for the project in future. If you forget to do this you are likely when you read the landuse and soil files to get an error that the landuse WETW is not defined. To recover, just choose the csv option as above and then click Read again.
Bug fix related to num_steps column in weir_res that should have been deleted.
Bug fix when creating a new project without QGIS: invalid reference to path join.
Fixed long-standing issue regarding aquifer routing. The editor was routing from aquifer to downstream channel (following through a PT in gis_routing and to the downstream channel or reservoir). Instead, we needed to take the channel/reservoir associated with the PT the aquifer routes to. So in gis_routing instead of AQU->PT->CH/RES, it should be AQU->CH/RES where CH/RES is found from AQU->PT and CH/RES->PT.
To update your project, please first make a complete backup of your project folder. Then, from within the editor on the main screen, click the "Re-import from GIS" button.
SWAT+ model updated to revision 60.5.7; see model revision notes for input/output changes
swatplus_datasets.sqlite updated to version 2.3
Due to the change to plants.plt, if you're updating an existing project, consider reloading your plants database with the new data through the interface. Download the plants CSV file from plus.swat.tamu.edu (browse to version 2.3), and from SWAT+ Editor go to Edit -> Databases -> Plants, click the Import button, then select the Import tab and downloaded CSV file.
Added basic interface for building water allocation tables. Water allocation tables are very specific to the watershed and new feature in SWAT+. We recommend working with the model development team if you are unsure. Because this is a new addition, the interface is still limited if you're trying to build a large table with many source and demand objects.
Bug fix in SWAT+ Check - urban codes now displayed in the Land Use Summary section
Bug fix for error received when enabling constituents and saving
Bug fix for creating new atmospheric deposition station
Bug fix when saving and loading scenarios
Added interface for atmospheric deposition
Added a delete all button to weather stations and weather generator pages
HRU/Hydrology/EPCO default now set to 0.5
Added button to project setup page to re-import from GIS and switch between full SWAT+ and SWAT+ lte
Added a link to SWAT+ Toolbox (Windows only; minimum version 1.0.1)
There is a problem with versions of QGIS after 3.22 and before 3.28.13 that causes errors in QSWAT+. Please make sure you do not use such a version.
If you plan to use QSWAT+ to set up your watershed, please install QGIS 3 before installing SWAT+. It can be downloaded from the , where you should select the Long term release repository, and the 64 bit standalone installer. Version 3.28 is recommended. Use the default folder C:\Program Files\QGIS 3.28.n
as the installation folder. See the for further instructions.
MacOS and Linux only: users will need to install openmpi separately.
MacOS: run brew install openmpi
from a terminal.
Linux Ubuntu: run sudo apt-get install openmpi-bin
from a terminal.
Package name may vary with distribution.
If you have a version of SWAT+ Editor earlier than 2.3.1, we recommend updating due to an issue in aquifer routing that would affect your model's hydrology. See the for details.
This release includes SWAT+ rev. 60.5.7, QSWAT+ 2.4, SWAT+ Editor 2.3, and SWAT+ Toolbox 1.0.5 (Windows only). To install the SWAT+ model and interface components, please use an installer linked below for your operating system. The installer is for 64-bit machines. Administrator privileges are not required for personal installations (but Mac requires use of sudo).
Operating System | Link | Release Date | Version |
---|
*For Linux and MacOS, the optional SSURGO/STATSGO soils and WGN databases should be downloaded from the section below as they are not included in the installers. See detailed installation instructions for Linux and MacOS .
Existing SWAT+ users should be sure to read the thoroughly to see how the software updates affect your projects.
Trouble loading the software after installation? Read through our troubleshooting guide.
If you need to install QSWAT+ or SWAT+ Editor individually, grab the latest release of their respective installers from their source code repository downloads page.
The model itself is packaged with SWAT+ Editor and we recommend using the editor to modify your inputs and run the model. However, if you would like to download just the command line executable file, it is available below.
On Windows we recommend using the SWAT+ Tools installer above for installing the SWAT+ datasets databases to their proper locations. However, for Linux and MacOS, or if you need to access these components individually, they are linked below:
These files should be placed in SWATPlus/Databases
The model is written in Fortran and the distributions on this website were compiled using the . This is now freely available for Windows, Linux, and MacOS. First, download and install the . Then download and install the .
For Windows, we also use Visual Studio. Download the file below for settings configuration.
For Linux and MacOS, we currently just use the command line. First, you need to set your Intel environment. Find your installation directory and source setvars.sh
.
Linux example:
Or for all users:
MacOS example:
Next, we use the following script to compile the model. Please note: occasionally some extra files get included in the source code repository. If you notice this, it is safe to remove them.
The -static
flag in the last line is NOT available on MacOS. Instead, you should link the LAPACK and BLAS libraries and as of macOS Monterey change your library path. The last line should be:
We are new to compiling in Linux and MacOS, so suggestions are more than welcome.
From /src/api
run the following depending on your OS:
Windows: python-build-windows
Linux: sh python-build-linux.sh
MacOS: sh python-build-mac.sh
From the root of the source code directory run the following depending on your OS:
Windows: npm run build:win
Linux: npm run build:linux
MacOS: npm run build:mac
Program will be in /release/dist
Previous releases may be accessed from .
First set up your development environment as described in the README in the .
Over the past 20 years, the Soil and Water Assessment Tool (SWAT) has become widely used across the globe. The large numbers of applications across the globe have also revealed limitations and identified model development needs. Numerous additions and modifications of the model and its individual components have made the code increasingly difficult to manage and maintain. In order to face present and future challenges in water resources modeling SWAT code has undergone major modifications over the past few years, resulting in SWAT+, a completely revised version of the model.
Even though the basic algorithms used to calculate the processes in the model have not changed, the structure and organization of both the code (object based) and the input files (relational based) have undergone considerable modification. This is expected to facilitate model maintenance, future code modifications, and foster collaboration with other researchers to integrate new science into SWAT modules. SWAT+ provides a more flexible spatial representation of interactions and processes within a watershed.
The Soil and Water Assessment Tool Plus (SWAT+) is a public domain model jointly developed by the USDA Agricultural Research Service (USDA-ARS) and Texas A&M AgriLife Research, part of The Texas A&M University System. SWAT+ is a small watershed to river basin-scale model to simulate the quality and quantity of surface and ground water and predict the environmental impact of land use, land management practices, and climate change. SWAT is widely used in assessing soil erosion prevention and control, non-point source pollution control and regional management in watersheds.
The Linux release was tested on Ubuntu 22.04 LTS, and MacOS was tested on Ventura. Please let us know if you test on a different OS version or Linux distribution and have any issues.
Your Linux distribution may have a QGIS package as part of its standard collection. Provided it is QGIS 3.16 version or later (not QGIS 2) you will be OK using it, and you can use the standard package management system to install it. The instructions that follow here are an alternative for obtaining the latest long term release of QGIS, currently 3.28.
Start by going to the QGIS download page and selecting Linux. Follow the instructions for your distribution. Note the instructions on the QGIS page include installing qgis-plugin-grass, but this is not necessary for QSWAT+, i.e. the install command needed is merely sudo apt install qgis
(though Ubuntu seemed to install GRASS anyway).
Install QSWAT+ using the swatplus-linux-installer from the installation page. This takes the form of a compressed tar archive. Save it somewhere, open a terminal and cd to the directory it is saved in. Use the command tar -xvf swatplus-linux-installer.tgz
to unpack the tar file. You then decide whether to install it just for you, or for everyone. In the first case it will only be available to the user who installs it. In the second case it will be available to any user, but will require the root user password to install. To take the first option, use the command ./installforme.sh
and to take the second option use the command sudo ./installforall.sh
This will install the QSWAT+ plugin for QGIS, in the user's personal files with the first option, and within the QGIS installation with the second option. It also installs the SWAT+ Editor and other tools and data in the SWATPlus directory. With the first option, SWATPlus is ~/.local/share/SWATPlus
(where ~ is the user's home directory) and with the second option it is /usr/local/share/SWATPlus
. There are also shell scripts uninstallforme.sh and unistallforall.sh for uninstalling.
The TauDEM executables used for watershed delineation by QSWAT+ can run in multiprocessing mode, using MPI (Message Passing Interface). Unfortunately, they need MPI to be installed even if the user chooses not to use MPI. The usual version of MPI for Linux is openmpi, and in Ubuntu, for example, running the command sudo apt-get install openmpi-bin
in a terminal will install openmpi or tell you it is already installed.
Obtain QGIS from the download page, selecting Download for macOS and then QGIS 3.28 LTR, the one described as the most stable version. This will give you a .dmg file, Open it, agree to the license, and you get a small window with a QGIS symbol and an Applications symbol. Drag the QGIS symbol onto the Applications symbol. This places QGIS in your Applications folder, and takes a few minutes. When you open QGIS in MacOS 10.15 (Catalina) you get a response that it cannot be opened because Apple cannot check it for malicious software. Click the Show in Finder button, and then instead of left clicking on QGIS, right click (or hold Ctrl while you click) on QGIS and then choose Open. The same warning about malicious software appears, but this time there is an Open button that you click to start QGIS. Thereafter QGIS will open normally.
The TauDEM software used to do watershed delineation in QSWAT+ is linked dynamically to openmpi, so this needs to be installed. This is most easily achieved by running in a terminal the command sudo brew install openmpi
The instructions new vary according to whether you have a Mac with an Intel processor or an Arm processor (also called M1 or M2)
Install QSWAT+ using the swatplus-mac-installer from the installation page. This takes the form of a compressed tar archive. Save it somewhere, open a terminal and cd to the directory it is saved in. Use the command tar -xvf swatplus-mac-installer.tgz
to unpack the tar file. cd to swatplus-mac-installer and use the command sudo ./installforme.sh
to install for just the user doing the installation. This needs sudo because it fixes a problem in the QGIS installation to properly link some gdalplugins library files. This will install the QSWAT+ plugin for QGIS, under the user's home directory. It also installs the SWAT+ Editor and other tools and data in the ~/SWATPlus
directory (where ~ is the user's home directory). It is also possible to install for all users, with the command sudo ./installforall.sh
This installs the QSWAT+ plugin within the QGIS installation, and makes the QSWATPlus directory /usr/local/share/SWATPlus
. There are also shell scripts uninstallforme.sh and uninstallforall.sh for uninstalling.
Install QSWAT+ using the swatplus-mac-arm -installer from the installation page. This takes the form of a compressed tar archive. Save it somewhere, open a terminal and cd to the directory it is saved in. Use the command tar -xvf swatplus-mac-arm-installer.tgz
to unpack the tar file. cd to swatplus-mac-arm-installer and use the command ./installforme.sh
to install for just the user doing the installation. This will install the QSWAT+ plugin for QGIS, under the user's home.directory. It also installs the SWAT+ Editor and other tools and data in the ~/SWATPlus
directory (where ~ is the user's home directory). It is also possible to install for all users, with the command sudo ./installforall.sh
This installs the QSWAT+ plugin within the QGIS installation, and makes the QSWATPlus directory /usr/local/share/SWATPlus
. There are also shell scripts uninstallforme.sh and uninstallforall.sh for uninstalling.
There are some extra libraries needed for Arm machines. You need to run the following in a terminal:
Be sure to update to the version 2.3 or later of SWAT+ Editor for MacOS. In version 2.2 and earlier you might receive an error while trying to run the model stating it can't find the library libiomp5. We have packaged this with the latest 2.3 SWAT+ Editor install.
You may also run the model outside the editor by downloading the executables from the Installation page and following the instructions in the read-me file.
You may receive an error trying to launch SWAT+ Editor on Debian or other non-Ubuntu Linux distributions:
The SUID sandbox helper binary was found, but it is not configured correctly.
If so, please try the following.
Find your installation location. If you did install for me, it is:
If you selected install for all, it is:
From the install directory, type the following commands:
You should now be able to launch the editor without error.
Windows 64-bit | 4 October 2023 | 2.3.7 |
*Linux 64-bit | 13 July 2023 | 2.3.1 |
*MacOS Intel 64-bit | 3 August 2023 | 2.3.1 |
*MacOS Arm M1/M2 | 11 August 2023 | 2.3.1 |
Download a sample project and watch the guide video to get started with QSWAT+ and SWAT+ Editor
Make sure you have downloaded and installed QSWAT+, SWAT+ wgn and soils databases, and SWAT+ Editor as described in the installation section linked below.
The following guide will show you how to get started with SWAT+ Editor. This guide does not cover how to set up your watershed in QSWAT+. Please refer to the QSWAT+ manual for this step.
Please use the following Robit demo project, which has already been set up in QSWAT+. Alternatively, you may use the Robit project you set up on your own after following the steps in the QSWAT+ manual.
Please watch the guide video before launching SWAT+ Editor. This video will quickly walk you through the steps needed to bring your QSWAT+ project into the editor, as well as show you how to catch and report errors. If you prefer a written guide instead of or in addition to the video, a walk through is shown below.
If you do not want to watch a video, follow the steps below. This guide shows the basic steps you need to take to set up your model, but does not cover all input parameters available through the editor. Please refer to the SWAT+ Editor documentation section for help editing specific input parameters.
Follow the QSWAT+ manual to set up your watershed. To open SWAT+ Editor from within QSWAT+, click the button for Step 3: Edit Inputs and Run SWAT.
The first time your open your QSWAT+ project in SWAT+ Editor, your data must be imported from the GIS tables into SWAT+ database format. This may take a few seconds to several minutes depending on the size of your watershed.
When your GIS data is done loading, your project will be displayed in the center. Click the get started button at the bottom to begin editing your inputs.
The first step you should take is to add weather generator (WGN) data. It may be imported from the distributed WGN database in the SWAT+ Tools installer, or from CSV files. Go to the weather generator section and click the import data button as shown in the screenshot below.
The database import option is selected by default, with the global CSFR weather generator table chosen. Click in the box to see other table options. wgn_us
is weather generator data for the United States. wgn
is an empty table you may populate with your own data if desired.
Alternatively, select CSV files from the top pull-down menu. In the Robit demo dataset, we have provided CSV files to use for weather generators, located in the Wgn folder of the sample project linked at the top of this page. Select these files in the editor as shown in the screenshot below, check the box to use observed weather data, then click the start import button.
You should now see one weather generator station added. Next, we need to add observed weather data. From the left menu in the editor, click the Weather Stations link.
Click the import data button to import your files. In the Robit demo dataset, we have provided weather data in SWAT2012 format in the Weather directory. Select this folder as the SWAT2012 weather files directory in the editor's import form. You may also choose where to save the files when they are converted to SWAT+ format. By default, your TxtInOut folder is selected. Click the start button to continue.
You should now see one weather station added. You can click on the name of the files to open them directly from the editor. You'll see this station is automatically connected to the weather generator created in the last step. This weather station is also connected to all of your spatial connection objects during import. In projects where you have more than one station, it is automatically assigned by closest latitude/longitude.
This concludes the last required section for editing SWAT+ inputs before writing files and running the model. The remaining sections are not covered in this walk-through, however you can look through the SWAT+ Editor Documentation section for more information.
In this demo, we'll go ahead and proceed to the next step. From the navy ribbon on the left side of the editor, click on the play/triangle icon.
You will see three sections up top to adjust your simulation settings if desired. Your input files will be saved to [Project Directory]/Scenarios/Default/TxtInOut
by default. Click on "Set your simulation period" to adjust your starting and ending simulation dates.
When you click on a date picker, please note that you may use the arrows at the top of the date picker to move between decades and years. For this demo, set the ending simulation date to December 31, 2000. Use the arrows to find the year 2000, then click on the 31 in December to confirm the new date.
Click on the next section: choose output to print. Adjust your warm-up period to 3 years. Scroll to see all the available outputs to print. Use the top row of check boxes to select all yearly and average annual outputs.
Scroll down, or click on "choose output to print" again to collapse the section. Now you will see three checkboxes of tasks: write inputs, run the model, and analyze output.
Here is a brief description of each task:
Write input files Translate your data saved from the edit inputs section in your project SQLite database to text files read by SWAT+. Any time you make edits, be sure to keep this box checked to re-write your files.
Run SWAT+ Execute a compiled version of the model.
Analyze output for visualization Read the output text files generated by the model into a SQLite database used for SWAT+ check and the QSWAT+ visualization tool
For this demo, and because it is our first time running the simulation, keep all three boxes checked. Click the "Save Settings & Run Selected" button to continue. When the tasks complete, you'll be presented with a menu of options for what to do next.
You may click to run SWAT+ Check to check for potential model problems. You may also save your scenario, which will make a copy of all of your inputs and outputs. After saving completes, any additional changes made to your project will not affect the saved scenario. You may load the saved scenario back to the editor from the project setup screen.
This concludes the introductory walk-through of SWAT+ Editor. You may close the editor by clicking the "Exit SWAT+ Editor" button from the interface, or by clicking the X in the top right of the editor window, or by going to File->Exit from the editor's menu.
After exiting the editor, you may proceed to QSWAT+ step 4: visualization. Please refer to the QSWAT+ manual for more information about this process.
When you open SWAT+ Editor, you are taken to the project setup screen. If you are coming from QSWAT+, an overlay will appear with the option to change your project display name and optionally use the lite version of the mode: SWAT+ lte.
When your project is done importing from GIS, it will be selected as your current project and displayed in the recent projects sidebar on the left as well as in the center screen.
From here you can start editing your SWAT+ inputs by clicking the "Get started" button at the bottom, or by clicking the pencil icon in the far left blue-colored menu.
SWAT+ lte is a version of the SWAT+ model that greatly simplifies hydrology and plant growth and does not simulate nutrients, concentrating on gully formation and stream degradation. It only uses channel and HRU objects.
If you are not coming from QSWAT+, you may open the editor and create a new project from scratch. A project database will be created for you and you will need to input your spatial connections and all other data manually.
Weather generator data and weather stations are required for SWAT+ to run.
Weather stations are linked from all of your connection objects (channels, HRUs, etc.) in SWAT+. If you are coming from QSWAT+, it is much better to import stations either from the weather generator section, or the observed weather file importer than it is to create them manually.
By importing through one of the methods described below, your new stations will be automatically matched your spatial connection objects.
Click the import data button to import weather generator (wgn) data for your project. If you installed the SWAT+ databases, this file will be selected by default along with the CFSR world table. USA wgn data is also available from this database; type wgn_us to use this table.
You may also add your own data to this database using the wgn and corresponding wgn_mon tables.
Below the table name field is a check box asking if you are using observed weather data. By default (unchecked), when you click start import, weather stations will be created based on your wgn locations. If you are using observed weather data and prefer to have weather stations created based on this data, check this box--stations will not be created when you start import, and instead they will be created for you when you import your observed weather data files.
If you are not using observed weather data, it is important to leave the box unchecked so that weather stations are created for you.
If you do not want to use the SQLite database, you may import CSV files of your weather generator data. Two CSV files are required.
Stations CSV file:
Columns id, name, lat, lon, elev, rain_yrs
id
should be uniquely numbered
Monthly values CSV file:
Columns id, wgn_id, month, tmp_max_ave, tmp_min_ave, tmp_max_sd, tmp_min_sd, pcp_ave, pcp_sd, pcp_skew, wet_dry, wet_wet, pcp_days, pcp_hhr, slr_ave, dew_ave, wnd_ave
id
should be uniquely numbered
wgn_id
corresponds to the id
column from the stations file
Import observed weather data from the top of the weather stations section. The data files may be in one of two formats: SWAT2012/Global Weather Data CFSR website format, or SWAT+.
After importing observed weather data, be sure to modify your simulation run time to match your weather dates.
Each measurement included in your data must have the following entry file names:
Each entry file is a comma-separated list of stations. Each station name should have a corresponding .txt file (e.g., name p326-963 should have a p326-963.txt file).
Each station file should have the first line as the starting day as YYYYMMDD (e.g., 19790101). The following lines are the measurement for each day, one line per day. For temperature, each line will be max,min (e.g., 10.138,-2.662).
Global weather data options are available on the SWAT website.
Each measurement included in your data must have the following entry file names:
Each entry file has a title line (any text allowed), followed by a heading line, followed by a list of filenames for each station. Filenames should be listed alphabetically.
Each station file has a title line, followed by a heading line and data line for time and location. Measurements for each timestep are in the lines to follow. For temperature, the measurements will be listed as max then min.
Each entry in weather_wgn_cli will have 12 rows in weather_wgn_cli_mon.
When entering an observed weather file name in the station editor, you may start typing to search for existing weather files adding during the import step. If adding observed files manually, just type the name of the file (e.g., p326953.pcp), and put that file in the directory you plan to write input files (e.g., your TxtInOut). Files must be in SWAT+ format. If your weather data is in SWAT2012 format or from the Global Weather CFSR website, please use the import step to convert them to SWAT+.
This table is only used if you import observed weather data files. If entering stations manually, this table will not be populated.
Documentation is available in the next section of this website, however please make use of our user groups if you get stuck or run into an issue.
Because there are distinct pieces to SWAT+, we have created user groups for each. Please identify which area you are having difficulty with and choose the appropriate group:
For issues defining your watershed in QGIS and using the QSWAT+ plugin.
For issues related to the editor interface.
For questions and discussion related to the model itself, not the editor or GIS interfaces.
SWAT+ Toolbox is designed to work with the SWAT+ model. You can use it for sensitivity analysis, model calibration, evaluation, and validation. The software is currently only available on Windows. There are built-in updates through which more features, functionalities and bug fixes will be delivered. Check for updates as soon as you install. Check the user documentation .
For SWAT+ Editor bugs or technical issues, report to the user groups or the . However, please use this only for Editor software problems, and continue to use the google group for data-related issues.
Before contacting support, please read through our list of common issues to see if there is a simple solution already posted.
Click the pencil icon in the leftmost blue toolbar to enter the editing section. Most editors in this section are a literal representation of the SWAT+ input files. The collapsible dark-gray headings on the left correspond to the section lines in the master watershed file (file.cio).
When you click on an editor section from the left menu, you'll find the default SWAT+ file name with which the section corresponds. This enables you to quickly look up further information in the SWAT+ input/output documentation.
Most data is presented in a tabular format. When you click a row, you're presented with a form where you can make changes and save. The following features are common across many editor sections.
Sort by a column in the table by clicking on the heading name. It will toggle ascending or descending direction as indicated by the arrows next to the name.
Tables with many records can be scrolled and then paged by clicking the page number or arrow links at the bottom of the table.
Each row may contain an edit/view icon on the far left to access the data in the row, and a delete icon on the far right (may need to scroll to access the far right of the table). We do not recommend deleting rows unless you are absolutely sure they are not used elsewhere in your model. Due to the relationships of data in SWAT+, deleting records could have unintended effects and break your model. Deleting cannot be undone; if in doubt, make a backup of your project SQLite database first.
In the search box up top, start typing the name of the objects you want to find. Matching options will appear in the table. Remove the text from the search box to remove the filter.
In the action bar at the bottom, click create new record to add an item to the table. The import/export data button allows you to quickly access your data in CSV (comma-separated values spreadsheet) format, in most cases. We recommend exporting your data (or empty table is okay) first to get a template with the column names. You may then modify the file and import it back into the editor.
Most objects in SWAT+ have a name field and are identified using this name. Names should be unique and not contain spaces (spaces will be automatically converted to underscores).
Each edit form will have a save changes button at the bottom. Be sure to click this button after making any changes and before leaving the form.
Press the back button to return to the previous screen. Click copy to make a copy of the current object you are viewing. You will be asked to give the copied object a unique name. Note: the copy function is not available for all object types, including connection objects.
There are a lot of relationships between objects in SWAT+. For example, all fields in your channel properties table link to rows in other tables. In SWAT+ Editor forms, you can easily select these related rows by starting to type an object's name and select it as it pops up. If you accidentally enter an incorrect name, the editor will return an error stating the record does not exist in your database.
If you want to apply changes to a field for multiple objects at once, you can use bulk edit mode. Select one object from the table as your base. This can be useful if you want to use its values to apply across many other objects, but if you're using entirely new values, it does not matter which object you select.
From the object's edit form page, click the arrow on the right side of the save changes button and then click "Make changes to multiple records..." to enter bulk edit mode.
First, select the objects to which you want to make changes. Note that the object you're currently viewing is not selected by default. For most sections, you can filter your selection by subbasin first. If you're editing an HRU-level objects, you can also filter by landuse. In the above example, we checked Subbasin 1, which then populated the next list with channels that fall into Subbasin 1. All are selected by default, but you can uncheck as needed.
Next, choose which fields you want to edit by clicking the check box to the left of the field. In the above example, we checked the box for Manning's n. Enter the value you want and click Save Bulk Changes. Manning's n will be updated to your new value for each selected channel.
We recommend starting in the climate section, and importing your weather generators and observed weather data. If you're coming from GIS, when you import weather generators or observed data, it will create weather stations and match them to your spatial objects automatically.
The connections section contains all spatial object connectivity for the simulation run. In SWAT+ Editor, all connection object properties can be set through this section. For example, when you click on channels, you will see additional menu links appear for initialization, hydrology and sediment, and nutrients.
All connection objects have a similar format as seen in the above figure. Each connection object will have properties associated with it (such as initial, hydrology and sediment, and nutrients in this example) as well as a weather station. Click on these names in the table, or from the edit view page, click the button next to their names to view information about the properties object or weather station.
Each connection object may have outflow. The total number of outflow connections is shown in the right-most column of the table (note: you may need to use the horizontal scroll button at the bottom of the table if it is wide). To view the outflow objects, click the edit icon on the left of the row you want to view.
If you imported your project from GIS, your connection objects are populated automatically during project setup.
The subbasin is defined by the DEM in the GIS interface as it always has been. All flow within the subbasin drains to the subbasin outlet.
A landscape unit (LSU) is defined as a collection of HRUs and can be defined as a subbasin, or it could be a flood plain or upland unit, or it could be a grid cell with multiple HRUs. The landscape unit is not routed, it only used for output. The landscape unit output files (waterbal, nutbal, losses, and plant weather) are output for HRUs, landscape units, and for the basin. Two input files are required: 1) landscape elements and, 2) landscape define. The elements file includes HRUs and their corresponding LSU fraction and basin fractions. The define file specifies which HRUs are contained in each LSU.
A routing unit is a collection of hydrographs that can be routed to any spatial object. The routing unit can be configured as a subbasin, then total flow (surface, lateral and tile flow) from the routing unit can be sent to a channel and all recharge from the routing unit sent to an aquifer. This is analogous to the current approach in SWAT. However, SWAT+ gives us much more flexibility in configuring a routing unit. For example, in CEAP, we are routing each HRU (field) through a small channel (gully or grass waterway) before it reaches the main channel. In this case, the routing unit is a collection of flow from the small channels. We also envision simulating multiple representative hillslopes to define a routing unit. Also, we are setting up scenarios that define a routing unit using tile flow from multiple fields and sending that flow to a wetland.
The routing unit is the spatial unit SWAT+ that allows us to lump outputs and route the outputs to any other spatial object. It gives us considerably more flexibility than the old subbasin lumping approach in SWAT, and will continue to be a convenient way of spatial lumping until we can simulate individual fields or cells in each basin.
Some common issues installing and loading our tools are listed below, organized by software component. Please check through these common scenarios before contacting support.
First, check to make sure you have the most recent version of the tools installed. Minor bug fixes may be fixed and updated in the component's source code repository download section.
If you are upgrading from a previous version, before installing an update, be sure to close SWAT+ Editor, QSWAT+, and QGIS. If you have trouble opening the software, or loading your existing projects in SWAT+ Editor, open the task manager and verify no instances of swatplus_rest_api.exe
are running. If they are, right-click and end the task, and reinstall.
Please note that on Windows, the minimum QGIS version allowed is 3.16.14, however we strongly recommend using version 3.22.
For most users, the QSWAT+ plugin should appear automatically in your QGIS toolbar after install. If it does not, click on the Plugins menu, then verify it is listed and checked in your list of installed plugins. If not, check the QGIS messages by clicking the thought bubble icon in the lower right corner of the screen. Click the QSWAT+ tab and copy and paste the messages in a new post in the . If there is no QSWAT+ tab, check the other tabs for information.
This can happen when opening an existing project. If you are using the standard SWAT+ plant table, use the plant pull-down menu in the Create HRUs form, select Use CSV file, and load SWATPlus/Databases/plant.csv
.
If you receive an error message similar to the image below, or you see a loading spinner for a minute followed by a message that the editor did not load correctly, it's possible that your installation didn't work properly.
Verify the files located in your SWATPlus installation folder, SWATPlus/SWATPlusEditor/resources/app.asar.unpacked/static
. The contents should be as described below:
api_dist
swatplus_api.exe
swatplus_rest_api.exe
swat_exe
There should be several executable files matching the current model revision number, e.g., rev60.5.7_64rel.exe
appsettings.json
swatplus_vardefs.sqlite
If any or all of the files above are missing, your installation did not complete successfully. You might try disabling your antivirus and installing again.
If you receive this message when you first launch your project in the editor, it is a sign the editor did not load its services correctly.
Click the question mark icon in the lower left corner to open the help page. Scroll to the bottom and looking for the "Troubleshooting" section. If you see a message stating "Unable to connect to SWAT+ API", please try the following steps before contacting support:
Open a command prompt window. Make sure you are in the drive where you installed SWAT+. Browse to the location below, then run the swatplus_rest_api.exe file.
If it is working properly, you should receive something similar to the following:
If this is what you received, please simply close SWAT+ Editor and try launching it again.
If you get no message on the screen at all, it might be a permission error or problem related to your computer settings. Try installing to another location on your machine, such as another hard drive, or even install to a flash drive. If this still does not work, try another machine.
After install, go to where you installed the editor and open the appsettings.json
file located in the resources/app.asar.unpacked/static
directory. Set your python PATH variable in the appropriate section of the file.
When loading your projects from a previous version of the editor, the project should open right away and show a screen similar to the following:
If you do NOT see the above screen and instead your see a loading spinner for a minute followed by a message that the editor did not load correctly, it's possible that your update didn't work properly. Verify the date of the two files located in your SWAT+ installation folder, SWATPlus/SWATPlusEditor/resources/app.asar.unpacked/static/api_dist
.
If either file has a date earlier than the release date of the editor, they did not get updated during installation. Please uninstall SWAT+ entirely, manually delete the SWATPlus
folder, and install everything again.
Make sure you have the most recent version of QSWAT+ and followed the closely.
If you received an error during steps 1, 2, or 4 of the QSWAT+ interface, please consult the . Check existing questions to see if anyone else had the same problem. If not, please post your error and be as descriptive as possible about what you were doing when you received the error message.
SWAT+ Editor is most often accessed during step 3 of the QSWAT+ plugin. It may also be launched on its own (search for SWATPlusEditor
, or find this file in your SWATPlus/SWATPlusEditor
installation folder). Make sure you have the most recent version of SWAT+ Editor.
If your error is not covered by the solutions below, please consult the .
If you still cannot get it to open, you may need to try the Python version of the editor. You will need to install on your machine first. Make note of your Python PATH variable (typically python
on Windows or python3
on Linux/MacOS). for a custom Python installer of the editor.
If this is what you see, simple click the update project button to continue. While a backup of your project database will be created automatically, it is not a bad idea to keep a backup of your entire project folder manually yourself. Be sure to for a full understanding of what has changed in the model since the last version. Some manual data updates may be necessary.
If you receive any other error messages from SWAT+ Editor, from its menu go to View -> Toggle Developer Tools. In the windows that pops open, toggle the Console tab and take a screenshot or copy an errors received and post to the .
If you received an error running the model, first make sure you have run it in debug mode and checked the detailed error received. If you are not able to make sense of the source of the model error, please post to the AND include your project files. This error is likely project specific and we cannot help you without seeing your project files.
Measurement
Entry File
Precipitation
pcp.txt
Temperature
tmp.txt
Solar radiation
solar.txt
Relative humidity
rh.txt
Wind speed
wind.txt
ID
Name
Latitude
Longitude
Elevation
1
p326-963
32.628
-96.250
142.0
Measurement
Entry File
Precipitation
pcp.cli
Temperature
tmp.cli
Solar radiation
slr.cli
Relative humidity
hmd.cli
Wind speed
wnd.cli
pcp.cli: precipitation file names
filename
p326953.pcp
p326956.pcp
SWAT+ Input File
Database Tables
weather-wgn.cli
weather_wgn_cli
weather_wgn_cli_mon
Field
Type
Description
Units
Range
id
int
Auto-assigned identifier
name
text
Name of weather generator
lat
real
Latitude of weather station
deg.
+/-90
lon
real
Longitude of weather station
deg.
+/-180
elev
real
Elevation of weather station
m
0-5000
rain_yrs
int
Number of years of recorded maximum monthly 0.5h rainfall data
5-100
Field
Type
Description
Units
Range
id
int
Auto-assigned identifier
wgn_id
int
ID of row in weather_wgn_cli
month
int
Month
tmp_max_ave
real
Average or mean daily maximum air temperature for month
°C
-30-50
tmp_min_ave
real
Average or mean daily minimum air temperature for month
°C
-40-40
tmp_max_sd
real
Standard deviation for daily maximum air temperature in month
°C
0.1-100
tmp_min_sd
real
Standard deviation for daily minimum air temperature in month
°C
0.1-30
pcp_ave
real
Average or mean total monthly precipitation
mm
0-600
pcp_sd
real
Standard deviation for the average daily precipitation
mm/day
0.1-50
pcp_skew
real
Skew coefficient for the average daily precipitation
mm
-50-20
wet_dry
real
Probability of a wet day after a dry day
0-0.95
wet_wet
real
Probability of a wet day after a wet day
0-0.95
pcp_days
real
Average number of days of precipitation in a month
0-31
pcp_hhr
real
Maximum 0.5 hour rainfall in entire period of record for month
mm
0-125
slr_ave
real
Average daily solar radiation for the month
MJ/m^2/day
0-750
dew_ave
real
Average daily dew point temperature for each month
°C
-50-25
wnd_ave
real
Average wind speed for the month
m/s
0-100
SWAT+ Input File
Database Tables
weather-sta.cli
weather_sta_cli
weather_file
Field
Type
Description
id
int
Auto-assigned identifier
name
text
Name of the weather station
wgn_id
int
ID of row in weather_wgn_cli
pcp
text
Precipitation gage filename or "sim" if simulated
tmp
text
Temperature gage filename or "sim" if simulated
slr
text
Solar radiation gage filename or "sim" if simulated
hmd
text
Relative humidity gage filename or "sim" if simulated
wnd
text
Wind speed gage filename or "sim" if simulated
wnd_dir
text
Wind direction gage filename
atmo_dep
text
Atmospheric deposition data file name
lat
real
Latitude of weather station
lon
real
Longitude of weather station
Field
Type
Description
id
int
Auto-assigned identifier
filename
text
Name of the weather data file
type
text
Type of weather data: pcp, tmp, slr, hmd, wnd
lat
real
Latitude of weather station in file
lon
real
Longitude of weather station in file
Documentation for this section is not available yet. For now, please refer to the SWAT+ input/output documentation PDF for parameter definitions.
Documentation for this section is not available yet. For now, please refer to the SWAT+ input/output documentation PDF for parameter definitions.
In SWAT+, constant values for point sources and inlets are stored in the export coefficients properties file, exco.exc, while time series data are stored entirely in the recall section.
However, in the editor, we keep both constant and time series point sources and inlets in the recall section. When you write input files, the editor will write to the exco.exc and exco_om.exc files appropriately.
Please refer to the SWAT+ Input/Output Documentation linked below:
Please refer to the SWAT+ Input/Output Documentation linked below:
Please refer to the SWAT+ Input/Output Documentation linked below:
Please refer to the SWAT+ Input/Output Documentation linked below:
Please refer to the SWAT+ Input/Output Documentation linked below:
Please note: there was a long outstanding issues with time series recall in version 2.0.x of SWAT+ Editor due to a missed change in format of the model. This should be corrected in SWAT+ Editor 2.1.2 and greater. Please update your software and project and reach out if you encounter any issues.
Recall objects are used for connecting point source or inlet data to your watershed. If you added point source in QSWAT+, when you import your project into SWAT+ Editor it will be connected via the recall section.
By default, constant data with all zero values during the default simulation period is added. To add your own recall data, click the recall item in the edit menu under connections.
Download sample data. Please read the README.txt file in the zip carefully.
By default, your recall data is imported as constant. To insert your values, you can edit each item individually by clicking the edit button and manually entering each value. Alternatively, you may upload a CSV of your data.
From the recall section, click the import/export button from the action bar at the bottom. Import is selected by default, so click the export button toggle. Choose a folder name, and click the export data button to get a template for your data.
Constant data will be located in the recall.csv
file in the directory you selected. Edit the CSV as needed, save, and then go back to the editor and click the import/output button again. This time toggle the import button. Choose your directory containing your modified files and click the import CSV data button. Your updated values will appear in the table.
By default recall data is imported as constant, however this can be changed by clicking the edit button next to a row in the recall data table. Select the new time step for your data: daily, monthly, or yearly. Click the save changes button. Next, press the back button to go back to the table view. Click the import/export button. Import is selected by default, so click the export button toggle. Choose a folder name, and click the export data button to get a template for your data.
Your directory may now contain two files: a recall.csv containing constant data, and another csv file named for the recall object (e.g., pt002
) you changed to time series.
Open the time series file after it is exported to see the template for your data. Modify your data as needed matching the time step you selected previously. Be sure the years match your simulation run time.
You change other recall objects from constant to time series, and you can mix and match all different types (constant, yearly, monthly, and daily). For any recall objects moving from constant to time series, first delete its row in recall.csv
. Then create a new csv with the file name matching the recall object's name and insert your time series data. Similarly, if you want to move from time series back to constant, just delete the time series file and add a row back into recall.csv
for the object.
To import your data, click the import/export data button again and this time click to toggle import. Choose your directory and click import data. Your new data will appear in the table.
Each record in recall_rec will have a data file named {name}.rec. All of this data is stored in a single recall_dat table in the database.
General watershed attributes are defined in the basin input files: codes and parameters. These attributes control a diversity of physical processes at the watershed level. The interfaces will automatically set these parameters to the default or recommended values listed in the variable documentation. Users can use the default values or change them to better reflect what is happening in a given watershed. Variables governing bacteria or pesticide transport need to be initialized only if these processes are being modeled in the watershed. Even if nutrients are not being studied in a watershed, some attention must be paid to these variables because nutrient cycling impacts plant growth which in turn affects the hydrologic cycle.
Please refer to the SWAT+ Input/Output Documentation linked below:
Please refer to the SWAT+ Input/Output Documentation linked below:
A primary goal of environmental modeling is to assess the impact of human activities on a given system. Central to this assessment is the itemization of the land and water management practices taking place within the system. This section contains input data for planting, harvest, irrigation applications, nutrient applications, pesticide applications, and tillage operations. Information regarding tile drains and urban areas is also stored in this file.
In addition to the above, SWAT+ Editor groups the operations databases in this section of the editor. However, within the SWAT+ master watershed file (file.cio), these are listed under the ops section.
This section is the entry point for management data in SWAT+. It comprises cross-walks to several other sections of data.
This data is accessed from the HRU properties section (hru-data.hru).
Management schedules comprise auto-schedules (decision tables) and/or operations schedules.
When you import your project from GIS, SWAT+ assigns auto-schedules for management based on your crop land use.
For example, oats is a cold annual crop. If this crop is in your HRUs, a decision table named pl_hv_oats will be created based on the template of pl_hv_wwht when you import your data from GIS.
From the management schedules section, click create a new record or click edit on a row in the table. Give your schedule a unique name.
To add an automatic schedule, start typing a decision table name in the box provided. Click the desired result from the list of matches that pops up, and click the add button. If you enter more than one schedule, you can drag and drop to sort.
To add an operation, click the add operation button. Select your operation type from the form that pops up and complete the remaining fields. Click save when done to add the operation to your table.
When you're done adding automatic schedules and operations, click the save changes button to save your management schedule.
Values in the operations tables are provided in the SWAT+ datasets database and copied to your project database during project setup. You may modify them or add new rows as needed in the editor.
Values in this table are provided in the SWAT+ datasets database and copied to your project database during project setup. You may modify them or add new rows as needed in the editor.
Values in this table are provided in the SWAT+ datasets database and copied to your project database during project setup. You may modify them or add new rows as needed in the editor.
Values in this table are provided in the SWAT+ datasets database and copied to your project database during project setup. You may modify them or add new rows as needed in the editor.
Please refer to the SWAT+ Input/Output Documentation linked below:
Please refer to the SWAT+ Input/Output Documentation linked below:
Please refer to the SWAT+ Input/Output Documentation linked below:
SWAT+ Input File
Database Table
recall.rec
recall_rec
Field
Type
Description
id
int
Auto-assigned identifier
name
text
Name of recall object
rec_typ
int
Time step for recall object (1-daily, 2-monthly, 3-yearly)
SWAT+ Input File
Database Table
{name}.rec
recall_dat
Field
Type
Description
Units
jday
int
Julian day
mo
int
Month
day_mo
int
Day of the month
yr
int
Year
ob_typ
text
Type of recall
ob_name
text
Name of recall object
flo
real
Volume of water
m^3
sed
real
Sediment
metric ton
orgn
real
Organic nitrogen
kg N
sedp
real
Organic phosphorus
kg P
no3
real
Nitrate
kg N
solp
real
Mineral (soluble P)
kg P
chla
real
Chlorophyll-a
kg
nh3
real
Ammonia
kg N
no2
real
Nitrogen dioxide
kg N
cbod
real
Carbonaceous biological oxygen demand
kg
doc
real
Dissolved oxygen
kg
sand
real
Detached sand
silt
real
Detached silt
clay
real
Detached clay
sag
real
Detached small ag
lag
real
Detached large ag
gravel
real
Gravel
tmp
real
Temperature
deg c
SWAT+ Input File
Database Table
codes.bsn
codes_bsn
Field
Type
Description
pet_file
text
Potential ET filename
wq_file
text
Watershed stream water quality filename
pet
int
Potential ET method code
event
int
Event code
crack
int
Crack flow code
rtu_wq
int
Subbasin water quality code
sed_det
int
Max half-hour rainfall frac calc
rte_cha
int
Water routing method
deg_cha
int
Channel degradation code
wq_cha
int
Stream water quality code
rte_pest
int
Redefined to the sequence number of pest in NPNO(:) to be routed through the watershed
cn
int
CN method flag
c_fact
int
C-factor
carbon
int
Carbon code
baseflo
int
Baseflow distribution factor during the day for subdaily runs
uhyd
int
Unit hydrograph method
sed_cha
int
Instream sediment model
tiledrain
int
Tile drainage EQ code
wtable
int
Water table depth algorithms code
soil_p
int
Soil phosphorus model
abstr_init
int
Initial abstraction on impervious cover
atmo_dep
text
Atmospheric deposition code
stor_max
int
Max depressional storage selection code
headwater
int
Headwater code
SWAT+ Input File
Database Table
parameters.bsn
parameters_bsn
Field
Type
Description
Units
Default
Range
lai_noevap
real
Leaf area index at which no evaporation occurs from water surface
3
0-10
sw_init
real
Initial soil water storage expressed as a fraction of field capacity water content
0
0-1
surq_lag
real
Surface runoff lag coefficient
4
1-24
adj_pkrt
real
Peak rate adjustment factor for sediment routing in the subbasin (tributary channels)
1
0.5-2
adj_pkrt_sed
real
Peak rate adjustment factor for sediment routing in the main channel
1
0-2
lin_sed
real
Linear parameter for calculating the maximum amount of sediment that can be reentrained during channel sediment routing
0.0001
0.0001-0.01
exp_sed
real
Exponent parameter for calculating sediment reentrained in channel sediment routing
1
1-1.5
orgn_min
real
Rate factor for humus mineralization of active organic nutrients (N and P)
0.0003
0.001-0.003
n_uptake
real
Nitrogen uptake distribution parameter
20
0-100
p_uptake
real
Phosphorus uptake distribution parameter
20
0-100
n_perc
real
Nitrate percolation coefficient
0.2
0-1
p_perc
real
Phosphorus percolation coefficient
10 m^3/M
10
10-17.5
p_soil
real
Phosphorus soil partitioning coefficient
m^3/Mg
175
100-200
p_avail
real
Phosphorus availability index
0.4
0.01-0.7
rsd_decomp
real
Residue decomposition coefficient
0.05
0.02-0.1
pest_perc
real
Pesticide percolation coefficient
0.5
0-1
msk_co1
real
Calibration coefficient to control impact of the storage time constant for the reach at bankfull depth
0.75
0-10
msk_co2
real
Calibration coefficient used to control impact of the storage time constant for low flow (where low flow is when river is at 0.1 bankfull depth) upon the km value calculated for the reach
0.25
0-10
msk_x
real
Weighting factor control relative importance of inflow rate and outflow rate in determining storage on reach
0.2
0-0.3
trans_loss
real
Fraction of transmission losses from main channel that enter deep aquifer
0
0-1
evap_adj
real
Reach evaporation adjustment factor
0.6
0.5-1
cn_co
real
Currently not being used
denit_exp
real
Denitrification exponential rate coefficient
1.4
0-3
denit_frac
real
Denitrification threshold water content
1.3
0-1
man_bact
real
Fraction of manure applied to land areas that has active colony forming units
0.15
0-1
adj_uhyd
real
Adjustment factor for subdaily unit hydrograph basetime
0
0-1
cn_froz
real
Parameter for frozen soil adjustment on infiltration/runoff
0.000862
0-0
dorm_hr
real
Time threshold used to define dormancy
hrs
0
0-24
s_max
real
Currently not being used
n_fix
real
Nitrogen fixation coefficient
0.5
0-1
n_fix_max
real
Maximum daily-n fixation
kg/ha
20
1-20
rsd_decay
real
Minimum daily residue decay
0.01
0-0.05
rsd_cover
real
Residue cover factor for computing fraction of cover
0.3
0.1-0.5
vel_crit
real
Critical velocity
5
0-10
res_sed
real
Reservoir sediment settling coefficient
0.184
0.09-0.27
uhyd_alpha
real
Alpha coefficient for gamma function unit hydrograph
5
0.5-10
splash
real
Splash erosion coefficient
1
0.9-3.1
rill
real
Rill erosion coefficient
0.7
0.5-2
surq_exp
real
Exponential coefficient for overland flow
1.2
1-3
cov_mgt
real
Scaling parameter for cover and management factor for overland flow erosion
0.03
0.001-0.45
cha_d50
real
Median particle diameter of main channel
mm
50
10-100
cha_part_sd
real
Geometric standard deviation of particle size
1.57
1-5
adj_cn
real
Currently not being used
igen
int
Random generator code 0 = use default number; 1 = generate new numbers in every simulation
0
0-1
SWAT+ Input File | Database Table |
landuse.lum | landuse_lum |
management.sch | management_sch |
management_sch_auto |
management_sch_op |
cntable.lum | cntable_lum |
ovn_table.lum | ovn_table_lum |
cons_practice.lum | cons_practice_lum |
SWAT+ Input File | Database Table |
graze.ops | graze_ops |
harv.ops | harv_ops |
irr.ops | irr_ops |
sweep.ops | sweep_ops |
fire.ops | fire_ops |
chem_app.ops | chem_app_ops |
Field | Type | Description | Related Table |
id | int | Auto-assigned identifier |
name | text | Name of the land use properties |
cal_group | text | Calibration group |
plnt_com_id | int | Plant community | plant_ini |
mgt_id | int | Management schedule | management_sch |
cn2_id | int | Curve number | cntable_lum |
cons_prac_id | int | Conservation practices | cons_prac_lum |
urban_id | int | Urban land use | urban_urb |
urb_ro | text | Urban runoff |
ov_mann_id | int | Overland flow Manning's n | ovn_table_lum |
tile_id | int | Tile drain | tiledrain_str |
sep_id | int | Septic tank | septic_str |
vfs_id | int | Filter strip | filterstrip_str |
grww_id | int | Grassed waterway | grassedww_str |
bmp_id | int | Best management practices | bmpuser_str |
description | text | Optional description of the row |
Plant Type (in plants_plt) | Decision Table Template |
warm_annual | pl_hv_corn |
cold_annual | pl_hv_wwht |
perennial | no management schedule |
Field | Type | Description |
id | int | Auto-assigned identifier |
name | text | Name of the schedule |
Field | Type | Description |
id | int | Auto-assigned identifier |
management_sch_id | int | ID of management schedule |
d_table_id | int | ID of decision table |
Field | Type | Description |
id | int | Auto-assigned identifier |
management_sch_id | int | ID of management schedule |
op_typ | text | Type of operation (see options below) |
mon | int | Month operation takes place |
day | int | Day operation takes place |
op_data1 | text | Dependent on op_typ (see options below) |
op_data2 | text |
op_data3 | real | Override value |
Code | Description |
plnt | plant |
harv | harvest only |
kill | kill |
hvkl | harvest and kill |
till | tillage |
irrm | irrigation |
fert | fertilizer |
pest | pesticide application |
graz | grazing |
burn | burn |
swep | street sweep |
prtp | print plant vars |
skip | skip to end of the year |
Code | Value | Look-up Table |
plnt | plant name | plants_plt |
harv | plant name | plants_plt |
kill | plant name | plants_plt |
hvkl | plant name | plants_plt |
till | tillage name | tillage_til |
irrm | irrigation operation name | irr_ops |
fert | fertilizer name | fertilizer_frt |
pest | pesticide name | pesticide_pst |
graz | graze operation name | graze_ops |
burn | fire operation name | fire_ops |
swep | street sweep operation name | sweep_ops |
prtp | none |
skip | none |
Code | Value | Look-up Table |
plnt | none |
harv | harvest operation name | harv_ops |
kill | none |
hvkl | harvest operation name | harv_ops |
till | none |
irrm | none |
fert | chemical application operation name | chem_app_ops |
pest | chemical application operation name | chem_app_ops |
graz | none |
burn | none |
swep | none |
prtp | none |
skip | none |
SWAT+ Input File | Database Table |
harv.ops | harv_ops |
Field | Type | Description | Units |
id | int | Auto-assigned identifier |
name | text | Name of operation |
harv_typ | text | Harvest type: grain, biomass, residue, tree, or tuber |
harv_idx | real | Harvest index target specified at harvest |
harv_eff | real | Harvest efficiency |
harv_bm_min | real | Minimum biomass to allow harvest | kg/ha |
description | text | Optional description |
SWAT+ Input File | Database Table |
graze.ops | graze_ops |
Field | Type | Description | Units | Range |
id | int | Auto-assigned identifier |
name | text | Name of operation |
fert_id | int | ID of fertilizer from fertilizer_frt |
bm_eat | real | Dry weight of biomass removed by grazing daily | kg/ha | 0-500 |
bm_tramp | real | Dry weight of biomass removed by trampling daily | kg/ha | 0-500 |
man_amt | real | Dry weight of manure deposited | kg/ha | 0-500 |
grz_bm_min | real | Minimum plant biomass for grazing to occur | kg/ha | 0-5000 |
description | text | Optional description |
SWAT+ Input File | Database Table |
irr.ops | irr_ops |
Field | Type | Description | Units | Range |
id | int | Auto-assigned identifier |
name | text | Name of operation |
irr_eff | real | Irrigation efficiency | 0-1 |
surq_rto | real | Surface runoff ratio | 0-1 |
irr_amt | real | Depth of application for subsurface | mm | 0-100 |
irr_salt | real | Concentration of salt in irrigation water | mg/l |
irr_no3n | real | Concentration of nitrate in irrigation water | mg/l |
irr_po4n | real | Concentration of phosphate in irrigation water | mg/l |
description | text | Optional description |
SWAT+ Input File | Database Table |
chem_app.ops | chem_app_ops |
Field | Type | Description | Units |
id | int | Auto-assigned identifier |
name | text | Name of operation |
chem_form | text | Chemical form: liquid or solid |
app_typ | text | Application type: spread, spray, inject, direct |
app_eff | real | Application efficiency |
foliar_eff | real | Foliar efficiency |
inject_dp | real | Injection depth | mm |
surf_frac | real | Surface fraction amount in upper 10mm |
drift_pot | real | Drift potential |
aerial_unif | real | Aerial uniformity |
description | text | Optional description |
SWAT+ Input File | Database Table |
fire.ops | fire_ops |
Field | Type | Description |
id | int | Auto-assigned identifier |
name | text | Name of operation |
chg_cn2 | real | Change in SCS curve number II value |
frac_burn | real | Fraction burned |
description | text | Optional description |
SWAT+ Input File | Database Table |
sweep.ops | sweep_ops |
Field | Type | Description |
id | int | Auto-assigned identifier |
name | text | Name of operation |
swp_eff | real | Removal efficiency of sweeping operation |
frac_curb | real | Fraction of the curb length that is sweep-able |
description | text | Optional description |
SWAT+ Input File | Database Table |
cntable.lum | cntable_lum |
Field | Type | Description | Range |
id | int | Auto-assigned identifier |
name | text | Name of curve number entry |
cn_a | real | Curve number for hydrologic soil group A | 30-100 |
cn_b | real | Curve number for hydrologic soil group B | 30-100 |
cn_c | real | Curve number for hydrologic soil group C | 30-100 |
cn_d | real | Curve number for hydrologic soil group D | 30-100 |
description | text | Optional description |
treat | text | Treatment/Practice |
cond_cov | text | Condition of cover |
SWAT+ Input File | Database Table |
cons_practice.lum | cons_practice_lum |
Field | Type | Description |
id | int | Auto-assigned identifier |
name | text | Name of curve number entry |
usle_p | real | Usle p factor |
slp_len_max | real | Maximum slope length |
description | text | Optional description |
SWAT+ Input File | Database Table |
ovn_table.lum | ovn_table_lum |
Field | Type | Description |
id | int | Auto-assigned identifier |
name | text | Name of curve number entry |
ovn_mean | real | Overland flow Manning's n = mean |
ovn_min | real | Overland flow Manning's n = min |
ovn_max | real | Overland flow Manning's n = max |
description | text | Optional description |
Please refer to the SWAT+ Input/Output Documentation linked below:
Decision tables are a precise yet compact way to model complex rule sets and their corresponding actions. Decision tables, like flowcharts and if-then-else and switch-case statements, associate conditions with actions to perform, but in many cases do so in a more elegant way (see Wikipedia article on decision tables).
Structure of decision tables:
Conditions
Condition alternatives
Actions
Action entries
Each decision corresponds to a variable, relation or predicate whose possible values are listed among the condition alternatives. Each action is a procedure or operation to perform, and the entries specify whether (or in what order) the action is to be performed for the set of condition alternatives the entry corresponds to. Many decision tables include in their condition alternatives the "don’t care" symbol, a hyphen. Using "don’t cares" can simplify decision tables, especially when a given condition has little influence on the actions to be performed. In some cases, entire conditions thought to be important initially are found to be irrelevant when none of the conditions influence which actions are performed.
There are four decision table sections in SWAT+: land use management, reservoir release, scenario land use, and flow conditions.
See the land use management documentation, under management schedules for how to choose a decision table for your HRUs.
Reservoir release decision tables are assigned from the reservoir properties section under connections in SWAT+ Editor.
In the current version of SWAT+ editor, we do not have a GUI available for editing decision tables, however we have provided the ability to export the decision table file. You may then make changes to it in a text editor, and upload back into SWAT+ Editor.
The following is an example of a decision table in the lum.dtl input file. It is a table for warm season annual crops, using continuous corn.
In the above table, there are 6 conditions, 4 alternatives and 3 actions.
soil_water – if soil water is too high (> 1.50*field capacity), it will be too wet to operate machinery
plant_gro – (“n”) Planting allowed if plant is not growing.
phu_base0 – (0.15) when the sum base zero heat units for the year (starting Jan 1) exceeds 0.15, indicating it’s warm enough to plant
phu_plant – (1.15) harvest is scheduled when the sum of the heat units for the crop exceed 1.15 (if the heat units to maturity for the crop = 1500, then harvest would be scheduled at 1.15 * 1500 = 1725).
year_rot – needed to identify the current year of rotation. In this example, corn is grown in year 1.
days_plant – days since last plant (200) to ensure harvest occurs before next crop is planted.
If all of the conditions for each alternative are met, outcomes are checked for ‘y’ to take action. Alternatives with dash (‘-‘) are not checked.
plant corn based on heat units: if soil water < 1.50*fc and if phubase0 > 0.15*phu_mat and if year_rot = 1 then check outcomes for ‘y’ and if ‘y’, take that action (plant)
Harvest corn based on crop accumulated heat units: if soil_water < 1.50*fc and if phu_plant > 1.15*phu_mat and if year_rot = 1 and then check outcomes for ‘y’ and if ‘y’, take that action (plant)
Harvest corn based on days since planting: if year_rot = 1 and if days_plant =200 then check outcomes for ‘y’ and if ‘y’, take that action (harvest)
Reset rotation year: if year_rot > 1 then check outcomes for ‘y’ and if ‘y’, take that action (rot_reset)
plant: corn – cross walked to plant name in plants.plt file
harvest_kill: corn – cross walked to plant name in plants.plt file grain – relates to harvest type in harv.ops file
rot_reset: rotation reset – for continuous corn (1 year rotation). The rotation year is reset to 1 at the end of every year.
Please refer to the SWAT+ Input/Output Documentation linked below:
After writing your input files, click the play/triangle button in the leftmost blue toolbar to go to the run SWAT+ section.
You will see three sections up top to adjust your simulation settings if desired. Your input files will be saved to [Project Directory]/Scenarios/Default/TxtInOut
by default. Click on "Set your simulation period" to adjust your starting and ending simulation dates.
When you click on a date picker, please note that you may use the arrows at the top of the date picker to move between decades and years. Then click the day on the calendar to confirm the new date.
Next you may choose your output to print.
Here is where you set your model warm-up period (2-5 years is recommended) and select which type of output to print. If you intend to use SWAT+ Check, be sure all yearly and annual average files are selected. Use the checkboxes in the top row of the table to select all. Click the advanced user options button on the right for more printing options, such as printing output in CSV. This will print CSV files in addition to the text files that are printed by default.
Collapse the "Choose output to print" section to see the list of run tasks.
Here is a brief description of each task:
Write input files Translate your data saved from the edit inputs section in your project SQLite database to text files read by SWAT+. Any time you make edits, be sure to keep this box checked to re-write your files.
Run SWAT+ Execute a compiled version of the model.
Analyze output for visualization Read the output text files generated by the model into a SQLite database used for SWAT+ check and the QSWAT+ visualization tool
If you encounter an error during the model run, check the box to run the debug version (note: debug is only available on Windows) and run the model again. Copy the contents of the output error and see our SWAT+ model user group for help diagnosing the problem.
Download example data formatted for importing into the editor
Some files below may be zipped. Please unzip before using in the editor.
Section | Subsection | File Format |
---|---|---|
Formats not included in this page can usually be found by using the import/export tool on each table in SWAT+ Editor. Export the current data to CSV to get the template.
Water allocation tables are very specific to the watershed and new feature in SWAT+. We recommend working with the model development team if you are unsure. Because this is a new addition, the interface is still limited if you're trying to build a large table with many source and demand objects.
Demand. Demand can be irrigation demand from an hru, municipal demand, or demand to transfer to another source object (channel, reservoir, aquifer). For irrigation demand, the hru number, decision table for triggering irrigation, and irrigation depth (mm) are input. For municipal demand, a muni number is input. The user then has the option to input an average daily demand or a recall name that can be daily, monthly, or annual. For transfer demand, the trans number is input and the user can input an average daily demand or a decision table to specify demand.
Treatment. Treatment is designed for municipal treatment plants or industrial plants that treat or change the water chemistry. There are 2 options – 1) recall where you can specify the amount of return flow and 2) delivery where you can specify the change in flow and chemistry.
Receiving. This can be used to return the treated municipal water (point sources) or to transfer (divert) water to other objects. The simple option is the input the return object and number. Or a decision table can be input to condition the diversions to multiple objects. Inputting “lost” assumes the water is diverted out of the basin.
Source Allocation. The sources are listed in order of selection and the fraction from each source is input. The other input is compensation – if other sources are not available, the current source may be allowed to compensate for the demand. The model goes through all sources in the order listed and allocates based on the fractions. The model loops through the sources again, checking to see if compensation is allowed
SWAT+ Editor is a program that allows users to modify SWAT+ inputs easily without having to touch the SWAT+ input text files directly. The editor will import a watershed created in QSWAT+, or allow the user to create a SWAT+ project from scratch. The user may write input files and run the SWAT+ model through the editor.
The following software is used to create and build SWAT+ Editor:
SWAT+ Editor uses a database to hold model input data to allow easy manipulation by the user. The database is structured to closely resemble the SWAT+ ASCII text files in order to keep a clean link between the model and editor. The following conventions are used in the project database:
The table names will match the text file names, replacing any “.” or “-“ with an underscore “_”.
The table column names will match the model’s variable names. All names use lowercase and underscores.
Any text file with a variable number of repetitive columns will use a related table in the database. For example, many of the connection files contain a variable number of repeated outflow connection columns (obtyp_out, obtyno_out, hytyp_out, frac_out). In the database, we represent these in a separate table, basically transposing a potentially long horizontal file to columns.
All tables will use a numeric “id” as the primary key, and foreign key relationships will use these integer ids instead of a text name. This will allow for easier modification of these object names by the user and help keep the database size down for large projects.
A separate SQLite database containing common datasets and input metadata will be provided with SWAT+ Editor. (This is a replacement for the SWAT2012.mdb packaged with SWAT2012 versions of ArcSWAT, QSWAT, and SWATeditor.)
For example, we have two tables representing soils: soils (soils_sol
) and layers (soils_sol_layer
). The layer table has a foreign key to the main soils table, so we know to which soil the layer belongs. In the python class, this field is named soil
, and in the database it is called soil_id
.
See the link below for information about accessing and running the source code.
QSWAT+ and SWAT+ Editor use a database to hold model input data to allow easy manipulation by the user. The database is structured to closely resemble the SWAT+ input text files in order to keep a clean link between the model and editor.
We recommend using the SWAT+ Editor program provided to browse and edit SWAT+ input data. However, if you need to access the database, we recommend using:
There are many other alternatives out there. A few of them are:
SWAT+ contains many cross-walks between files, and the database follows suit by creating foreign key relationships where applicable. In the SWAT+ text files, you will see files reference object names from another file. In the database however, these are done with an integer id. Relational databases make it easy to view the referenced row.
In SQLite Studio, right-click a foreign key id in a row of data, and select “Go to referenced row in table …” as shown in the image below. This will open the referenced row of data in a new tab.
Results in:
In addition, reformatted SSURGO and STATSGO soils databases is . The structure of the soils database has been split into two tables: a soil table and soil_layer table.
Similarly, the global weather weather generator database is in SQLite format. The structure of the wgn database has been split into two tables: a wgn table and wgn_monthly_value table.
SWAT+ Editor uses the () to represent and work with the tables in Python. The use of an ORM provides a layer of abstraction and portability in hopes of streamlining future SWAT+ development projects.
Relationships are defined in a python class as a ForeignKeyField
. In the python class, the field will be named after the object it is referencing. In the database, this name will automatically be appended by the referencing table’s column name, which is usually id
.
SWAT+ Input File
Database Table
lum.dtl, res_rel.dtl, scen_lu.dtl, flo_con.dtl
d_table_dtl
d_table_dtl_cond
d_table_dtl_cond_alt
d_table_dtl_act
d_table_dtl_act_out
Field
Type
Description
id
int
Auto-assigned identifier
name
text
Name of the decision table
file_name
text
File name denoting type of decision table: lum.dtl, res_rel.dtl, scen_lu.dtl, flo_con.dtl
Field
Type
Description
Related Table
id
int
Auto-assigned identifier
d_table_id
int
ID of decision table
d_table_dtl
var
text
Condition variable
obj
text
Object variable (res, hru, etc)
obj_num
int
Object number
lim_var
text
Limit variable (evol, pvol, fc, etc)
lim_op
text
Limit operator (*, +, -)
lim_const
real
Limit constant
Field
Type
Description
Related Table
id
int
Auto-assigned identifier
cond_id
int
ID of condition
d_table_dtl_cond
alt
text
Condition alternatives (>, <, =)
Field
Type
Description
Related Table
id
int
Auto-assigned identifier
d_table_id
int
ID of decision table
d_table_dtl
act_typ
text
Type of action (reservoir, irrigate, etc)
obj
text
Object variable (res, hru, etc)
obj_num
int
Object number
name
text
Name of action
option
text
Action option-specific to type of action (e.g., for reservoir, option to input rate, days of draw-down, weir equation pointer, etc)
const
real
Constant used for rate, days, etc
const2
real
fp
text
Pointer for option (e.g., weir equation pointer)
Field
Type
Description
Related Table
id
int
Auto-assigned identifier
act_id
int
ID of action
d_table_dtl_act
outcome
bool
Perform action (1 or true), or don't perform action (0 or false)
Climate
Weather Generator
Climate
Weather Stations
Climate
Atmospheric Deposition
Connections
Point Source / Inlet
Field
Description
Type
name
name of the water allocation object
string
rule_typ
rule type to allocate water
string
src_obs
number of source objects
integer
dmd_obs
number of demand objects
integer
cha_ob
channel object (enter y=yes there is a channel object; enter n=no channel object (only one per water allocation object)
string
Field
Description
Type
num
demand object number
integer
ob_typ
object type (channel=cha; reservoir=res; aquifer=aqu; unlimited source=unl)
string
ob_num
number of the object type
integer
limit_mon
minimum monthly values for object type:
channel flow (m3/s)
minimum reservoir level (fraction principal);
maximum aquifer depth (m);
real
Field
Description
Type
num
demand object number
integer
ob_typ
hru (for irrigation) or muni (muncipal) or divert (interbasin diversion)
string
ob_num
number of the object type
integer
withdr
withdrawal type - average day or recall for muni and divert; irrigation for HRU
string
amount
m3 per day for muni and mm for HRU
real
right
water right (sr=senior; jr=junior)
string
treat_typ
recall for inputting a recall object and treat for a treatment object
string
treatment
pointer to the recall or delivery ratio file
string
rcv_ob
receiving object (channel, reservoir, aquifer) - no decision table, all return to this object
string
rcv_num
receiving object number
integer
rcv_dtl
receiving object decision table - to condition water transfers and diversions
string
dmd_src_obs
number of source objects available for the demand object
integer