
Example kittiwake: step 2.1 - seabORD calibration - distance decay
E_KI_calib_decay.RmdIntroduction & background
A key component of the seabORD model is the need to calibrate the prey level inputs used for each new species and colony combination. This currently involves re-running the model without ORDs (baseline simulations) with a range of prey levels to ascertain the range of values within which the model returns adult mass and chick mortality rates consistent with pre-defined values representing “moderate” conditions (Figure 1). This is to allow simulation of the range of outcomes expected under these conditions, as the model is highly sensitive to the prey density parameter.

This example
In this example we will run 20 baseline runs (no wind farm footprints included) with a range of prey values and plot the outputs in attempt to capture “moderate” conditions for kittiwakes at Whinnyfold (Buchan Ness to Collieston Coast SPA) using a distance decay map created in step 1.1 (NOTE: parameters, e.g. colony size and body mass and breeding success relating to moderate conditions, may well not be suitable for this SPA, so make sure you specify your own before assessment).
Prepare inputs
The inputs for a calibration are largely the same as when running a full run except there are no ORDs included. We will first load in our parameter sets (Par, modPar, ordPar, switches), followed by the various spatial inputs used to set up the landscape and environment attributes.
Get the input parameters set-up example for the calibration exercise. For more information please see the “Example kittiwake: step 1 - seabORD inputs” article.
Parameters sets
Par
NOTE: “NScalefactor” is set to 0.1 meaning we are running with 10% of the population, which may be sufficient for calibration runs.
Par_example <- seabORD::get_example_par(type = "cal_dd")
str(Par_example)
#> List of 12
#> $ thisSpecies : chr "KI"
#> $ colonies : chr "UK9002491"
#> $ Nscalefactor : num 0.1
#> $ Prob_Displacement : num 0.6
#> $ Prob_Barrier : num 1
#> $ PreyType : chr "Uniform"
#> $ collision : chr "Off"
#> $ SiteSelectionMethod: chr "Map"
#> $ MaxDistancekm : num 0
#> $ PropInRange : num 0
#> $ Npairspercol : num 1350
#> $ Pmedian : num [1:20] 190 191 192 193 194 ...modPar
modPar_example <- seabORD::get_example_modpar(type = "cal_dd")
str(modPar_example)
#> List of 5
#> $ Nparallel : logi NA
#> $ initialseed: num 6598
#> $ reference : chr "serial_calibration_KI_UK9002491"
#> $ outputdir : chr "output_seabORD"
#> $ Nreplicates: num 20Create the output folder , for example “output_seabORD_calibration” and assign it
#set the output location in ModPar
# specifically for calibration outputs if it doesn't alreay exist
if (!dir.exists("output_seabORD_calibration")) {
dir.create("output_seabORD_calibration")
}
modPar_example$outputdir <- "output_seabORD_calibration"NOTE: Run this test! here is where our 20 replicates are specified - this must align with the number of prey values listed in “Par_example$Pmedian”
# Lets run a test to that effect:
seabORD::check_calibration_inputs(
Par = Par_example,
modPar = modPar_example
)
#> Calibration inputs valid: 20 replicate(s) and 20 prey value(s).ordPar
ordPar should be empty, as there doesn’t need to be as we are only running baseline runs with no ORDs included.
ordPar_example <- seabORD::get_example_ordPar("cal_dd")
str(ordPar_example)
#> list()Switches
Turn on the switch “savebirdflightmap”, to see an example of the birdflightmap output
#get the switches
switches_example <- seabORD::get_example_switches("cal_dd")
#turn on savebirdflightmap
switches_example$savebirdflightmap <- TRUE
str(switches_example)
#> List of 14
#> $ environment : chr "serial"
#> $ modelmode : chr "calibration"
#> $ debugmode : num 0
#> $ bycol : logi FALSE
#> $ bysus : logi FALSE
#> $ bych : logi FALSE
#> $ printdaily : logi FALSE
#> $ printseason : logi FALSE
#> $ printpair : logi FALSE
#> $ printfinal : logi FALSE
#> $ minout : logi FALSE
#> $ silent : logi FALSE
#> $ saverds : logi TRUE
#> $ savebirdflightmap: logi TRUEAssorted spatial inputs
Get the spatial input examples for the calibration exercise.
seamask
seamask_example <- seabORD::get_example_seamask()spadat1
spadat1_example <- seabORD::get_example_spadat1(type = "dd")
# Overwite with the exact colony location of Whinnyfold used when creating map in step 1.1
whinnyfold_lon <- -1.85849
whinnyfold_lat <- 57.388807
spadat1_example$Longitude <- whinnyfold_lon
spadat1_example$Latitude <- whinnyfold_lat
spadat1_example$flt.LONG <- whinnyfold_lon
spadat1_example$flt.LAT <- whinnyfold_latspadat2
spadat2_example <- seabORD::get_example_spadat2(type = "dd")spdat
spdat_example <- seabORD::get_example_spdat()BrdData
BrdData_example_dd <- seabORD::get_example_brddata_dd()
BrdData_example_dd <- seabORD::get_example_brddata(type = "dd")FrgCompData
FrgCompData_example_dd <- seabORD::get_example_frgcompdata(type = "dd")fltdist_base
fltdist_base_example <- seabORD::get_example_fltdist_base(type = "dd")FlightGridcorrection
FlightGridcorrection_example <- seabORD::get_example_fgc_3035()Set off calibration runs
Now that the inputs have been prepared by loading them into our environment we can set off the run using the following code. You can also use the example output.
Calculates (Slow):
SeabORDoutput <- seabORD::seabord(Par = Par_example,
ordPar = ordPar_example,
modPar = modPar_example,
switches = switches_example,
seamask = seamask_example,
spadat1 = spadat1_example,
spadat2 = spadat2_example,
spdat = spdat_example,
BrdData = BrdData_example_dd,
FrgCompData = FrgCompData_example_dd,
fltdist_base = fltdist_base_example,
FlightGridcorrection = FlightGridcorrection_example,
ORDpoly = ORDpoly_example
)
# Save SeabORDsummary
if (switches_example$saverds) {
saveRDS(SeabORDoutput, file.path(modPar_example$outputdir, paste0("sb_out_", gsub("\\.", "_", make.names(paste0(modPar_example$reference,"_", Sys.Date()))),".rds")))
}Load example calibration output (used throughout this vignette)
sbordout <- seabORD::get_example_output(type = "cal_dd")Plot the outputs and determine prey values
For this particular example we define moderate conditions for kittiwakes on the Isle of May against the two following outputs:
| Output | Moderate value | Upper bound (+10%) | Lower bound (-10%) |
|---|---|---|---|
| Adult mass loss | 10% | 11% | 9% |
| Chicks per nest | 50% | 55% | 45% |
Where adult mass loss is the average percentage mass loss of adults over the duration of the chick-rearing season being simulated, and chicks per nest is the average number of chicks surviving per nest. The aim of calibration is to find the shared prey values contained within the upper and lower bounds between each output.
seabORD::plot_BirdFlightMap(
sbordout$BirdFlightMap
)
You can see from this map that there is no evidence of and ORD interactions, which is reassuring!
Now we will plot the adult outputs (sbordout$output_a0) and the chick outputs (sbordout$output_c0) against the range of prey values across replicates to obtain our calibrated estimates to be used in the scenario runs going forward.
# Identify prey values that simultaneously satisfy
# the adult mass loss and productivity constraints
calibration <- seabORD::find_calibration_range(
sbordout,
masslower = 0.09,
massupper = 0.11,
prodlower = 0.45,
produpper = 0.55
)
#plot it
seabORD::plot_calibration_outputs(
sbordout,
calibration = calibration,
masslower = 0.09,
massupper = 0.11,
prodlower = 0.45,
produpper = 0.55
)