gadget-framework / gadget2

Gadget is the Globally applicable Area Disaggregated General Ecosystem Toolbox
GNU General Public License v2.0
18 stars 20 forks source link

error with timeVariable in SR #14

Closed vbartolino closed 7 years ago

vbartolino commented 7 years ago

The intention here is to include the effect of some external variable in the SR relationship. If I replace the parameter mu of the Ricker model in the spawnfile with a timeVariable like below I get the error: Error in timevariable - nothing specified for first timestep of the simulation

spawnfile:

spawnsteps            2
spawnareas        1
firstspawnyear        1991
lastspawnyear         2013
spawnstocksandratios  spratimm  1
proportionfunction    constant  1
mortalityfunction     constant  0
weightlossfunction    constant  0
recruitment       ricker    Modelfiles/sprat.mu   5.192e-10
stockparameters       7.7   0.9   4.363603e-05  2.611152

TimeVariable file:

spratmu ; time variable mu = multiplier * value
multiplier  4.003
timedata
; year  step    value
1991    1   16.25
1992    1   16.40
1993    1   14.99
1994    1   16.55
1995    1   16.43
...     ...     ...
jmbegley commented 7 years ago

Hi Valerio. What is the first year and step in the model? If the first timestep (as defined for the whole simulation) is not included in the timevariable file then you'll get that error. For example, if the first year and step for the simulation is 1990, step 1 then you can create a dummy entry in the timevariable file of

1990 1 0 ; dummy entry not used 1991 1 16.25 ; spawning first calculated on this step ...

vbartolino commented 7 years ago

Thanks James! This solves the issue :)