data-raw/model-parameters.R

library(tidyverse)

calibration_solution <- read_rds("calibration/calibration-results.rds")

x <- calibration_solution@solution[1,]

# 2019 Calibration Parameters ------------
params <- list(
  
  juveniles_at_chipps_model_weights = rep(1/3, 3),
  adults_in_ocean_model_weights = rep(1/3, 3),
  density_dependent_survival = .10,
  territory_size = c(0.0498944803729701, 0.138941944739835, 0.471083652829798, 0.471083652829798),
  prob_fry_leave = 0.25,
  
  # Data from DSMscenarios
  spawn_decay_rate = DSMscenario::spawn_decay_rate,
  rear_decay_rate = DSMscenario::rear_decay_rate,
  
  # Data from lateFallRunDSM cache-data (values vary by run)
  hatchery_allocation = lateFallRunDSM::hatchery_allocation,
  natural_adult_removal_rate = lateFallRunDSM::natural_adult_removal_rate,
  proportion_hatchery = lateFallRunDSM::proportion_hatchery,
  month_return_proportions = lateFallRunDSM::month_return_proportions,
  growth_rates = lateFallRunDSM::growth_rates_inchannel,
  growth_rates_floodplain = lateFallRunDSM::growth_rates_floodplain,
  mass_by_size_class = lateFallRunDSM::mass_by_size_class,
  cross_channel_stray_rate = lateFallRunDSM::cross_channel_stray_rate,
  stray_rate = lateFallRunDSM::stray_rate,
  adult_harvest_rate = lateFallRunDSM::adult_harvest_rate,
  diversity_group = lateFallRunDSM::diversity_group,
  
  ## Variable from DSM data packages
  # DSMflow variables -----
  freeport_flows = DSMflow::freeport_flow,
  vernalis_flows = DSMflow::vernalis_flow,
  stockton_flows = DSMflow::stockton_flow,
  CVP_exports = DSMflow::cvp_exports,
  SWP_exports = DSMflow::swp_exports,
  proportion_diverted = DSMflow::proportion_diverted,
  total_diverted = DSMflow::total_diverted,
  delta_proportion_diverted = DSMflow::delta_proportion_diverted,
  delta_total_diverted = DSMflow::delta_total_diverted,
  prop_pulse_flows = DSMflow::proportion_pulse_flows,
  prop_flow_natal = DSMflow::proportion_flow_natal,
  upper_sacramento_flows = DSMflow::upper_sacramento_flows,
  delta_inflow = DSMflow::delta_inflow,
  cc_gates_days_closed = DSMflow::delta_cross_channel_closed["count", ],
  cc_gates_prop_days_closed = DSMflow::delta_cross_channel_closed["proportion", ],
  proportion_flow_bypass = DSMflow::proportion_flow_bypasses,
  gates_overtopped = DSMflow::gates_overtopped,
  
  # DSMtemperature variables -----
  vernalis_temps = DSMtemperature::vernalis_temperature,
  prisoners_point_temps = DSMtemperature::prisoners_point_temperature,
  degree_days = DSMtemperature::degree_days,
  avg_temp = DSMtemperature::stream_temperature,
  avg_temp_delta = DSMtemperature::delta_temperature,
  migratory_temperature_proportion_over_20 = DSMtemperature::migratory_temperature_proportion_over_20,
  
  # DSMhabitat variables -----
  spawning_habitat = DSMhabitat::lfr_spawn,
  inchannel_habitat_fry = DSMhabitat::lfr_fry, # vary by run
  inchannel_habitat_juvenile = DSMhabitat::lfr_juv, # vary by run
  floodplain_habitat = DSMhabitat::lfr_fp, # vary by run
  weeks_flooded = DSMhabitat::weeks_flooded,
  delta_habitat = DSMhabitat::delta_habitat,
  sutter_habitat = DSMhabitat::sutter_habitat,
  yolo_habitat = DSMhabitat::yolo_habitat,
  tisdale_bypass_watershed = DSMhabitat::tisdale_bypass_watershed,
  yolo_bypass_watershed = DSMhabitat::yolo_bypass_watershed,
  south_delta_routed_watersheds = DSMhabitat::south_delta_routed_watersheds,
  prop_high_predation = DSMhabitat::prop_high_predation,
  contact_points = DSMhabitat::contact_points,
  delta_contact_points = DSMhabitat::delta_contact_points,
  delta_prop_high_predation = DSMhabitat::delta_prop_high_predation,
  prob_strand_early = DSMhabitat::prob_strand_early,
  prob_strand_late = DSMhabitat::prob_strand_late,
  prob_nest_scoured = DSMhabitat::prob_nest_scoured,
  
  # Spawn success variables
  spawn_success_sex_ratio = 0.5,
  spawn_success_redd_size = 9.29,
  spawn_success_fecundity = 5522,
  
  # Coefficients and calibrated intercepts for adult submodules
  # Stray 
  .adult_stray_intercept = 3,
  .adult_stray_wild = -5.5,
  .adult_stray_natal_flow = -1.99,
  .adult_stray_cross_channel_gates_closed = -0.174,
  .adult_stray_prop_bay_trans = 2.09,
  .adult_stray_prop_delta_trans = 2.89,
  # Enroute survival 
  .adult_en_route_migratory_temp = -0.26,
  .adult_en_route_bypass_overtopped = -0.019,
  .adult_en_route_adult_harvest_rate = lateFallRunDSM::adult_harvest_rate, # varies by run
  # Prespawn
  .adult_prespawn_deg_day = -0.000669526,
  
  # Routing coefficients and variables
  .pulse_movement_intercept = -7.70744,
  .pulse_movement_proportion_pulse = 0.26579,
  .pulse_movement_medium = 1.66845,
  .pulse_movement_large = 0.5706,
  .pulse_movement_vlarge = -4.305,
  .pulse_movement_medium_pulse = -0.25477,
  .pulse_movement_large_pulse = -0.44778,
  .pulse_movement_very_large_pulse = 0.329,
  
  # Egg to fry survival coefficients and calibrated intercept 
  .surv_egg_to_fry_int = 0.041,
  .surv_egg_to_fry_proportion_natural = 0.533,
  .surv_egg_to_fry_scour = -0.655,
  
  # Juvenile rearing survival calibrated intercept, coefficients, and variables
  .surv_juv_rear_contact_points = -0.189,
  .surv_juv_rear_prop_diversions = -3.51, # from literature
  .surv_juv_rear_total_diversions = -0.0021, # from literature
  .surv_juv_rear_avg_temp_thresh = -0.717,
  .surv_juv_rear_high_predation = -0.122,
  .surv_juv_rear_stranded = -1.939,
  .surv_juv_rear_medium = 1.48,
  .surv_juv_rear_large = 2.223,
  .surv_juv_rear_floodplain = 0.47,
  min_survival_rate = 0.0001,
  
  # Juvenile bypass survival coefficients and calibrated intercept 
  .surv_juv_bypass_avg_temp_thresh = -0.717,
  .surv_juv_bypass_high_predation = -0.122,
  .surv_juv_bypass_medium = 1.48,
  .surv_juv_bypass_large = 2.223,
  .surv_juv_bypass_floodplain = 0.47,
  
  # Juvenile delta survival coefficients and calibrated intercept
  .surv_juv_delta_contact_points = -0.189, # from literature
  .surv_juv_delta_total_diverted = -0.0021, # from literature
  .surv_juv_delta_avg_temp_thresh = -0.717,
  .surv_juv_delta_high_predation = -0.122,
  .surv_juv_delta_prop_diverted = -3.51,
  .surv_juv_delta_medium = 1.48,
  .surv_juv_delta_large = 2.223,
  
  # San joaquin outmigration coefficients and calibrated intercept 
  .surv_juv_outmigration_san_joaquin_medium = 1.48,
  .surv_juv_outmigration_san_joaquin_large = 2.223,
  
  # Ocean entry success calibrated intercept, coefficients, and variable
  .ocean_entry_success_length = c(-0.0897309864, -0.0709704348, -0.0208590732, 0.0732620916),
  .ocean_entry_success_months = 0.35,
  
  # calibrated values
  ..surv_adult_enroute_int = x[1],
  ..surv_adult_prespawn_int = x[2],
  ..surv_egg_to_fry_mean_egg_temp_effect =  x[3],
  ..surv_juv_rear_int = rep(x[4], 31),
  ..surv_juv_rear_contact_points = x[5],
  ..surv_juv_rear_prop_diversions = x[6],
  ..surv_juv_rear_total_diversions = x[7],
  ..surv_juv_bypass_int = x[8],
  ..surv_juv_delta_int = x[9],
  ..surv_juv_delta_contact_points = x[10],
  ..surv_juv_delta_total_diverted = x[11],
  ..surv_juv_outmigration_sj_int = x[12],
  ..ocean_entry_success_int = rep(x[13], 31)
  
)


usethis::use_data(params, overwrite = TRUE)
CVPIA-OSC/lateFallRunDSM documentation built on June 30, 2022, 10:04 p.m.