Closed lentinj closed 1 year ago
@bthe @willbutler42
What about an end_adj
parameter here, so the final year is end_year + end_adj
, and total steps for the model is length(step_lengths) * (end_year + end_adj - start_year + project_years) + final_year_steps - 1L
?
g3_retro
could then change this instead of project_years
(not that it really makes much difference, but is a bit more self-explanatory).
Hindcasting could be setting project_years = (# hindcast years)
and end_adj = 0 - project_years
. Then the total number of model steps will be the same, however cur_year_projection
will trigger early, causing whatever machinations using this to leap into life.
This looks fairly good to me but just to work this out. If the data ends in 2022 and I would like to do a 10 year forecast from the 5th retro peel. How would I go about setting that up? Should I set end_year = 2022
, end_adj = -5
and project_years = 10
?
Yup.
There, after a lot of unrelated faffing rewriting tests so they all set parameters properly, we now have a retro_years
option (not end_adj as I previously suggested. I didn't like the name and didn't like it only making sense when negative). Your previous example is now end_year = 2022
, retro_years = 5
and project_years = 10
.
I've made the corresponding commit to gadgetutils to use this instead of a negative project_years, which is now an error to save confusion between what the various parameters do.
Reawakening this issue. I have a bunch of time-varying parameters and want to do a projection so I ran:
params$retro_years <- 3
params$project_years <- 10
res <- r_model(params)
and I got the following error:
Error in nvl(param[[paste("ghl.bmt.l50", cur_year, sep = ".")]], stop("Out of range: ", : Out of range: ghl.bmt.l50
I assume that we need to make a distinction somewhere between projection parameters and other parameters.
I had this error before and Jamie pointed me in the direction of the ifmissing
parameter in g3_param_table
which says what to do when the table falls outside its bound
Also need a "start projecting early, but continue to end of model" option to allow hindcasting.