HBV-EC Raven calibration

Ask questions or report problems
arghavan
Posts: 1
Joined: Fri Jul 19, 2019 11:06 pm

HBV-EC Raven calibration

Postby arghavan » Fri Jul 19, 2019 11:31 pm

Hi,
I developed the files for modeling my watershed by using Raven (HBV-EC). then I tried to calibrate my model by Ostrich. ( I used the files of DEMO-C1 (if you participate in principles of hydrologic modeling course) as the initial ostIn file and then changed it according to my own Raven files.
but surprisingly, by increasing the interation rate, the Nash does not increase! for instance, in interation 100, Nash is 0.073, while in interation 200, Nash is -0.079!
also, I used the starting model by negative Nash to be sure that Ostrich tries to maximize negative Nash.
I write the Ostln file to this question too.
(also, I used the files related to Nith watershed in class and change the input information for Raven).
Thanks.



ProgramType DDS
ObjectiveFunction GCOP
ModelExecutable Ost-RAVEN.bat
PreserveBestModel save_best.bat
#OstrichWarmStart yes

ModelSubdir processor_

BeginExtraDirs
model
#best
EndExtraDirs

BeginFilePairs
Sturgeon.rvp.tpl; Sturgeon.rvp
#can be multiple (.rvh, .rvi)
EndFilePairs

#Parameter/DV Specification
BeginParams
#parameter init. low high tx_in tx_ost tx_out
par_x1 random 0.0 10 none none none
par_x2 random 0.0 10 none none none
par_x3 random 0.0 10 none none none
EndParams

BeginResponseVars
#name filename keyword line col token
NS .\model\output\Sturgeon_Diagnostics.csv; OST_NULL 1 4 ','
EndResponseVars

BeginTiedRespVars
NegNS 1 NS wsum -1.00
EndTiedRespVars

BeginGCOP
CostFunction NegNS
PenaltyFunction APM
EndGCOP

BeginConstraints
# not needed when no constraints, but PenaltyFunction statement above is required
# name type penalty lwr upr resp.var
EndConstraints

# Randomsed control added
RandomSeed 123

#Algorithm should be last in this file:

BeginDDSAlg
PerturbationValue 0.20
MaxIterations 500
UseRandomParamValues
# UseInitialParamValues
# above intializes DDS to parameter values IN the initial model input files
EndDDSAlg

rchlumsk
Posts: 156
Joined: Fri Sep 16, 2016 3:18 pm

Re: HBV-EC Raven calibration

Postby rchlumsk » Mon Jul 22, 2019 1:02 pm

Hi there

Without your full setup it is hard to diagnose the issue exactly, but if the calibration is reducing your NSE from 0.073 to -0.079 then I suspect that the issue may lie in either providing the wrong parameter to Ostrich or some confusion in the negative use of the provided parameter. I would suggest a test with the Ostrich optimization with 3 trials and fixed parameter values just to ensure that the proper (static) calibration metric is being picked up from the Raven model first. The line in question is

Code: Select all

NS .\model\output\Sturgeon_Diagnostics.csv;   OST_NULL   1   4   ','

Please check that the parameter there is actually the NSE, based on the rvi file setup, and that you are not picking up a different diagnostic or a NULL one accidentally. If this does not solve the problem, please post back and we can discuss further.

Cheers,
Rob
Robert Chlumsky
rchlumsk@uwaterloo.ca

vahid.mehdipour
Posts: 5
Joined: Wed Feb 05, 2020 7:03 pm

Re: HBV-EC Raven calibration/Ostlin file with WSSE

Postby vahid.mehdipour » Wed Feb 05, 2020 7:22 pm

Hi,

I have developed a model with HBV-EC and now, according to the literature (https://doi.org/10.22230/jwsm.2018v1n3a6) I am looking for sensitivity analysis of parameters before the calibration. As far as I know, I have to build up an ostIn file using WSSE and Marquardt-Levenberg. I know how to build up an ostIn file using GCOP but not with the WSSE. Please share a sample. Ostrich manual is confusing for me.
If there are other means to get the most sensitive parameters, please let me know.

Thanks,Vahid

rchlumsk
Posts: 156
Joined: Fri Sep 16, 2016 3:18 pm

Re: HBV-EC Raven calibration

Postby rchlumsk » Thu Feb 06, 2020 4:50 pm

Hi Vahid

There are a lot of ways to do the sensitivity analysis. The sensitivity analysis is not a strict requirement to do calibration, so if you have an idea of which parameters are more or less important you can setup your calibration with those and skip the sensitivity step. But the sensitivity step does help to identify the more important parameters in order to reduce the number of parameters you need to consider in calibration, and is a helpful step.

A couple of thoughts on Ostrich:
1) Take a look at the CheckSensitivities option in Section 2.3 of the Ostrich Manual, setting this option to 'yes' will have Ostrich check the parameter sensitivities in a simpler way than you had mentioned. I would try to do this first in Ostrich.
2) If you want to follow the procedure in the paper, you will basically setup a calibration using the Gauss-Marquardt-Levenberg method and include parameter sensitivity in the run. Refer to sections 2.18.3 and, 2.3, and 2.21 in building the ostIn.txt file. The math and stats section will ask Ostrich to compute the Composite Scaled Sensitivities mentioned in the paper you linked, but it is not the only option. I believe the input file would look something like the one below.

Code: Select all

# section 2.3 in Ostrich manual
ProgramType  GML
ObjectiveFunction  WSSE

...

# section 2.18.3 in Ostrich manual
BeginLevMar
InitialLambda <init_lambda>
LambdaScaleFactor <lambda_sf>
MoveLimit <move_limit>
AlgorithmConvergenceValue <conv_val>
LambdaPhiRatio <phi_ratio>
LambdaRelReduction <rel_reduce>
MaxLambdas <max_lambda>
MaxIterations <max_iters>
EndLevMar

...

# section 2.21 in manual
BeginMathAndStats
Sensitivity CSS
EndMathAndStats


Hope that helps!
Rob
Robert Chlumsky
rchlumsk@uwaterloo.ca

Ameer
Posts: 19
Joined: Mon Nov 04, 2019 10:28 am

Re: HBV-EC Raven calibration

Postby Ameer » Tue Feb 11, 2020 9:51 am

Good morning,
My HBV-EC model on its own runs like a charm, however, I am getting error when linked with Ostrich for calibration. Here is the error from the OstErrors0.txt file. I see the error is pointing towards diagnostics file that has the objective function, i checked the address/file name and all looks good to me. Any thought to what may have went wrong?

Code: Select all

Ostrich Error Report for Processor 0
A total of 1 errors and/or warnings were reported
FILE I/O ERROR             : ValueExtractor::CTOR(): couldn't open |.\model\out\Rafferty_Diagnostics.csv|

Thanks,
Ameer

rchlumsk
Posts: 156
Joined: Fri Sep 16, 2016 3:18 pm

Re: HBV-EC Raven calibration

Postby rchlumsk » Tue Feb 11, 2020 11:56 am

Hi Ameer

Try to flip the slashes around, it may be as simple as that. My ostIn.txt file looks something like this and works.

Code: Select all

BeginResponseVars
#name   filename                        keyword      line   col   token   augmented?
  RMSE_1   ./output/Diagnostics.csv ;   OST_NULL   1      3   ','      yes
EndResponseVars


Let me know if that works.

Cheers,
Rob
Robert Chlumsky
rchlumsk@uwaterloo.ca

Ameer
Posts: 19
Joined: Mon Nov 04, 2019 10:28 am

Re: HBV-EC Raven calibration

Postby Ameer » Tue Feb 11, 2020 12:41 pm

Nope- changing the slashes didn't work. Here is my one

Code: Select all

BeginResponseVars
  #name     filename                 keyword      line   col   token
  NS      ./model/out/Rafferty_Diagnostics.csv;   OST_NULL   1   3   ','
EndResponseVars

rchlumsk
Posts: 156
Joined: Fri Sep 16, 2016 3:18 pm

Re: HBV-EC Raven calibration

Postby rchlumsk » Tue Feb 11, 2020 4:35 pm

Hi Ameer

If that was not the issue then it is likely a typo or a folder reference issue. That path will be relative to where ever ostIn.txt is stored so just check that and the spelling of the files. If you still don't find the issue, you can email me your setup and I can take a look as well.

Thanks,
Rob
Robert Chlumsky
rchlumsk@uwaterloo.ca

Ameer
Posts: 19
Joined: Mon Nov 04, 2019 10:28 am

Re: HBV-EC Raven calibration

Postby Ameer » Thu Feb 13, 2020 4:07 pm

rchlumsk wrote:Hi Ameer

If that was not the issue then it is likely a typo or a folder reference issue. That path will be relative to where ever ostIn.txt is stored so just check that and the spelling of the files. If you still don't find the issue, you can email me your setup and I can take a look as well.

Thanks,
Rob

Thanks Rob, the path was the issue and all looks good. I moved away from Windows to Linux. I compiled the source code of both Raven and Ostrich (the serial (GCC) as well as the parallel version (MPI)). The serial version is working fine, however, I am getting errors with the parallel version complaining about a headnote processing directory (Processes_o ) that it exists (see attached). Tried a bunch of different things but couldn't find a solution.
Ostrich_Error.png
You do not have the required permissions to view the files attached to this post.

julemai
Posts: 6
Joined: Tue Nov 29, 2016 10:14 am

Re: HBV-EC Raven calibration

Postby julemai » Fri Feb 14, 2020 9:49 am

Hi Ameer,

could you please have a look in all your sub-folders ("inputs", "ost", "scripts") that there is really no folder "processor_0" existing?!

Thanks,
Julie


Return to “Help & Support”