Integrate Modified SWAT Version in Action .

The basic processes to make the modified SWAT version work with SWAT Output Viewer has been covered in previous video. Many users wants to have a more detailed, step-by-step tutorial video so they could follow along to compile the viewer-compatible version themselves. So here it is.

Software Required

Source Tree to clone GitHub repository and merge changes.

Intel Fortran to compile the program.

Tortoise Git to resolve conflicts.

GitHub Repository


1. Clone swat_sqlite repository in SourceTree.

Modified SWAT - Clone Repository

2. Create branch based on tag SWAT_Rev664 or SWAT_Rev627. Select them based on your modified version.

Modified SWAT - Create Branch

3. Copy your modified code to the local directory selected in step 1. Overwrite all existing files.

4. Commit all changes.

Modified SWAT - Commit Change

5. Merge corresponding SQLite branch. For SWAT v627, select SWAT_SQLITE_Rev627.  For SWAT v664, select SWAT_SQLITE_Rev664.

Modified SWAT - Merge SQLite branch

6. Solve conflicts. Conflicts happens when same content is modified differently in two branch. You need to tell Git which version to use. There are various tools to help visually do that. The example here is using TortoiseGit.

Modified SWAT - Solve Conflicts 1

Modified SWAT - Solve Conflicts 2

7. Give an unique name to the result database in headout_sqlite.f.

Modified SWAT - Change Output File Name

8. Create Fortran project with Intel Fortran and add all Fortran source files.

Modified SWAT - Create Fortran Project

9. Create Static Library for SQLite and add sqlite3.c, sqlite3.h and csqlite.c.

Modified SWAT - Static Library for SQLite

Modified SWAT - Static Library for SQLite 2

10. Set dependency for Fortran project in Solution Property window.

Modified SWAT - Set Dependency

11. Setup Runtime library.

Modified SWAT - Setup Runtime Library Fortran

Modified SWAT - Setup Runtime Library C

12. Compile and put the exe file to the swat_exe folder.

13. As the viewer doesn’t automatically support the modified versions, please contact me to enable running it in viewer .

© 2000 – 2021 SWAT Output Viewer All rights reserved