SWAT Output Viewer – Export Annual Result to CSV File

Some research focus on the nutrient load at the outlet. An annual load table would be helpful. With SWAT Output Viewer, the table could be exported to a CSV file.

The Export button is located in the toolbar besides the help button.

Export Annual Button

To export the annual TP load, select the most downstream reach in the reach view and select TOT_Pkg in the variable list.


Click the Export Annual button and select the destination folder, the annual data will be exported to a csv file. An example file is shown below.

Export Annual Result


SWAT Output Viewer – Switch Time for Thematic Map

The thematic map in SWAT Output Viewer is able to show data of three summary types: single time step, annual and average annual. For single time step, it could be each day, each month and each year depending out the configuration of the outputs.

Thematic Map Summary

When the single time step option is selected, the time could be switched by double-clicking on the data record in chart table as shown below where monthly result is used. The time is also shown in the in the status bar on the bottom left corner. Note that, this only affect the thematic map. The chart would be affected.

Switch Time

An Interface to Quickly View SWAT Ouputs

User ManualSWATOutputViewerManual_v0.1

Installation Package: Download from Google Drive

SWAT Output Viewer is a Windows application designed to quickly extract data from SWAT outputs and display them on thematic map or/and in time series graph. The main features includes:

  • Thematic map for subbasins and reaches to show spatial distribution;
  • Time series graph with ability to compare to observed data;
  • Quick performance statistics against observed data;
  • Quick comparison to observed data and/or outputs from other model engine and scenario;
  • Selecting SWAT components on map;
  • Ability to work with ArcSWAT projects;
  • Help functions to run simulation and check model files.

The main interface is shown below.

SWAT Output Viewer.png

Quickly Check SWAT Model Performance with SWAT Output Viewer

During SWAT model calibration, the simulated flow, sediment, nitrogen and phosphorus results are frequently compared with observed values to evaluate the model performance. SWAT Output Viewer has the ability to quickly calculate several model performance indicators on-the-fly (as shown below) once the model simulation is done. Performance View - SWAT Output Viewer

To be able to compare with observed data, the observed data needs to be imported first, which could be done in project view. Take flow data as the example. Observed flow data is available for reach 5. Then the observed flow data needs to be associated with the simulated flow from reach 5. To do this, select reach 5 on the map and chose flow (m3/s) from the Observation drop down list (as shown below). Then click the the Load button to load the observed data from selected file. The loaded data is then associated with the flow from reach 5. This process only needs to be done once.

Import Observed Data - SWAT Output Viewer

Once the observed data is loaded, it could be used to calculate the performance indicators. These indicators are automatically calculated and displayed in a table when entering the performance view as shown below. The default performance indicator is NSE. It can be change to R2, RMSE, Bias, etc. If observed data is available at more than one location or for more than one variable (flow, sediment, N and P), the performance indicator would be calculated for all the locations and variables and list in a table. The table could be sorted by any columns.

Performance Indictors - SWAT Output Viewer

Furthermore, the performance indicator of each year is also calculated when one row is selected in the table above, with which the “best” and “worst” year could be identified.

Yearly Performance Indictors - SWAT Output Viewer.png

For each year, the simulated and observed data is also plotted as shown below, where the simulated data is in read and the observed data is in green.

Simulated Observed Plot - SWAT Output Viewer.png

In SWAT Output Viewer, the performance indicators are available simply by clicking once without generating any additional files. It’s quite useful when the model is calibrated manually.


ArcSWAT Error – Try inserting or pasting less data: IN, mWriteInputFiles.sol

If you get error messages like below, you come to the right place.


It means you are trying to write more data than the data table can hold. For example, you will get this message if trying to write string “I’m a long string” to a text field that could be 4 letter long.

It seems ArcSWAT don’t check the length of the data against the maximum length of the field when writing those data tables. Whenever you have a longer string, you will get this error message.

Solution is simple: either make your string shorter or increase the length of those fields. As we don’t want to change our data, the latter is better. But how?

The secret is in SWAT2012.mdb. It has tables with name like ***rng, e.g. solrng and hrurng. These tables defines the structure of those data tables we need in our project database, including the maximum length of a text field. Take table solrng as example as shown below. Each row defines one column in table sol. Amost of all these columns, SOIL is defined as TEXT(4) which means it’s a text column and could have maximum length of 4 letters. The column SOIL, SLOPE_CD and SNAM is similar.


Below is a list of these template tables and the corresponding table in project database. As you could see, most of the tables in project database is generated based on their template tables.

Template Table in SWAT 2012 Corresponding Data Table in Project Database
ciorng cio
croprng crop
dpdrng dpd
fertrng fert
gwrng gw
hrurng hru
mgt1rng mgt1
mgt2rng mgt2
opsrng ops
ovnrng ovn
pestrng pest
pndrng pnd
PPrng PP
resrng res
ribrng rib
rterng rte
seprng sep
septwqrng sept
sfbrng sfb
solrng sol
subrng sub
swqrng swq
tillrng till
urbanrng urban
wgnrng wgn
wpdrng wpd
wusrng wus
wwqrng wwq

You may have know the solution of the error. Yes, we could increase the length of the text fields by changing their definition, i.e. change TEXT(4) to TEXT(n) where n is a number that big enough to hold all possible strings, say 100. We could usually get which table has problem, like the one we give at the beginning. It says the sol table has problem. So we go to the solrng table and increase the length limitation of all possible text columns and then try to write the data table again. If you don’t want to guess which column should be changed, just change all of them to 100. It should be good enough for most of the case.

Hope you find this helpful and happy SWAT modelling.