How to save parameters of an iteration in SWAT-CUP

993 views
Skip to first unread message

pramod soni

unread,
Apr 15, 2017, 11:14:47 AM4/15/17
to SWAT-CUP
Hello friends,  
    I am trying to calibrate swat model using swat-cup for discharge in a basin. My problem is that, after  every iteration parameters in swat are changed based on last iteration. Is there any way to choose parameters which were used in any previous iteration?

Suppose after 10 iterations I find that model was better for iteration 7 and now I want to use iteration 7 parameters and re-run the calibration.

Any help is appreciated.

Abbaspour, Karim

unread,
Apr 16, 2017, 9:00:40 PM4/16/17
to swat...@googlegroups.com
Each time you should save the iteration, 
Then you can easily recover the parameters.
Karim
--
You received this message because you are subscribed to the Google Groups "SWAT-CUP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to swat-cup+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

pramod soni

unread,
Apr 17, 2017, 1:12:09 AM4/17/17
to SWAT-CUP
Dear Sir,
  Thank you for your rkind reply. I do save all the iterations. My doubt is  suppose I did 20 simulations. In different simulations different parameters have been calibrated. Out of these 20 simulations, 12th was best one. Now in 13th or 14th simulations, I added some parameters which made the results worse. I want to revert back to parameters of 12th simulations and start again with adding different parameters. Is it possible and how?

Thank you

Abbaspour, Karim

unread,
Apr 17, 2017, 2:41:07 AM4/17/17
to swat...@googlegroups.com

You are confusing simulations and iterations. SUFI-2 is an iterative procedure, where you do a few iterations (usually not more than 4-5). In each iteration you should do around 500-1000 simulations.

You can save the result of all iterations, where pertinent information is saved. You can copy the parameters from a previous par_inf file and start a new iteration.

 

What you should keep in mind is that the files in the working directory, have the very last simulation parameters in them. So, if you tried different parameters and now don’t want to keep their values, then you need to refresh the SWAT files from backup. You can use “restore from backup” command in the main menu.

 

Karim   

pramod soni

unread,
Apr 17, 2017, 2:57:03 AM4/17/17
to SWAT-CUP
Dear Sir,
     Thank you for your time in helping me in my problem. I understand that for every iteration there are number of simulations. After every set of simulations (one iteration), we are asked to save the iteration. I guess based on the objective functions chosen, SUFI-2 picks up best simulation and replaces the parameters in working directory. 

I think I am not able to explain my problem clearly. Kindly allow to to explain in a detailed manner.

1. I first select 10 parameters for calibration (A to J, all in replace format) and perform 200 simulations and save the results as iteration-1. {Parameters A to J have been altered and saved to SUFI-2 working project }

2. Now for second iteration I remove B and C and run the 200 simulations with remaining 8 parameters and save the results as iteration-2. 

3. In next step I add one more parameter K (replace format) and run the model for 200 simulations and save the iteration as  iteration-3.

After these 3 iterations all parameters between A to K have been altered.

Now if I choose parameters of iteration-2, (I can not get back default value of K which was altered in Iteration-3).

If  I restore from backup, and then use parameters if Iteration-2, (I can not get calibrated values of B and C which were updated earlier in Iteration-1 but not used for iteration-2).

Could you please provide me a solution to the above problem, since there could be many iterations involved and sometimes we may simply want to use all model parameters used in particular iteration and restart again from there.

Thank you

Abbaspour, Karim

unread,
Apr 17, 2017, 5:54:36 AM4/17/17
to swat...@googlegroups.com

Don’t just select any parameters, please follow the protocol below:

http://www.sciencedirect.com/science/article/pii/S0022169415001985

pramod soni

unread,
Apr 17, 2017, 5:59:19 AM4/17/17
to SWAT-CUP
Dear Sir,
     Thank you for your reply. Does that mean, there is no solution to it? One just has to be careful while selecting the parameters. If someone chooses some other parameter by mistake then it can not be undone? Is it true sir?

Thank you

Abbaspour, Karim

unread,
Apr 17, 2017, 6:02:20 AM4/17/17
to swat...@googlegroups.com

I don’t you what you are saying! Don’t make it complicated, just follow a logical path from the beginning.

Best, Karim

Brian Hall

unread,
Sep 20, 2017, 11:26:19 AM9/20/17
to SWAT-CUP
Could you please expand on the differences between "restore from backup" and reusing the pars (from par_inf.txt) from a saved iteration?
In an imaginary example, lets say that:

Iteration 1) I wanted to get baseline uncalibrated iteration, so in Par_inf.txt, I put "r_cn2.mgt   0   0" and did a single simulation

Iteration 2) I see that I need to decrease some peaks, so in Par_inf.txt, I put "r_cn2.mgt   -0.3   -0" and did ten simulations after altering SUFI2_swEdit.def

Iteration 3) I am happy with the relative CN2 set at -0.3 and increase the relative GW_REVAP.gw to decrease baseflows in the hydrograph.

Iteration 4) here is the question: so what if I wanted to rerun my baseline for some reason.  Can I just copy the Iteration 1 "Par_inf.txt" and paste it into the topmost Par_inf.txt and alter the SUFI2_swEdit.def file to 1 and 1... or do I have to do a "restore from backup"?

I am asking because I did some 500-simulation iterations and tried to reproduce a more successfull earlier one by copying the earilier successful one's "Par_inf.txt" file into the uppermost Par_inf.txt and got different results than my earlier one (with pars set at same settings).

Thank you very much,
Brian Hall

Brian Hall

unread,
Sep 20, 2017, 11:46:30 AM9/20/17
to SWAT-CUP
I guess the simple way to phrase my longer question below is:

If we want to go back to the parameters of an earlier iteration, can we just copy and paste the Par_inf.txt from that earlier iteration into the new iteration, or do we have to "restore from backup"?

-Brian Hall

Abbaspour, Karim

unread,
Sep 21, 2017, 5:40:36 AM9/21/17
to swat...@googlegroups.com

Restore from backup, copies all files from the Backup folder (original data set) into the working directory.

Import new parameters, copies the new parameters into par_inf file, to do a new iteration.

You can always copy parameters from an earlier iteration and run it again if necessary. These are not the same things

Brian Hall

unread,
Sep 21, 2017, 11:21:21 AM9/21/17
to SWAT-CUP
Thank you for your fast reply.  So if I want to do an earlier iteration and copy the parameters from that eariler version, do I still have to Restore from Backup befor running the new iterations?  Is there some files that were changed in the iteration in the very last iteration that would not be set back to default by copying and pasting the Par_inf.txt file into the working directory (ie the Par-inf.txt at the top of the table of contents)?

Sorry for my confusion on this,
Brian 

Abbaspour, Karim

unread,
Sep 21, 2017, 1:26:09 PM9/21/17
to swat...@googlegroups.com

Thank you for your fast reply.  So if I want to do an earlier iteration and copy the parameters from that eariler version, do I still have to Restore from Backup befor running the new iterations?  


Yes, unless you calibrated and fixed some parameters in some files. Don't override those files



Is there some files that were changed in the iteration in the very last iteration that would not be set back to default by copying and pasting the Par_inf.txt file into the working directory (ie the Par-inf.txt at the top of the table of contents)?


Its really not that confusing. If you want to keep some parameters, the don't replace them.

Jonathan

unread,
Aug 30, 2022, 10:39:10 PM8/30/22
to SWAT-CUP
Hello Sir,

I think I have the same inquiry now as you have back then. I experienced the same as you enumerated your situation. Like I first calibrated CN2. Then GWQMN. Then Sol_AWC. Then when I repeated calibrating GWQMN (just widened the range a bit), all the resulting stat parameters worsened. I tried to restore from backup files then directly calibrated GWQMN (instead of CN2 first) and received an entirely different set of resulting stat parameters. 

Am I right that if you want to replicate some iteration's results in the middle, you have to first alter all the parameters you have altered previously (like replicate what you did from the start)?

Regards,
Jonathan

Reply all
Reply to author
Forward
0 new messages