OSTRICH tool - BeginParameterCorrection block

35 views
Skip to first unread message

Karles Allesandro Pescoran Heredia

unread,
Sep 16, 2025, 2:31:19 PM (11 days ago) Sep 16
to Ostrich User Group
Dear all

I am studying SWAT model and performing calibration with OSTRICH. I was trying to include parameter constraints, but regardless of the order in which I write the BeginParameterCorrection block in the ostIn.txt file, it does not work.

To be clear, I do “not” receive any error messages; the OSTRICH routine runs normally. Simply, the BeginParameterCorrection block is not executed, nor is the correction.bat file that makes the changes executed. It is as if the BeginParameterCorrection block were not in the ostIn.txt file.

P.S.: I am attaching the .bat and .txt files.

Best regards,
Karles Pescoran
correction.txt
CorrectParams.R
correction.tpl
ostIn.txt
Ost-SWAT.txt

Robert Chlumsky

unread,
Sep 17, 2025, 8:49:40 AM (11 days ago) Sep 17
to Ostrich User Group
Hi Karles

I have not used the parameter correction functionality before, so I am not sure if the error is part of Ostrich or something in the setup.

Regardless, I might suggest an alternate approach that I know will work. It looks like your parameter correction is applied to ensure that some parameters are always <= others. For this I have used TiedParameters to ensure these relative relationships are preserved. This can be done for a pair of parameters by introducing a third parameter that is not in the model but represents the ratio of one parameter to another, which can be calibrated as part of the trial. The second parameter is then calculated as a tied parameter as a fraction of the first. 

For example, in one my model setups in the ostIn file, I have a setup to calibrate par_x49 and par_x56, where par_x56 is a multiplier I created that is not otherwise part of the model. I can then compute a tied parameter, par_prod_x49_x56 as the product of these two, ensuring that my desired relationship between par_x49 and par_prod_x49_x56 will be preserved by controlling the range of par_x56.

BeginTiedParams
  par_prod_x49_x56 2 par_x49 par_x56 linear 1.00 0.00 0.00 0.00 free
  # Compute SNOW_ICEPT_PCT as a product of RAIN_ICEPT_PCT
  # SNOW_ICEPT_PCT = par_prod_x49_x56 = par_x49 * par_x56 = RAIN_ICEPT_PCT * scalar[1,1.5]
  # Xtied =(c3 * X1 * X2) + (c2 * X2) + (c1 * X1) + c0, required syntax to translate
EndTiedParams  

Hope that helps and saves a bit of headache with connecting external scripts.

Cheers,
Rob

Karles Allesandro Pescoran Heredia

unread,
Sep 18, 2025, 12:59:43 AM (10 days ago) Sep 18
to Ostrich User Group
Hi, Rob.
Thanks for the idea, I'll give it a try. Just one question. I guess you've done this several times before, in your attempts, do the parameters reach convergence? Because in one iteration you can find a good value for the corrected parameter, but then it migth change because one of the two parameters is modified. 

Cheers,
Karles

Robert Chlumsky

unread,
Sep 18, 2025, 9:12:15 AM (10 days ago) Sep 18
to Karles Allesandro Pescoran Heredia, Ostrich User Group
Hi Karles

Yes this approach has worked well for me. The convergence depends partially on the algorithm of course, I often use DDS which samples fewer parameters as it proceeds so the likelihood of perturbing both parameters reduces. It's possible this approach won't work as well with other algorithms but I would try it out.

Cheers,
Rob

Robert Chlumsky, PhD, P.Eng. (he/him)
President, Heron Hydrologic Ltd.


La información contenida en este e-mail y sus anexos es confidencial, privilegiada y está dirigida exclusivamente a su destinatario, en consecuencia, solo puede ser utilizada por aquel. Si usted no es el destinatario original, no deberá examinar, usar, copiar o distribuir este mensaje o la información que contiene. Si lo recibe por error, por favor reenvíelo a la persona que se lo envió y elimínelo. Cualquier retención o uso total o parcial no autorizada de este mensaje está estrictamente prohibida y sancionada por ley.

--
You received this message because you are subscribed to a topic in the Google Groups "Ostrich User Group" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ostrich-user-group/9S9TmVrhkxQ/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ostrich-user-gr...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/ostrich-user-group/31b4e90b-6ba1-4c7a-a6e7-614dd558bdd5n%40googlegroups.com.
Message has been deleted
Message has been deleted

Karles Allesandro Pescoran Heredia

unread,
Sep 22, 2025, 8:26:42 PM (5 days ago) Sep 22
to Ostrich User Group
Great, thanks for the advise Robert

Bests,
Karles


Reply all
Reply to author
Forward
0 new messages