Swat Weather Database: A Quick Guide

Download as pdf or txt
Download as pdf or txt
You are on page 1of 14

SWAT

Weather Database
A Quick Guide

Arthur Hrast Essenfelder

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:

 Storing relevant daily weather information;


 Easily creating .txt files to be used as input information during an ArcSWAT project setup;
 Efficiently calculating the WGEN statistics of several weather stations in one-step run.

For comments, suggestions and bug reports, please contact:

Arthur Hrast Essenfelder

E-mail: arthur.essenfelder@gmail.com

 For citation, plain text:

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:

 32-bit or 64-bit Windows operating system;


 A recent Microsoft Access version installed (2010-onwards should be fine), and;
 A .pdf reader (e.g. Adobe Acrobat Reader).

ii. Installation Steps


To install the Metadata Database, just extract the contents of the compressed file
SWATWeatherDatabase.7z file anywhere in your computer (e.g. C:\SWAT\SWATWeatherDatabase). Inside
the installation directory, you should be able to find the file named WeatherDatabase.accdb and two folders,
namely Documentation and Tables.

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.

iii. Opening the Database


In order to start the SWAT Weather Database GUI, just double-click on the WeatherDatabase.accdb
file on the main installation folder. You should be greeted with a screen similar to Figure 1.

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.

i. The Weather Stations Table


The following table summarises the structure of the weather stations table:

Table 1 - The Weather Stations table structure.

MAX CHARACTER DUPLICATES


FIELD NAME DATA TYPE REQUIRED
FIELD LENGTH ALLOWED
Station Code Text 255 Yes No
Station Name Text 255 Yes Yes
Latitude Double 28 Yes Yes
Longitude Double 28 Yes Yes
Elevation Double 28 Yes Yes
Station Description Text 255 No Yes
Other Information Text 255 No Yes

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

ii. The Weather Variables Tables


The SWAT Weather Database stores daily weather data for five different weather variables:

 Relative Humidity (HMD);


 Precipitation (PCP);
 Solar Radiation (SLR);
 Maximum and Minimum Temperature (TMP);
 Wind Speed (WND).

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.

a. The Relative Humidity Table (HMD)


The following table summarises the structure of the HMD table:

Table 2 - The HMD table structure.

MAX CHARACTER DUPLICATES


FIELD NAME DATA TYPE REQUIRED
FIELD LENGTH ALLOWED
Date
Date 10 Yes Yes
mm/dd/yyyy
Station Text 255 Yes Yes
HMD Double 28 Yes Yes

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

b. The Precipitation Table (PCP)


The following table summarises the structure of the PCP table:

Table 3 - The PCP table structure.

MAX CHARACTER DUPLICATES


FIELD NAME DATA TYPE REQUIRED
FIELD LENGTH ALLOWED
Date
Date 10 Yes Yes
mm/dd/yyyy
Station Text 255 Yes Yes
PCP Double 28 Yes Yes

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

c. The Solar Radiation Table (SLR)


The following table summarises the structure of the SLR table:

Table 4 - The SLR table structure.

MAX CHARACTER DUPLICATES


FIELD NAME DATA TYPE REQUIRED
FIELD LENGTH ALLOWED
Date
Date 10 Yes Yes
mm/dd/yyyy
Station Text 255 Yes Yes
SLR Double 28 Yes Yes

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

d. The Temperature Table (TMP)


The following table summarises the structure of the TMP table:

Table 5 - The TMP table structure.

MAX CHARACTER DUPLICATES


FIELD NAME DATA TYPE REQUIRED
FIELD LENGTH ALLOWED
Date
Date 10 Yes Yes
mm/dd/yyyy
Station Text 255 Yes Yes
TMPmax Double 28 Yes Yes
TMPmin Double 28 Yes Yes

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

e. The Wind Speed Table (WND)


The following table summarises the structure of the WND table:

Table 6 - The WND table structure.

MAX CHARACTER DUPLICATES


FIELD NAME DATA TYPE REQUIRED
FIELD LENGTH ALLOWED
Date
Date 10 Yes Yes
mm/dd/yyyy
Station Text 255 Yes Yes
WND Double 28 Yes Yes

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.

i. The Home window


The Home window is the main window of the SWAT Weather Database. Think of it as the main menu
of the application, which guides the user to access all the functionalities of the database. It should look
similar to Figure 1.

The Home window body has five buttons:

 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.

ii. The Manage Stations Database window


The Manage Stations Database window allows the user to import, edit, export and delete weather
stations data. On the body section, it displays a table with all the stations data, while the header section
display different possible actions, such as import, export and delete data. It looks like Figure 2.

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.

The Manage Stations Database window header has six buttons:

 The button exports the stored stations data as .xls file;


 The button exports the stored stations data as .xlsx file;
 The button exports the stored stations data as .csv file;
 The button imports external stations data from a .csv or .txt file;
 The button updates the stored stations data from an external .csv or .txt file;
 The button deletes all the stations data stored in the database.

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.

Figure 3 - The Manage Weather 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.

The Manage Weather Database window header has eight buttons:

 The button displays the selected weather data (view/edit);


 The button displays the selected weather data by station (view only). When pressed, a
new window will ask the user to inform the Station Name as a filter. If left blank, all stations
will be shown.
 The button exports the selected weather data as .xls file;
 The button exports the selected weather data as .xlsx file;
 The button exports the selected weather data as .csv file;
 The button imports external weather data from a .csv or .txt file;
 The button updates the stored weather data from an external .csv or .txt file;
 The button deletes all the selected weather data stored in the database.

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.

Figure 4 - The Write Weather Data to ArccSWAT Input Files window.

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.

v. The SWAT WGEN Statistics window


The SWAT WGEN Statistics window allows the user to calculate the WGEN statistics based on the
stored weather data and export it as an output file. The output format of such calculations is compatible with
the SWAT WGEN database format. It looks like Figure 5.

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.

Some considerations regarding the WGEN statistics calculation:

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.

Figure 6 - The Help window.

The Help window brings access to the following documentation:

 The SWAT Weather Database Manual (i.e. this document);


 The 2012 SWAT Input/Output Documentation;
 The 2009 SWAT Theoretical Documentation, and;
 The 2012 ArcSWAT User’s Guide.

14

You might also like