Swat Weather Database: A Quick Guide
Swat Weather Database: A Quick Guide
Swat Weather Database: A Quick Guide
Weather Database
A Quick Guide
March 2018
v. 0.18.03
Contents
1. Introduction ..................................................................................................................................... 3
2. Installing and Opening the Database ............................................................................................... 4
i. System Requirements .................................................................................................................. 4
ii. Installation Steps.......................................................................................................................... 4
iii. Opening the Database ................................................................................................................. 4
3. Database Structure .......................................................................................................................... 6
i. The Weather Stations Table ........................................................................................................ 6
ii. The Weather Variables Tables ..................................................................................................... 6
a. The Relative Humidity Table (HMD) ........................................................................................ 7
b. The Precipitation Table (PCP) .................................................................................................. 7
c. The Solar Radiation Table (SLR) ............................................................................................... 7
d. The Temperature Table (TMP) ................................................................................................ 8
e. The Wind Speed Table (WND) ................................................................................................. 8
4. The Graphical User Interface ........................................................................................................... 9
i. The Home window ....................................................................................................................... 9
ii. The Manage Stations Database window ..................................................................................... 9
iii. The Manage Weather Database window .................................................................................. 11
iv. The Write Data to ArcSWAT Input Files window ....................................................................... 12
v. The SWAT WGEN Statistics window .......................................................................................... 12
vi. The Help window ....................................................................................................................... 14
2
1. Introduction
SWAT Weather Database is designed to be a friendly tool to store and process daily weather data to
be used with SWAT projects. It is capable of:
E-mail: arthur.essenfelder@gmail.com
Essenfelder, A. H. (2016). SWAT Weather Database: A Quick Guide. Version: v.0.16.07. doi:
10.13140/RG.2.1.4329.1927.
or Bibtex entry:
@manual{SWAT-WeatherDatabase,
author = {Arthur H. Essenfelder},
title = {{SWAT Weather Database: A Quick Guide}},
date = {July, 2016},
language = {English},
version = {v. 0.16.07},
pagetotal = {14},
pubstate = {July, 2016},
doi = {10.13140/RG.2.1.4329.1927}
}
3
2. Installing and Opening the Database
i. System Requirements
In order to run SWAT Weather Database, the following should be met:
Obs: Do not change the structure of the folder (e.g. rename the folders or files, move files outside
the main folder, etc.) as, by doing so, the WeatherDatabase.accdb will not be able to correctly find the
required references.
The folder documentation stores relevant .pdf documents to be consulted during the use of the
Weather Database. The folder Tables stores the WeatherDatabase_be.accdb database, which actually stores
the weather data to be used by the application.
Obs: Users more experienced in using Microsoft Access can fill the WeatherDatabase_be.accdb
directly, without using the developed GUI to do so. However, in order to create the input .txt ArcSWAT
weather files and to calculate the WGEN statistics, it is recommended to use the GUI interface.
4
Figure 1 - The Home window.
Obs: If you get a security warning asking you if you would like to enable the use of macros and vba
codes, please do so, otherwise some parts of the application will not work. By doing so, the
WeatherDatabase.accdb will close itself. Just reopen it to use it again with all the functionalities enabled. If
the message “Table links successfully updated.” appears on the bottom of the screen, then everything is
correctly enabled.
5
3. Database Structure
This section describes the structure of the SWAT Weather Database. In general terms, the database
is composed of one table to store the weather stations data and other five tables to store the weather
variables data, such as temperature and precipitations.
The field “Station Code” must not contain any duplicate values, otherwise it will not be imported to
the database. The field “Station Name” is the one used by the SWAT Weather Database on the output files. If
the user prefer, both the fields “Station Code” and “Station Name” can have the same values. When
importing data to the weather stations table the column headers should be the same as the field names
shown on Table 1. An example file can be found in:
(installation folder)\ExInputs\stations.csv
All the weather variables tables have the fields “Date” and “Station”. The field “Date” is defined as
the U.S. date format (i.e. 1st March 1990 = 03/01/1990). The field “Station” must have the same value as the
field “Station Code” previously stored in the weather stations table (see The Weather Stations Table).
Obs: If a record being inputted in the weather database does not have a Station-StationCode match,
the database will refuse to import it. The weather stations database must be filled before importing the
actual weather information.
Although the structure of the weather variable table allows duplicate values for the fields “Date” and
“Station” alone, it will not accept duplicate values for a combination of both. In other words, the
combination Date-Station must be unique.
6
As for any SWAT project, missing values must be entered as -99.0. Such values will not be used
during the calculation of the WGEN statistics. They will, however, be written to the ArcSWAT input .txt files.
When importing data to the HMD table, if the source file has a first row header, the column names
should be the same as the field names shown on Table 2. An example file can be found in:
(installation folder)\ExInputs\hmd.csv
When importing data to the PCP table, if the source file has a first row header, the column names
should be the same as the field names shown on Table 3. An example file can be found in:
(installation folder)\ExInputs\pcp.csv
7
When importing data to the SLR table, if the source file has a first row header, the column names
should be the same as the field names shown on Table 4. An example file can be found in:
(installation folder)\ExInputs\slr.csv
When importing data to the TMP table, if the source file has a first row header, the column names
should be the same as the field names shown on Table 5. An example file can be found in:
(installation folder)\ExInputs\tmp.csv
When importing data to the WND table, if the source file has a first row header, the column names
should be the same as the field names shown on Table 6. An example file can be found in:
(installation folder)\ExInputs\wnd.csv
8
4. The Graphical User Interface
The GUI was developed to help users during the process of managing data stored by the SWAT
Weather Database and during the generation of the output files. It has a clear look and is the easiest way to
import, edit or remove data stored in the database.
All the windows in this application are divided into three parts: the header, which contains quick-
access buttons related to the current opened window; the body, contains some navigation options, and; the
footer, which displays messages and warnings.
Basically, all the windows have the following navigation buttons on the header section:
The button displays information about the application, as its version and contacts;
The button return the application focus to the Home window;
The button closes the current window.
The button “Manage Stations Database” calls a window which helps the user to import,
edit, export and delete weather stations data;
The button “Manage Weather Database” calls a window which helps the user to import,
edit, export and delete weather variables data;
The button “ArcSWAT Input .txt Weather Files” calls a window which helps the user to
export stored weather data as .txt files ready to be used as input for your ArcSWAT project;
The button “SWAT WGEN Statistics” calls a window which helps the user to calculate the
WGEN statistics based on the stored weather data and export it as an output file;
The button “Help” calls a window which display relevant documentation, such as this guide;
The button “Exit” closes the application.
9
Figure 2 - The Manage Stations Database window.
Obs: Please remember that in order to maintain the data integrity, it is recommended to store the
weather stations data prior to storing other related weather data.
Obs: Please note that by pressing the button “Import stations data” only new information will be
imported to the database. Previous stored unique Station Code will not be updated. To do so, please use the
update button (see The Weather Stations Table for more details on how the stations data table is defined).
10
iii. The Manage Weather Database window
The Manage Weather Database window allows the user to import, edit, export and delete weather
variables data (e.g. humidity, precipitation, etc.). On the body section, it displays a field called “Weather
Data”, which must be filled before performing any management actions. The window looks like Figure 3.
Obs: Please remember that in order to maintain the data integrity, it is recommended to store the
weather stations data prior to storing other related weather data.
Obs: Please note that by pressing the button “Import weather data” only new information will be
imported to the database. Previous stored unique combinations of Date and Station Code will not be
updated. To do so, please use the update button (see The Weather Variables Tables for more details on how
the weather data tables are defined).
11
iv. The Write Data to ArcSWAT Input Files window
The Write Data to ArcSWAT Input Files window allows the user to export stored weather data as .txt
files ready to be used as input for ArcSWAT projects. It looks like Figure 4.
The Write Data to ArcSWAT Input Files window body has the following information:
A field called “SWAT Version”, which must be filled before proceeding (i.e. 2009 or 2012).
A field called “Weather Data”, which must be filled before proceeding.
A button called “Generate ArcSWAT .txt Files”.
When the button “Generate ArcSWAT .txt Files” is pressed, it will access all the selected weather
data and write it to .txt files which will be stored in a folder named after the selected weather data variable.
If this folder already exists, a message will be shown to the user asking whether to proceed or not.
12
Figure 5 - The SWAT WGEN Statistics window.
The SWAT WGEN Statistics window body has the following information:
A field called “WGEN File Name”, which stores the name of the output file to be created
after the calculation of the WGEN statistics. If left blank, the name “WGEN” will be used.
A field called “Output File Type”, which stores the extension of the output file to be created
after the calculation of WGEN statistics. If left blank, the extension “.xls” will be used.
A button called “Calculate WGEN Data”.
When the button “Calculate WGEN Data” is pressed, it will access all the selected weather data,
calculate the WGEN statistics for the available stations at once and write them to the selected WGEN file
name and extension. If the file already exists, a message will be shown to the user asking whether to proceed
or not.
1. The RAIN_YRS (number of years of maximum monthly half-hour rainfall) is currently not
calculated by the application. A default value of RAIN_YRS = 10 is assumed for all weather
stations;
2. The RAINHHMX (maximum half-hour hour rainfall in entire period of record for month) is
estimated as being the average of 1/3 of the maximum recorded daily rainfall for that
month.
3. The DEWPT (Average daily dew point temperature for each month) is actually the relative
humidity (fraction). This is done as the SWAT model understands the DEWPT variable as the
average daily dew point temperature for each month (°C) or the relative humidity (fraction)
can be input. See the SWAT Input/Output Documentation for further details.
If any of the above mentioned considerations constrains your WGEN statistics, please consider
updating these values yourself before uploading these data to your SWAT project.
13
vi. The Help window
The Help windows brings the possibility of accessing some documents that may be helpful during the
use of the Weather Database. It looks similar to Figure 6.
14