# NOT RUN {
# Load the 1970-1999 version of the North Sea model supplied with the package and generate a
# quick test data object with only 8 itereations and running the model for only 3 years.
# Also, the final parameter values are not saved back to the model Param folder.
# More realistic would be at least 500 iterations and running for 50 years.
# Even so this example will take a few minutes to run:
model<-e2e_read(model.name="North_Sea",
model.variant="1970-1999",
model.ident="test")
# This model is already optimized to the observed ecosystem data supplied with the package
# so we perturb the temperature driving to knock the model away from its maximum likelihood
# state relative to the target data and illustrate the performance of the process:
# add 3 degC to upper layer offshore temperatures:
model$data$physics.drivers$so_temp <- model$data$physics.drivers$so_temp+3
# add 3 degC to inshore temperatures:
model$data$physics.drivers$si_temp <- model$data$physics.drivers$si_temp+3
# add 3 degC to lower layer offshore temperatures:
model$data$physics.drivers$d_temp <- model$data$physics.drivers$d_temp+3
test_run <- e2e_optimize_hr(model, nyears=3, n_iter=8, start_temperature=0.4,
csv.output=FALSE)
# View the structure of the returned list:
str(test_run,max.level=1)
# View the structure of the returned list element containing parameter objects:
str(test_run$new_parameter_data,max.level=1)
# View the new, final accepted parameter data:
test_run$new_parameter_data
# }
# NOT RUN {
# --------------------------------------------------------------------------
# This is a dummy example to illustrate a realistic run in which optimised
# parameters are written back to the model Param folder. To try it out substitute
# your own relative folder path in place of \Folder in the e2e_copy() function...
# WARNING - this will take about 26 hours to run...
# Copy the 1970-1999 version of the North Sea model supplied with the package into a
# user workspace relative to the current working directory (../Folder):
# e2e_copy("North_Sea", "1970-1999",
# dest.path="Folder")
# Load the copied version of the North Sea/1970-1999 model from the user workspace
# and assign a path for results data:
# (REPLACE "Folder/Models" and "Folder/results" with your own paths before running)
# model<-e2e_read(model.name="North_Sea",
# model.variant="1970-1999",
# models.path="Folder/Models",
# results.path="Folder/results",
# model.ident="fittingrun")
# Launch the fitting process
# fitting_data <- e2e_optimize_hr(model, nyears=50, n_iter=500, start_temperature=1,
# csv.output=TRUE)
# --------------------------------------------------------------------------
# }
Run the code above in your browser using DataLab