Skip to contents

This is the main function to create the scenarios data frame. It calls the specific functions to create the crop, soil, climate and irrigation scenarios, and then merges them into a single data frame.

Usage

create_xxx_scenarios(
  verbose = TRUE,
  category,
  path = try(getDataPath("Inputs/Scenarios", sprintf("%s_scenarios.csv",
    tools::toTitleCase(category)), use_cache = FALSE, cfg = cfg), silent = TRUE),
  recreate = FALSE,
  tracc_scenarios = get_tracc_scenarios(with_variables = FALSE, cfg = cfg),
  write_results = cfg$data$write_results,
  ...,
  cfg = loadConfig()
)

Arguments

verbose

logical Whether to print logs to the console.

category

character The category of scenarios to create. Can be one or more of "crop", "climate", "soil", and "irrigation".

path

character Path to the scenarios file.

recreate

logical Whether to recreate the scenarios data frame even if it already exists. Default is FALSE.

tracc_scenarios

data.frame The TRACC scenarios data frame.

write_results

logical Whether to write the scenarios data frame to disk.

...

Additional arguments passed from the calling function.

cfg

a config object. Configuration to use. See loadConfig for details

Value

data.frame A data frame of crop/climate/soil/irrigation scenarios.

Details

Depending on the category argument, this is the columns description of the returned data frame:

  • crop

    • crop_id: The crop identifier.

  • climate

    • gcm_rcm: The GCM-RCM combination.

    • period: The climate period (ref, 2030, 2050, 2100).

    • ann_pcp_q: The annual precipitation quantile (0.2, 0.5, 0.8).

    • gcm: The GCM name.

    • rcm: The RCM name.

    • bc: The bias correction method.

    • rcp: The RCP scenario (rcp26, rcp45, rcp85).

  • soil

    • awco_class_index: The available water capacity class index (1, 2, 3).

    • theta_wp_class_index: The wilting point class index (1, 2, 3).

    • soil_depth: The soil depth (0.3, 0.6, 0.9, 1.2).

    • init_r_ratio: The initial soil water capacity ratio (1/3, 2/3, 1).

  • irrigation

    • rainfed: Whether the scenario is rainfed (TRUE/FALSE).

    • irr_rot_nday: The irrigation rotation days.

    • irr_rot_type: The irrigation rotation types.

    • p1_irr_dose: The phase 1 irrigation doses.

    • p2_irr_dose: The phase 2 irrigation doses.

    • p1_awca_ratio_irr_threshold: The phase 1 available water capacity ratio irrigation threshold.

    • p2_awca_ratio_irr_threshold: The phase 2 available water capacity ratio irrigation threshold.

    • crop_season_irr_quota: The crop season irrigation quota.

    • p1_forbidden_irr_nday_freq: The phase 1 forbidden irrigation days frequency.

    • p2_forbidden_irr_nday_freq: The phase 2 forbidden irrigation days frequency.