Python script for SWAT

1,435 views
Skip to first unread message

Chang Liao

unread,
Aug 21, 2018, 2:26:51 PM8/21/18
to SWAT-user
Hi, all
Earlier I have completed compiling SWAT under Linux/Mac:

Now I am trying to prepare some input files for SWAT simulation, later on maybe run, calibrate, postprocess as well.
So are there any useful scripts (Python, R, Matlab) I can use to do that?

Most tools I found online only support Windows. For example, QSWAT is Python based but it requires SWAT Editor, which again requires ArcSWAT (correct me if that is not true).

Thank you.

Jim Almendinger

unread,
Aug 21, 2018, 4:28:39 PM8/21/18
to changl...@gmail.com, SWAT-user
I believe that QSWAT does require SWAT Editor, which requires MS Access (I think), which in turn requires a Windows machine (or emulator).  
QSWAT does not require ArcSWAT; it is the alternative to ArcSWAT.  Both require a Windows machine, rather than a Mac.  
(I'm not a QSWAT expert, so perhaps I got some details wrong)
-- Jim

--
You received this message because you are subscribed to the Google Groups "SWAT-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to swatuser+u...@googlegroups.com.
To post to this group, send email to swat...@googlegroups.com.
Visit this group at https://groups.google.com/group/swatuser.
For more options, visit https://groups.google.com/d/optout.


--
Director, St. Croix Watershed Research Station

R Srinivasan

unread,
Aug 21, 2018, 4:39:54 PM8/21/18
to Jim Almendinger, changl...@gmail.com, SWAT-user
Jim,
You are correct in all what you said. There is no tool in unix that can write all SWAT input files, but there may be one in R.

However, as we are developing QSWAT+ for SWAT+, it will be compatible to Mac/PC/UNIX where ever QSWAT runs, since it will be based on SQLite database and no longer access, also it will be 64-bit no longer 32 bit that helps to remove the limitation of the database size.

Hope this helps.

Willem Vervoort

unread,
Aug 21, 2018, 7:20:00 PM8/21/18
to R. Srinivasan, Jim Almendinger, changl...@gmail.com, SWAT-user
Hi all,
check this thread on R:
My versions were based on the suggested earlier code:

R in agnostic in operating system

You should be able to convert these to Python,

It might be worth starting a github repos with files if someone wants to be the policeman and owner

Willem

Chang Liao

unread,
Sep 11, 2018, 6:50:00 PM9/11/18
to SWAT-user
Thanks for these comments.

Following up my question, I am working on a project which uses Python to automate most SWAT operations.
The project will use some output from ArcSWAT for once, then all the rest steps will be entirely in Python.

The calibration will be done using PEST/PEST++. 

At this stage, I will not promise much capability but it will provide the most core functions for a typical simulation, calibration and analysis.
I'd like hear more comments what components most of us are interested.

I plan not use any GUI except in the plot step.

Chang Liao

unread,
Nov 19, 2021, 5:29:19 PM11/19/21
to SWAT-user
Hi, modelers,

Here are some updates that you may be interested:
Following the path I took, I have drafted a rather straightforward way to conduct model simulation and calibration for SWAT.
With these python tools, you can carry out lots of operations completely within Python in Linux. Although you still need to build a base using ArcSWAT.

The pyswat takes care of swat input manipulations. You can replace many parameters for each hru, basin, etc. 
The pypest takes care of serial or parallel calibration using pest. I plan to add other optimization as well. 

They are not mature python packages yet but I used them for some projects.
I can provide limited support if needed. Any suggestions are also welcomed.

Thanks.

Chang Liao.
Reply all
Reply to author
Forward
0 new messages