Calibrator - Aqualinc/RGWSW GitHub Wiki
I want some code that works through calibration of the GDATools model automagically.
I need to calibrate for transmisivity first based on R squared,
then use the optimised transmisivity and: , if it is a discharge model, calibrate for the Groundwater Bypass quantity (effectively a bias correction) on the absolute value of the mean error
then with the optimised Transmisivity and Groundwater Bypass Quantity: , calibrate for the DischargeScaleFactor (effectively a scale factor) on the Nash Sutcliffe Efficincy (NSE) criteria
and output all the various goodness of fit measures, the optimised values and a plot.
Current situation
Currently the code works for the Takaka discharge cases with hard-coded aquifer properties.
I calibrate on transmissivity and soil storage time for each of the zones. This is done with a bousR2 function with a parameter "x" which is a vector of Transmisivity and all of the zone's vadose time constants. I optimised with the SCEoptim function from the "hydromad" package. Gave the transmisivity a 0 to 1 x 10^6 range, and the vadose days 0-5 limits. The Groundwater bypass is optimised using the optim function minimising the mean absolute error. The scale factor is optimised using the optim function, maximising the Nash Sutcliffe Efficiency criteria.
For a three aquifer, four zone system it takes about an hour to calibrate. I found that sometimes it failed, but re-running it would work. Assume this is related to particular parameter sets causing trouble. Caution was needed to ensure that the scale and offset for the initial calibration are set so that the discharge is not clipped to zero.
Tried calibration of Fishcreek, PupuMainSpring, and SpringCreek and returned a good result. Note that when putting the numbers into Julians model need to back-calculate T/(SL^2) and enter this in the parameters page.
Note: Potential to calibrate everything at once to maximise NSE. Perhaps worth trying to see what the time cost is on calibration.
Came un-stuck when trying to apply it to Toenepi as I don't have a recharge data set. For Takaka this was generated using Irricalc. Irricalc is an Aqualinc application written by John Bright that takes climate parameters and soil classes and crop types to determine groundwater recharge. The program needs to be installed with John's help. This needs to be done.
An alternative to Irricalc is using the soil moisture accounting Catchment Moisture Defecit (CMD) algorithm (Evans JP and Jakeman AJ 1998. Environmental Modelling & Software, 13, 385-393). Caroline converted this to R: sma_cmd.R (found in \aqualinc-sbs\data\Common Data\R_Scripts\RRtoolbox\sma_cmd.R) This module takes rainfall and evapotranspiration time series with four parameters and generates a quick flow and slow flow time series. The quick flow can be assumed to contribute directly to stream flow, while the slow flow contributes to groundwater recharge. The four parameters are rainfall and ET adjustment factors, a maximum drainage rate, and a maximum moisture deficit before drainage ceases. Caroline calibrates to these parameters whereas Irricalc estimates their equivalent from soil and crop properties. Looking at the sma_cmd.R file, it returns two er parameters. er is labelled "effective rainfall" in the header comments. Effective Rainfall is the sum of the change in soil moisture and actual evapotranspiration, i.e. the water that has been added that hasn't disappeared as runoff, however in this function it is the drainage and infiltration excess. The infiltration excess is the "quick" flow, the drainage is the "slow" flow. For purposes of groundwater recharge, the "slow" flow is taken as the recharge. I am not sure how this works out conceptually as it does not distinguish between groundwater recharge and lateral soil water flow.