Skip to contents

Workflow

gaia is designed with a climate-driven empirical model at its core, integrated into an efficient modular structure. This architecture streamlines the entire workflow. This workflow includes raw climate and crop data processing, empirical model fitting, yield shock projections under future climate scenarios, and agricultural productivity change calculation for GCAM. The modular design also facilitates comprehensive diagnostic outputs, enhancing the tool’s utility for researchers and policymakers.

The primary functionality of gaia is encapsulated in the yield_impact wrapper function, which executes the entire workflow from climate data processing to yield shock estimation. Users can also execute individual functions to work through the main steps of the process (Figure 1).

  1. weighted_climate: Processes CMIP-ISIMIP climate NetCDF data and calculates cropland-weighted precipitation and temperature at the country level, differentiated by crop type and irrigation type. The function accepts both daily or monthly climate data that are consistent with the CMIP-ISIMIP NetCDF data format.

  2. crop_calendars: Generates crop planting months for each country and crop based on crop calendar data Sacks et al., (2020).

  3. data_aggregation: Calculates crop growing seasons using climate variables processed by weighted_climate and crop calendars for both historical and projected periods. This function prepares climate and yield data for subsequent model fitting.

  4. yield_regression: Performs regression analysis fitted with historical annual crop yields, monthly growing season temperature and precipitation, CO2 concentrations, GDP per capita, and year. The default econometric model applied in gaia is from Waldhoff et al., (2020). User can specify alternative formulas that are consistent with the data processed in data_aggregation.

  5. yield_shock_projection: Projects yield shocks for future climate scenarios using the fitted model and temperature, precipitation, and CO2 projections from the climate scenario.

  6. gcam_agprodchange: Remaps country-level yield shocks to GCAM-required spatial scales (e.g., region, basin, and intersections), based on harvested areas, and aggregates crops to GCAM commodities. This function applies the projected shocks to GCAM scenario agricultural productivity growth rates (the unit used to project future yields in GCAM) and creates ready-to-use XML outputs for GCAM.


Figure 1: The gaia workflow showing the functions and the corresponding outputs of modeling crop yield shocks to climate variations using empirical econometric model.


Example Climate Data

gaia requires global climate data from the Inter-Sectoral Impact Model Intercomparison Project (ISIMIP) or data formatted similarly to ISIMIP data. Additionally, gaia supports climate data aggregated to a monthly time step. Due to the large size of daily time step climate data, we have provided an example of monthly aggregated climate data covering the period from 2015 to 2100.


Example Data 1

Download the example data using the instructions below. This dataset includes both historical climate observations and future climate projections, already weighted by cropland areas and provided in .txt format. The cropland-area-weighted, country-level climate data contains monthly precipitation and temperature for 26 crop types, distinguishing between irrigated and rainfed areas.

# load gaia
library(gaia)

# Path to the output folder. Change it to your desired location
output_dir <- file.path(getwd(), 'gaia_output')

# Cropland-weighted historical and future climate data
data_dir <- gaia::get_example_data(
  download_url = 'https://zenodo.org/records/13976521/files/weighted_climate.zip?download=1',
  data_dir = output_dir
)

# Path to the folder that holds cropland-area-weighted precipitation and temperature TXT files
# historical climate observation
climate_hist_dir <- file.path(data_dir, 'climate_hist')
# future projected climate
climate_impact_dir <- file.path(data_dir, 'canesm5')


NOTE! We recommend using the default historical climate data provided in example data 1, as it is based on WATCH climate observations (Weedon et al., (2011)). If you do not plan to adjust any assumptions for empirical model fitting, you can opt to use the default regression model, pre-fitted with the WATCH historical climate data, by setting the argument use_default_coeff = TRUE. After loading the gaia package, type coef_default to view the parameters of the default fitted model..


Example Data 2

To use a different climate model or scenario, you can provide your own climate data in NetCDF format. Note that gaia adheres to the ISIMIP climate data format as its standard, so your NetCDF files should be formatted accordingly. You can download our example monthly precipitation and temperature NetCDF files using the code below.

# load gaia
library(gaia)

# Path to the output folder. Change it to your desired location
output_dir <- file.path(getwd(), 'gaia_output')

# Future Climate Data
data_dir <- gaia::get_example_data(
  download_url = 'https://zenodo.org/records/13976521/files/gaia_example_climate.zip?download=1',
  data_dir = output_dir
)

# Path to the precipitation and temperature NetCDF files
# NOTE: Each variable can have more than one file
# projected climate data
pr_projection_file <- file.path(data_dir, 'pr_monthly_canesm5_w5e5_gcam-ref_2015_2100.nc')
tas_projection_file <- file.path(data_dir, 'tas_monthly_canesm5_w5e5_gcam-ref_2015_2100.nc')


Run gaia!

Example 1

Warning!

This example demonstrates the complete gaia model workflow, including processing the raw climate NetCDF data. Due to the large size of the climate dataset, this process may take up to an hour. For a quicker demonstration, please refer to Example 2.

This example uses both example data 1 and example data 2. You can run gaia using the single function yield_impact, which streamlines the entire workflow. For detailed explanations of each argument in yield_impact, please refer to the reference page.

# load gaia
library(gaia)

# Path to the output folder. Change it to your desired location
output_dir <- file.path(getwd(), 'gaia_output')

# Run gaia
# The full run with raw climate data can take up to an hour
gaia::yield_impact(
  pr_hist_ncdf = NULL,                    # path to historical precipitation NetCDF file (must follow ISIMIP format); only if you wish to use your own historical precipitation observation
  tas_hist_ncdf = NULL,                   # path to historical temperature NetCDF file (must follow ISIMIP format); only if you wish to use your own historical temperature observation
  pr_proj_ncdf = pr_projection_file,      # path to future projected precipitation NetCDF file (must follow ISIMIP format)
  tas_proj_ncdf = tas_projection_file,    # path to future projected temperature NetCDF file (must follow ISIMIP format)
  timestep = 'monthly',                   # specify the time step of the NetCDF data (monthly or daily)
  climate_hist_dir = climate_hist_dir,    # path to the folder that holds cropland weighted historical climate observations
  historical_periods = c(1960:2001),      # vector of historical years selected for fitting
  climate_model = 'canesm5',              # label of climate model name
  climate_scenario = 'gcam-ref',          # label of climate scenario name
  member = 'r1i1p1f1',                    # label of ensemble member name
  bias_adj = 'w5e5',                      # label of climate data for bias adjustment for the global climate model (GCM)
  cfe = 'no-cfe',                         # label of CO2 fertilization effect in the formula (default is no CFE)
  gcam_version = 'gcam7',                 # output is different depending on the GCAM version (gcam6 or gcam7)
  use_default_coeff = FALSE,              # set to TRUE when there is no historical climate data available
  base_year = 2015                        # GCAM base year
  start_year = 2015,                      # start year of the projected climate data
  end_year = 2100,                        # end year of the projected climate data
  smooth_window = 20,                     # number of years as smoothing window
  co2_hist = NULL,                        # historical annual CO2 concentration. If NULL, will use default value
  co2_proj = NULL,                        # projected annual CO2 concentration. If NULL, will use default value
  diagnostics = TRUE,                     # set to TRUE to output diagnostic plots
  output_dir = output_dir                 # path to the output folder
)

NOTE! The arguments climate_model, climate_scenario, member, bias_adj, and cfe require specific strings that provide climate model metadata in the output files. These arguments do not impact the gaia model simulation itself; they are only used to populate climate data metadata in the outputs.


Example 2

This example only uses the example of weighted climate data as described in example data 2, which has been processed with cropland weights at the country level. This weighted climate data was generated using gaia::weighted_climate. This example serves as a guide to help users format their own data to match the weighted climate data structure if their raw climate data differs from the ISIMIP format. Running gaia directly with weighted climate data requires only a few minutes.

# load gaia
library(gaia)

# Path to the output folder. Change it to your desired location
output_dir <- file.path(getwd(), 'gaia_output')

# Run gaia
gaia::yield_impact(
  climate_hist_dir = climate_hist_dir,    # path to the folder that holds cropland weighted historical climate observations
  climate_impact_dir = climate_impact_dir,# path to the folder that holds cropland weighted projected climate
  timestep = 'monthly',                   # specify the time step of the NetCDF data (monthly or daily)
  climate_model = 'canesm5',              # label of climate model name
  climate_scenario = 'gcam-ref',          # label of climate scenario name
  member = 'r1i1p1f1',                    # label of ensemble member name
  bias_adj = 'w5e5',                      # label of climate data for bias adjustment
  cfe = 'no-cfe',                         # label of CO2 fertilization effect in the formula (default is no CFE)
  gcam_version = 'gcam7',                 # output is different depending on the GCAM version (gcam6 or gcam7)
  use_default_coeff = FALSE,              # set to TRUE when there is no historical climate data available
  base_year = 2015,                       # GCAM base year
  start_year = 2015,                      # start year of the projected climate data
  end_year = 2100,                        # end year of the projected climate data
  smooth_window = 20,                     # number of years as smoothing window
  co2_hist = NULL,                        # historical annual CO2 concentration. If NULL, will use default value
  co2_proj = NULL,                        # projected annual CO2 concentration. If NULL, will use default value
  diagnostics = TRUE,                     # set to TRUE to output diagnostic plots
  output_dir = output_dir                 # path to the output folder
)

Explore the results in your output folder. For a detailed explanation of the output, checkout Example 3!


Example 3

As the gaia model runs, intermediate outputs will be generated and saved to the user-specified output folder. For testing purposes, if you follow Example 2 as outlined above without modifying any input data or arguments, you can expect to see the following key results. Below, we provide additional instructions on using each function described in the Workflow section and explain the associated example outputs.


weighted_climate


Once you have downloaded example data 1 to your desired location, you can use the weighted_climate function to calculate the cropland-weighted monthly precipitation and temperature for the projected climate. Please note that this step may take up to an hour to complete.

library(gaia)

# Path to the output folder where you wish to save the outputs. Change it accordingly
output_dir <- file.path(getwd(), 'gaia_output')

# calculate weigted climate
weighted_climate(pr_ncdf = pr_projection_file ,
                 tas_ncdf = tas_projection_file ,
                 timestep = 'monthly',
                 climate_model = 'canesm5',
                 climate_scenario = 'gcam-ref',
                 time_periods = seq(2015, 2100, 1),
                 output_dir = output_dir,
                 name_append = NULL)

This will create a folder based on the specified climate_model argument (e.g., output_dir/weighted_climate/canesm5). Inside this folder, you will find files containing precipitation and temperature data weighted by the irrigated and rainfed cropland areas for 26 MIRCA crops. The file structure is organized in columns as follows: [year, month, 1, 2, 3, ..., 265], where the numbers correspond to country IDs. To view the country names associated with these IDs, simply type gaia::country_id in the R console after loading the gaia package. Below is an example of the structure for the weighted precipitation data for rainfed soybean (output_dir/weighted_climate/canesm5/anesm5_gcam-ref_month_precip_country_rfc_crop08_2015_2100.txt).

## Error in get(paste0(generic, ".", class), envir = get_method_env()) : 
##   object 'type_sum.accel' not found
Table 1. Soybean-area-weighted precipitation from the weighted_climate function.
year month 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265
2015 1 -9999 6.49 53.48 49.14 -9999 54.15 93.11 -9999 -9999 -9999 76.99 20.35 40.77 -9999 79.06 62.98 20.78 -9999 -9999 -9999 -9999 11.02 -9999 63.19 -9999 89.59 0.25 -9999 22.57 117.14 -9999 63.04 77.41 -9999 166.14 -9999 -9999 17.54 0.03 3.03 57.71 0.37 2.15 150.80 -9999 -9999 6.52 0.13 3.12 7.73 -9999 -9999 -9999 17.29 -9999 75.87 115.34 -9999 -9999 94.45 77.29 -9999 -9999 -9999 49.48 1.97 136.74 16.82 -9999 -9999 181.48 6.05 33.99 180.31 29.20 76.55 53.88 -9999 -9999 -9999 -9999 -9999 50.44 81.47 -9999 -9999 -9999 197.25 -9999 -9999 47.75 47.29 2.00 -9999 -9999 42.87 -9999 -9999 -9999 -9999 33.18 -9999 0.47 -9999 61.26 -9999 -9999 95.09 0.11 -9999 50.32 -9999 2.77 284.82 23.04 24.06 -9999 -9999 16.18 55.43 -9999 129.33 -9999 -9999 -9999 8.56 -9999 20.43 70.29 -9999 -9999 -9999 11.75 1.50 53.44 30.20 72.39 3.19 -9999 -9999 50.10 -9999 1.33 20.00 325.07 181.61 71.04 -9999 0.09 -9999 -9999 -9999 -9999 -9999 -9999 7.98 -9999 11.79 -9999 1.54 -9999 -9999 74.39 177.16 0.13 -9999 -9999 34.32 -9999 -9999 -9999 118.04 0.08 2.69 -9999 -9999 21.08 -9999 -9999 -9999 7.85 -9999 -9999 -9999 16.46 -9999 57.32 106.92 255.06 -9999 36.17 -9999 -9999 -9999 -9999 -9999 33.58 41.92 -9999 -9999 -9999 -9999 -9999 -9999 -9999 -9999 -9999 -9999 -9999 -9999 -9999 -9999 -9999 -9999 -9999 48.66 75.23 -9999 3.81 107.75 -9999 66.90 -9999 -9999 37.74 11.81 176.95 -9999 -9999 -9999 129.63 17.21 2.59 37.34 128.07 0.26 219.38 -9999 -9999 -9999 94.92 -9999 -9999 27.69 -9999 -9999 -9999 55.33 20.96 -9999 -9999 102.45 97.20 -9999 -9999 32.49 4.08 -9999 -9999 -9999 -9999 -9999 168.30 86.62 -9999
2015 2 -9999 30.41 8.91 3.78 -9999 9.01 231.87 -9999 -9999 -9999 92.16 53.70 5.37 -9999 57.36 10.30 52.14 -9999 -9999 -9999 -9999 13.03 -9999 33.06 -9999 69.36 5.59 -9999 0.98 197.79 -9999 4.41 4.83 -9999 220.05 -9999 -9999 14.17 0.31 11.54 82.93 4.42 10.48 87.01 -9999 -9999 5.75 -9999.00 7.12 17.88 -9999 -9999 -9999 56.89 -9999 229.73 200.63 -9999 -9999 23.22 2.16 -9999 -9999 -9999 18.48 7.22 69.84 12.10 -9999 -9999 292.88 25.45 34.55 346.70 19.66 44.34 29.91 -9999 -9999 -9999 -9999 -9999 22.42 7.72 -9999 -9999 -9999 550.00 -9999 -9999 79.74 23.53 10.17 -9999 -9999 61.48 -9999 -9999 -9999 -9999 28.05 -9999 3.56 -9999 78.72 -9999 -9999 94.81 19.56 -9999 5.59 -9999 0.08 275.20 38.65 62.77 -9999 -9999 56.22 0.51 -9999 144.31 -9999 -9999 -9999 21.65 -9999 22.08 143.45 -9999 -9999 -9999 35.97 9.91 36.29 65.92 50.82 12.01 -9999 -9999 28.44 -9999 10.56 6.26 198.64 170.30 111.63 -9999 0.03 -9999 -9999 -9999 -9999 -9999 -9999 11.89 -9999 4.87 -9999 1.38 -9999 -9999 3.86 47.89 2.37 -9999 -9999 5.58 -9999 -9999 -9999 62.62 0.08 9.48 -9999 -9999 17.87 -9999 -9999 -9999 20.32 -9999 -9999 -9999 9.54 -9999 293.98 87.49 344.87 -9999 20.76 -9999 -9999 -9999 -9999 -9999 33.45 79.03 -9999 -9999 -9999 -9999 -9999 -9999 -9999 -9999 -9999 -9999 -9999 -9999 -9999 -9999 -9999 -9999 -9999 17.67 4.22 -9999 6.99 20.70 -9999 75.88 -9999 -9999 111.26 32.49 177.82 -9999 -9999 -9999 5.37 55.30 61.85 91.50 183.13 4.86 140.38 -9999 -9999 -9999 62.97 -9999 -9999 124.53 -9999 -9999 -9999 125.10 16.45 -9999 -9999 50.57 111.90 -9999 -9999 13.09 14.92 -9999 -9999 -9999 -9999 -9999 101.86 17.83 -9999
2015 3 -9999 3.93 48.34 21.77 -9999 25.94 91.85 -9999 -9999 -9999 73.31 19.71 9.08 -9999 94.52 39.98 16.60 -9999 -9999 -9999 -9999 135.66 -9999 33.38 -9999 66.68 14.48 -9999 176.60 124.19 -9999 55.18 24.74 -9999 118.04 -9999 -9999 45.17 0.22 26.96 80.59 41.72 32.41 67.80 -9999 -9999 74.23 -9999.00 2.10 27.10 -9999 -9999 -9999 95.78 -9999 103.92 107.08 -9999 -9999 5.61 49.68 -9999 -9999 -9999 38.40 85.90 80.86 0.08 -9999 -9999 211.38 8.95 34.85 254.78 0.66 25.08 2.68 -9999 -9999 -9999 -9999 -9999 18.87 60.03 -9999 -9999 -9999 322.15 -9999 -9999 35.23 62.85 46.38 -9999 -9999 49.80 -9999 -9999 -9999 -9999 38.22 -9999 74.27 -9999 15.92 -9999 -9999 70.07 46.44 -9999 36.65 -9999 1.54 280.88 13.52 46.58 -9999 -9999 27.68 25.57 -9999 102.58 -9999 -9999 -9999 11.04 -9999 18.16 118.73 -9999 -9999 -9999 27.04 24.00 17.25 38.58 46.57 92.55 -9999 -9999 20.95 -9999 15.69 23.05 241.56 108.53 237.30 -9999 0.05 -9999 -9999 -9999 -9999 -9999 -9999 2.84 -9999 17.44 -9999 4.23 -9999 -9999 22.98 53.60 12.06 -9999 -9999 55.84 -9999 -9999 -9999 27.79 0.08 28.07 -9999 -9999 36.94 -9999 -9999 -9999 4.17 -9999 -9999 -9999 21.25 -9999 101.03 101.79 267.56 -9999 21.80 -9999 -9999 -9999 -9999 -9999 29.08 56.85 -9999 -9999 -9999 -9999 -9999 -9999 -9999 -9999 -9999 -9999 -9999 -9999 -9999 -9999 -9999 -9999 -9999 38.64 52.05 -9999 0.04 46.38 -9999 97.43 -9999 -9999 206.29 16.32 104.16 -9999 -9999 -9999 112.89 40.00 50.59 64.15 167.43 11.41 176.53 -9999 -9999 -9999 16.27 -9999 -9999 97.41 -9999 -9999 -9999 93.03 26.51 -9999 -9999 82.77 118.53 -9999 -9999 14.18 54.60 -9999 -9999 -9999 -9999 -9999 102.56 33.89 -9999
2015 4 -9999 1.50 44.38 14.86 -9999 23.55 244.90 -9999 -9999 -9999 45.70 24.52 7.51 -9999 30.20 17.90 15.43 -9999 -9999 -9999 -9999 327.43 -9999 44.39 -9999 133.12 50.79 -9999 363.37 113.79 -9999 33.54 20.82 -9999 82.18 -9999 -9999 49.03 15.40 108.84 114.57 55.26 88.19 54.10 -9999 -9999 104.93 1.07 0.89 56.10 -9999 -9999 -9999 109.45 -9999 128.66 211.58 -9999 -9999 28.85 13.82 -9999 -9999 -9999 41.27 120.70 38.33 0.21 -9999 -9999 118.87 6.56 67.77 313.33 1.46 15.73 14.27 -9999 -9999 -9999 -9999 -9999 10.64 35.37 -9999 -9999 -9999 300.55 -9999 -9999 42.25 39.82 58.17 -9999 -9999 63.44 -9999 -9999 -9999 -9999 57.24 -9999 149.08 -9999 29.14 -9999 -9999 237.77 150.72 -9999 29.88 -9999 2.07 209.95 14.55 54.13 -9999 -9999 14.03 14.76 -9999 144.03 -9999 -9999 -9999 6.78 -9999 23.51 185.21 -9999 -9999 -9999 17.52 193.76 14.17 29.68 106.76 160.17 -9999 -9999 13.66 -9999 81.39 16.03 105.71 71.19 216.92 -9999 8.53 -9999 -9999 -9999 -9999 -9999 -9999 0.10 -9999 17.74 -9999 9.88 -9999 -9999 33.32 22.95 37.43 -9999 -9999 148.79 -9999 -9999 -9999 124.01 0.75 78.13 -9999 -9999 48.24 -9999 -9999 -9999 1.72 -9999 -9999 -9999 25.20 -9999 130.86 105.63 82.10 -9999 23.37 -9999 -9999 -9999 -9999 -9999 39.78 97.05 -9999 -9999 -9999 -9999 -9999 -9999 -9999 -9999 -9999 -9999 -9999 -9999 -9999 -9999 -9999 -9999 -9999 41.52 16.49 -9999 0.12 85.58 -9999 160.91 -9999 -9999 75.16 108.04 63.79 -9999 -9999 -9999 53.02 41.26 120.54 33.50 115.39 165.10 178.29 -9999 -9999 -9999 25.50 -9999 -9999 118.14 -9999 -9999 -9999 180.97 38.53 -9999 -9999 65.40 80.64 -9999 -9999 25.39 143.12 -9999 -9999 -9999 -9999 -9999 46.47 6.89 -9999
2015 5 -9999 1.00 42.54 9.60 -9999 35.29 21.89 -9999 -9999 -9999 25.63 46.34 35.32 -9999 20.92 69.80 30.46 -9999 -9999 -9999 -9999 372.70 -9999 46.52 -9999 64.89 111.74 -9999 363.37 16.58 -9999 74.97 3.17 -9999 43.44 -9999 -9999 29.32 29.68 159.61 115.83 130.54 122.46 128.53 -9999 -9999 219.04 11.84 -9999.00 71.13 -9999 -9999 -9999 263.29 -9999 209.88 53.50 -9999 -9999 152.37 69.07 -9999 -9999 -9999 49.95 163.57 97.06 18.27 -9999 -9999 88.78 0.41 121.05 240.85 7.72 48.76 50.09 -9999 -9999 -9999 -9999 -9999 38.82 79.04 -9999 -9999 -9999 199.49 -9999 -9999 40.81 68.88 132.68 -9999 -9999 27.64 -9999 -9999 -9999 -9999 109.31 -9999 208.63 -9999 179.98 -9999 -9999 93.67 136.28 -9999 107.96 -9999 7.73 198.90 9.33 21.02 -9999 -9999 2.47 84.36 -9999 134.05 -9999 -9999 -9999 1.27 -9999 10.49 190.78 -9999 -9999 -9999 25.36 186.99 40.14 2.86 4.94 321.55 -9999 -9999 26.52 -9999 60.64 26.58 112.07 4.18 135.64 -9999 24.52 -9999 -9999 -9999 -9999 -9999 -9999 1.21 -9999 14.85 -9999 12.90 -9999 -9999 9.02 5.27 0.50 -9999 -9999 214.40 -9999 -9999 -9999 116.91 14.29 125.58 -9999 -9999 134.35 -9999 -9999 -9999 3.57 -9999 -9999 -9999 110.80 -9999 100.00 36.91 225.72 -9999 32.41 -9999 -9999 -9999 -9999 -9999 38.78 141.63 -9999 -9999 -9999 -9999 -9999 -9999 -9999 -9999 -9999 -9999 -9999 -9999 -9999 -9999 -9999 -9999 -9999 64.10 110.17 -9999 41.83 9.48 -9999 196.79 -9999 -9999 136.68 133.25 448.10 -9999 -9999 -9999 168.21 11.61 64.06 28.30 53.48 190.77 257.67 -9999 -9999 -9999 107.09 -9999 -9999 33.21 -9999 -9999 -9999 208.63 18.99 -9999 -9999 120.63 107.58 -9999 -9999 173.95 160.52 -9999 -9999 -9999 -9999 -9999 0.45 1.15 -9999
2015 6 -9999 4.13 69.80 2.75 -9999 7.10 17.49 -9999 -9999 -9999 14.12 22.80 10.47 -9999 136.45 93.56 8.97 -9999 -9999 -9999 -9999 546.80 -9999 73.68 -9999 219.43 271.11 -9999 545.22 53.24 -9999 94.84 0.65 -9999 55.70 -9999 -9999 95.81 184.62 162.74 2.72 96.42 169.98 52.69 -9999 -9999 157.08 79.99 -9999.00 97.69 -9999 -9999 -9999 238.34 -9999 16.06 21.23 -9999 -9999 368.82 95.78 -9999 -9999 -9999 51.36 196.97 100.18 15.66 -9999 -9999 24.78 0.07 244.32 237.93 34.98 52.83 91.85 -9999 -9999 -9999 -9999 -9999 27.30 35.88 -9999 -9999 -9999 69.81 -9999 -9999 44.35 62.13 227.70 -9999 -9999 35.91 -9999 -9999 -9999 -9999 152.41 -9999 235.35 -9999 117.48 -9999 -9999 302.65 198.67 -9999 173.93 -9999 97.16 133.62 2.77 5.29 -9999 -9999 -9999.00 60.35 -9999 204.54 -9999 -9999 -9999 -9999.00 -9999 28.89 63.46 -9999 -9999 -9999 15.41 284.80 44.04 0.13 3.34 372.58 -9999 -9999 25.87 -9999 94.42 62.27 44.15 0.57 77.01 -9999 140.55 -9999 -9999 -9999 -9999 -9999 -9999 11.63 -9999 91.76 -9999 43.40 -9999 -9999 0.49 12.28 0.77 -9999 -9999 231.75 -9999 -9999 -9999 359.83 161.03 187.05 -9999 -9999 103.79 -9999 -9999 -9999 32.72 -9999 -9999 -9999 218.47 -9999 125.50 29.08 202.34 -9999 68.18 -9999 -9999 -9999 -9999 -9999 50.75 11.89 -9999 -9999 -9999 -9999 -9999 -9999 -9999 -9999 -9999 -9999 -9999 -9999 -9999 -9999 -9999 -9999 -9999 144.82 144.77 -9999 13.52 10.35 -9999 155.21 -9999 -9999 122.24 48.05 288.06 -9999 -9999 -9999 126.78 1.15 84.59 13.78 2.19 129.76 82.15 -9999 -9999 -9999 143.71 -9999 -9999 3.95 -9999 -9999 -9999 43.08 68.74 -9999 -9999 141.61 53.95 -9999 -9999 168.99 197.31 -9999 -9999 -9999 -9999 -9999 0.09 2.64 -9999
2015 7 -9999 14.89 7.15 0.73 -9999 7.97 12.78 -9999 -9999 -9999 26.30 24.96 11.53 -9999 17.42 49.66 15.09 -9999 -9999 -9999 -9999 1631.77 -9999 73.38 -9999 305.47 246.39 -9999 1854.65 17.44 -9999 20.24 3.56 -9999 33.81 -9999 -9999 29.32 144.70 149.18 17.59 107.21 243.23 80.11 -9999 -9999 88.98 180.63 -9999.00 117.73 -9999 -9999 -9999 233.21 -9999 17.07 33.23 -9999 -9999 432.28 22.23 -9999 -9999 -9999 42.06 142.39 121.87 38.47 -9999 -9999 4.06 0.04 307.71 10.83 244.26 98.82 246.67 -9999 -9999 -9999 -9999 -9999 64.38 17.64 -9999 -9999 -9999 14.67 -9999 -9999 21.17 55.24 115.33 -9999 -9999 1.44 -9999 -9999 -9999 -9999 236.84 -9999 257.32 -9999 125.48 -9999 -9999 322.91 286.98 -9999 36.35 -9999 490.54 190.94 4.20 1.07 -9999 -9999 0.57 33.29 -9999 192.56 -9999 -9999 -9999 0.69 -9999 45.31 254.87 -9999 -9999 -9999 8.38 122.14 79.95 0.83 7.51 306.20 -9999 -9999 71.10 -9999 97.10 4.80 31.95 0.13 124.70 -9999 115.84 -9999 -9999 -9999 -9999 -9999 -9999 20.65 -9999 28.48 -9999 52.17 -9999 -9999 1.01 10.05 2.65 -9999 -9999 1243.94 -9999 -9999 -9999 440.23 158.48 254.94 -9999 -9999 334.90 -9999 -9999 -9999 104.76 -9999 -9999 -9999 169.22 -9999 97.54 5.53 164.51 -9999 44.15 -9999 -9999 -9999 -9999 -9999 65.03 37.12 -9999 -9999 -9999 -9999 -9999 -9999 -9999 -9999 -9999 -9999 -9999 -9999 -9999 -9999 -9999 -9999 -9999 30.35 70.56 -9999 52.33 13.67 -9999 403.34 -9999 -9999 190.22 160.92 244.95 -9999 -9999 -9999 75.49 1.00 204.67 11.02 5.64 48.30 61.28 -9999 -9999 -9999 117.63 -9999 -9999 4.16 -9999 -9999 -9999 298.24 48.65 -9999 -9999 21.67 53.06 -9999 -9999 183.24 140.30 -9999 -9999 -9999 -9999 -9999 0.02 6.11 -9999
2015 8 -9999 1.52 20.66 3.24 -9999 7.05 5.65 -9999 -9999 -9999 46.95 5.90 12.00 -9999 28.24 49.56 3.88 -9999 -9999 -9999 -9999 574.15 -9999 69.10 -9999 162.74 157.76 -9999 651.03 28.57 -9999 32.26 0.17 -9999 53.68 -9999 -9999 73.86 203.95 134.30 9.02 158.68 193.61 100.55 -9999 -9999 129.69 286.23 0.74 152.13 -9999 -9999 -9999 156.38 -9999 20.40 22.59 -9999 -9999 481.77 37.02 -9999 -9999 -9999 31.07 122.49 63.50 96.00 -9999 -9999 21.30 0.30 172.84 42.62 297.98 116.14 349.86 -9999 -9999 -9999 -9999 -9999 87.33 15.05 -9999 -9999 -9999 30.36 -9999 -9999 12.91 43.72 126.20 -9999 -9999 10.88 -9999 -9999 -9999 -9999 122.96 -9999 185.58 -9999 101.57 -9999 -9999 299.00 115.59 -9999 40.19 -9999 196.76 94.33 0.83 0.01 -9999 -9999 0.14 26.23 -9999 118.32 -9999 -9999 -9999 -9999.00 -9999 23.53 42.51 -9999 -9999 -9999 1.17 131.75 83.76 0.10 18.59 243.42 -9999 -9999 40.49 -9999 39.58 21.80 11.99 2.11 186.93 -9999 171.94 -9999 -9999 -9999 -9999 -9999 -9999 29.66 -9999 87.03 -9999 72.18 -9999 -9999 0.65 2.72 0.59 -9999 -9999 291.40 -9999 -9999 -9999 494.82 204.14 167.37 -9999 -9999 161.26 -9999 -9999 -9999 13.17 -9999 -9999 -9999 301.03 -9999 85.56 21.95 210.58 -9999 30.94 -9999 -9999 -9999 -9999 -9999 77.89 23.05 -9999 -9999 -9999 -9999 -9999 -9999 -9999 -9999 -9999 -9999 -9999 -9999 -9999 -9999 -9999 -9999 -9999 38.89 108.64 -9999 70.13 11.57 -9999 210.42 -9999 -9999 84.58 190.87 93.67 -9999 -9999 -9999 65.52 0.23 96.63 0.71 5.48 102.88 25.92 -9999 -9999 -9999 114.18 -9999 -9999 1.40 -9999 -9999 -9999 100.27 61.34 -9999 -9999 60.14 190.72 -9999 -9999 126.60 125.23 -9999 -9999 -9999 -9999 -9999 0.46 0.20 -9999
2015 9 -9999 1.77 59.01 10.26 -9999 15.90 84.73 -9999 -9999 -9999 28.41 51.11 4.86 -9999 17.02 81.38 42.12 -9999 -9999 -9999 -9999 225.45 -9999 47.80 -9999 184.97 106.49 -9999 252.38 27.40 -9999 132.07 12.47 -9999 41.08 -9999 -9999 41.93 70.92 180.29 2.74 273.61 181.46 146.95 -9999 -9999 320.11 60.54 0.04 57.08 -9999 -9999 -9999 199.34 -9999 74.73 68.04 -9999 -9999 375.46 200.83 -9999 -9999 -9999 34.48 198.01 39.75 13.12 -9999 -9999 23.44 0.03 255.94 325.39 68.07 25.13 73.52 -9999 -9999 -9999 -9999 -9999 23.56 25.64 -9999 -9999 -9999 148.08 -9999 -9999 59.75 28.40 121.04 -9999 -9999 21.88 -9999 -9999 -9999 -9999 188.75 -9999 330.30 -9999 150.61 -9999 -9999 384.65 148.40 -9999 150.70 -9999 17.87 80.15 9.94 0.70 -9999 -9999 0.20 85.16 -9999 120.89 -9999 -9999 -9999 0.20 -9999 19.47 61.11 -9999 -9999 -9999 2.07 199.18 14.05 3.77 65.84 481.03 -9999 -9999 21.35 -9999 76.85 26.20 33.93 2.49 300.41 -9999 69.29 -9999 -9999 -9999 -9999 -9999 -9999 34.18 -9999 47.17 -9999 19.45 -9999 -9999 9.20 9.43 0.96 -9999 -9999 82.93 -9999 -9999 -9999 464.37 25.35 117.22 -9999 -9999 141.38 -9999 -9999 -9999 5.18 -9999 -9999 -9999 208.82 -9999 46.18 29.86 141.54 -9999 27.74 -9999 -9999 -9999 -9999 -9999 37.71 6.79 -9999 -9999 -9999 -9999 -9999 -9999 -9999 -9999 -9999 -9999 -9999 -9999 -9999 -9999 -9999 -9999 -9999 40.67 286.62 -9999 34.68 50.85 -9999 150.92 -9999 -9999 100.73 27.70 26.88 -9999 -9999 -9999 37.11 2.55 63.42 2.08 6.95 260.32 1.45 -9999 -9999 -9999 90.24 -9999 -9999 54.93 -9999 -9999 -9999 56.55 33.86 -9999 -9999 97.57 81.11 -9999 -9999 115.32 116.44 -9999 -9999 -9999 -9999 -9999 1.79 0.82 -9999
2015 10 -9999 8.42 114.76 10.99 -9999 19.21 110.07 -9999 -9999 -9999 33.55 68.82 13.08 -9999 66.63 52.64 64.54 -9999 -9999 -9999 -9999 67.11 -9999 17.70 -9999 202.50 249.85 -9999 12.82 16.43 -9999 119.37 11.78 -9999 48.07 -9999 -9999 19.16 98.19 160.32 109.91 111.15 189.21 131.06 -9999 -9999 285.62 92.25 0.97 64.17 -9999 -9999 -9999 100.95 -9999 170.35 123.20 -9999 -9999 260.69 123.50 -9999 -9999 -9999 31.98 173.37 97.53 0.53 -9999 -9999 33.18 3.21 194.26 540.25 1.18 45.68 20.51 -9999 -9999 -9999 -9999 -9999 43.85 33.21 -9999 -9999 -9999 360.42 -9999 -9999 86.84 28.61 135.37 -9999 -9999 161.52 -9999 -9999 -9999 -9999 142.34 -9999 343.80 -9999 45.83 -9999 -9999 322.71 10.27 -9999 79.54 -9999 1.06 184.08 12.16 34.29 -9999 -9999 15.35 52.01 -9999 204.25 -9999 -9999 -9999 8.47 -9999 26.07 236.41 -9999 -9999 -9999 40.00 46.57 30.27 31.70 60.42 419.62 -9999 -9999 15.35 -9999 13.83 40.91 31.85 0.50 442.25 -9999 89.79 -9999 -9999 -9999 -9999 -9999 -9999 21.69 -9999 5.85 -9999 21.78 -9999 -9999 4.40 11.17 0.20 -9999 -9999 7.15 -9999 -9999 -9999 237.62 70.70 203.90 -9999 -9999 88.16 -9999 -9999 -9999 5.83 -9999 -9999 -9999 165.11 -9999 61.57 36.14 206.20 -9999 15.12 -9999 -9999 -9999 -9999 -9999 32.70 150.52 -9999 -9999 -9999 -9999 -9999 -9999 -9999 -9999 -9999 -9999 -9999 -9999 -9999 -9999 -9999 -9999 -9999 32.20 140.12 -9999 11.39 44.51 -9999 152.61 -9999 -9999 334.43 99.15 20.14 -9999 -9999 -9999 53.48 28.41 19.57 64.58 48.50 98.19 16.93 -9999 -9999 -9999 61.84 -9999 -9999 136.15 -9999 -9999 -9999 218.75 12.70 -9999 -9999 89.20 20.79 -9999 -9999 98.09 65.22 -9999 -9999 -9999 -9999 -9999 1.27 4.05 -9999
2015 11 -9999 0.23 113.53 1.98 -9999 22.55 124.04 -9999 -9999 -9999 93.71 26.15 29.03 -9999 51.93 57.70 20.77 -9999 -9999 -9999 -9999 152.09 -9999 31.51 -9999 39.51 10.00 -9999 66.28 71.24 -9999 129.24 32.18 -9999 82.31 -9999 -9999 78.60 0.62 76.21 35.59 74.14 12.55 73.98 -9999 -9999 80.09 -9999.00 3.49 47.40 -9999 -9999 -9999 170.87 -9999 161.26 137.06 -9999 -9999 77.05 116.61 -9999 -9999 -9999 34.59 83.54 90.89 0.31 -9999 -9999 32.59 3.32 21.54 893.66 -9999.00 37.27 4.79 -9999 -9999 -9999 -9999 -9999 28.26 36.66 -9999 -9999 -9999 816.61 -9999 -9999 44.62 28.34 36.78 -9999 -9999 170.43 -9999 -9999 -9999 -9999 20.20 -9999 87.78 -9999 65.06 -9999 -9999 105.98 11.17 -9999 86.86 -9999 13.22 216.99 9.19 33.06 -9999 -9999 28.36 39.88 -9999 150.24 -9999 -9999 -9999 4.73 -9999 12.98 74.98 -9999 -9999 -9999 5.13 64.99 24.13 53.36 83.45 83.50 -9999 -9999 18.07 -9999 9.73 48.68 172.62 69.02 402.99 -9999 0.34 -9999 -9999 -9999 -9999 -9999 -9999 11.98 -9999 30.71 -9999 2.82 -9999 -9999 1.60 58.32 3.99 -9999 -9999 15.24 -9999 -9999 -9999 89.10 0.05 7.25 -9999 -9999 38.75 -9999 -9999 -9999 0.24 -9999 -9999 -9999 151.21 -9999 102.27 78.17 148.40 -9999 26.12 -9999 -9999 -9999 -9999 -9999 22.33 43.15 -9999 -9999 -9999 -9999 -9999 -9999 -9999 -9999 -9999 -9999 -9999 -9999 -9999 -9999 -9999 -9999 -9999 73.14 103.44 -9999 1.09 68.66 -9999 107.85 -9999 -9999 172.92 12.43 85.51 -9999 -9999 -9999 44.01 33.73 15.72 14.55 37.31 32.34 174.07 -9999 -9999 -9999 79.49 -9999 -9999 119.46 -9999 -9999 -9999 58.22 24.91 -9999 -9999 49.73 77.83 -9999 -9999 78.66 133.38 -9999 -9999 -9999 -9999 -9999 56.87 37.94 -9999
2015 12 -9999 3.79 7.83 18.22 -9999 25.63 299.60 -9999 -9999 -9999 89.58 31.74 31.75 -9999 34.77 8.66 40.55 -9999 -9999 -9999 -9999 3.06 -9999 15.47 -9999 70.73 0.87 -9999 2.93 191.35 -9999 13.47 59.56 -9999 188.32 -9999 -9999 5.81 0.06 16.18 57.40 37.31 5.07 75.78 -9999 -9999 0.73 0.10 1.13 17.71 -9999 -9999 -9999 36.32 -9999 140.27 226.73 -9999 -9999 73.69 12.62 -9999 -9999 -9999 7.94 7.03 93.70 0.24 -9999 -9999 78.73 28.09 24.89 317.79 0.54 37.33 4.78 -9999 -9999 -9999 -9999 -9999 42.05 29.48 -9999 -9999 -9999 553.96 -9999 -9999 34.33 14.63 3.12 -9999 -9999 15.47 -9999 -9999 -9999 -9999 18.12 -9999 1.43 -9999 103.55 -9999 -9999 103.18 38.14 -9999 9.64 -9999 0.32 259.02 23.44 9.51 -9999 -9999 28.70 6.61 -9999 106.50 -9999 -9999 -9999 4.39 -9999 42.80 37.88 -9999 -9999 -9999 32.09 29.41 24.07 31.17 53.12 11.58 -9999 -9999 16.83 -9999 17.12 3.10 140.56 310.22 292.03 -9999 0.01 -9999 -9999 -9999 -9999 -9999 -9999 17.09 -9999 0.94 -9999 5.23 -9999 -9999 35.43 207.67 0.22 -9999 -9999 0.28 -9999 -9999 -9999 95.41 0.10 2.13 -9999 -9999 32.51 -9999 -9999 -9999 1.01 -9999 -9999 -9999 44.34 -9999 81.50 83.27 161.89 -9999 7.86 -9999 -9999 -9999 -9999 -9999 34.70 58.09 -9999 -9999 -9999 -9999 -9999 -9999 -9999 -9999 -9999 -9999 -9999 -9999 -9999 -9999 -9999 -9999 -9999 8.69 15.56 -9999 2.45 70.07 -9999 64.12 -9999 -9999 373.31 1.25 273.71 -9999 -9999 -9999 24.05 32.43 56.14 57.83 161.55 13.60 211.62 -9999 -9999 -9999 103.21 -9999 -9999 132.74 -9999 -9999 -9999 13.63 3.59 -9999 -9999 83.89 116.45 -9999 -9999 40.10 75.98 -9999 -9999 -9999 -9999 -9999 271.86 113.18 -9999
Note:
This only shows the first 12 lines of the example data. Value -9999 indicates there is no cropland area for such crop in the country.


crop_calendars


The crop calendar outlines the planting and harvesting months for each predefined crop across different countries. Users can modify the crop calendar file to add additional crops, following the established format. Below is an example of the crop calendar structure. You can also access the crop calendar output at output_dir/data_processed/crop_calendar.csv.

# Path to the output folder where you wish to save the outputs. Change it accordingly
output_dir <- file.path(getwd(), 'gaia_output')

# calculate crop calendars
crop_cal <- crop_calendars(output_dir = output_dir)

# print result
crop_cal
Table 2. Crop calendar
iso wheat rice maize cassava soybean sugarcane sugarbeet cotton sorghum root_tuber sunflower plant harvest
alb 1 0 0 0 0 0 0 0 0 0 0 11 6
alb 0 0 1 0 0 0 0 0 0 0 0 5 9
alb 0 0 0 0 0 0 0 0 0 0 0 5 8
alb 0 0 0 0 0 0 0 0 0 0 0 11 3
alb 0 0 0 0 0 0 0 0 0 0 0 5 9
alb 0 0 0 0 0 0 0 0 0 0 0 3 10
alb 0 0 0 0 0 0 0 0 0 1 0 3 7
alb 0 0 0 0 0 0 0 0 0 0 0 2 8
alb 0 0 0 0 0 0 0 0 0 0 0 11 6
alb 0 0 0 0 0 0 0 0 0 0 0 11 6
Note:
This only shows the first 10 lines of the example data.


data_aggregation


The data_aggregation function calculates crop growing seasons using climate variables processed by weighted_climate along with crop calendars for both historical and projected periods. This function prepares climate and yield data for subsequent model fitting.

The data_aggregation function creates two types of files in the output_dir/data_processed folder:

  • historic_vars_[crop-name].csv: This file contains historical data for each crop. For example, historical information for soybean is illustrated in Table 3.

  • weather_[climate-model]_[climate-scenario]_[crop-name].csv: This file includes aggregated climate data for the specified crop. An example of climate information for soybean is shown in Table 4.

# Path to the output folder where you wish to save the outputs. Change it accordingly
output_dir <- file.path(getwd(), 'gaia_output')

# aggregate crop and climate information at the country level
data_agg <- data_aggregation(climate_hist_dir = climate_hist_dir,
                             climate_impact_dir = climate_impact_dir,
                             climate_model = 'canesm5',
                             climate_scenario = 'gcam-ref',
                             output_dir = output_dir)
Table 3. Aggregated historical information for soybean.
iso year gdp_pcap_ppp crop area_harvest irr_rf irr_equip co2_conc yield grow_month grow_season temp precip
arg 1961 7.116181 soybean 980 rf 5.233 317.64 9765 1 1 17.49 71.90
arg 1961 7.116181 soybean 980 rf 5.233 317.64 9765 2 1 15.76 171.47
arg 1961 7.116181 soybean 980 rf 5.233 317.64 9765 3 1 15.33 64.36
arg 1961 7.116181 soybean 980 rf 5.233 317.64 9765 4 1 12.31 65.97
arg 1961 7.116181 soybean 980 rf 5.233 317.64 9765 5 1 8.92 28.31
arg 1961 7.116181 soybean 980 rf 5.233 317.64 9765 6 0 0.00 0.00
arg 1961 7.116181 soybean 980 rf 5.233 317.64 9765 7 0 0.00 0.00
arg 1961 7.116181 soybean 980 rf 5.233 317.64 9765 8 0 0.00 0.00
arg 1961 7.116181 soybean 980 rf 5.233 317.64 9765 9 0 0.00 0.00
arg 1961 7.116181 soybean 980 rf 5.233 317.64 9765 10 0 0.00 0.00
Note:
This only shows the first 10 lines of the example data.
Table 4. Aggregated weather information for soybean.
year iso crop temp_mean temp_max temp_min precip_mean precip_max precip_min GCAM_region_name co2_conc
2015 arg soybean 13.870 16.80 9.42 62.758 92.16 25.63 Argentina 403.1340
2016 arg soybean 14.870 18.54 10.30 76.034 139.59 35.53 Argentina 406.0092
2017 arg soybean 14.342 17.58 10.87 77.414 93.54 53.58 Argentina 408.8844
2018 arg soybean 14.518 17.20 10.33 57.868 77.41 32.60 Argentina 411.7596
2019 arg soybean 14.284 18.37 9.33 112.450 248.10 28.94 Argentina 414.6348
2020 arg soybean 14.164 16.46 9.52 94.260 177.09 48.33 Argentina 417.5100
2021 arg soybean 14.372 18.51 10.69 81.306 130.18 41.56 Argentina 420.9428
2022 arg soybean 14.638 18.34 10.35 66.506 106.83 25.89 Argentina 424.3756
2023 arg soybean 14.088 16.64 10.58 84.342 154.99 30.03 Argentina 427.8084
2024 arg soybean 14.548 18.03 10.60 82.828 126.91 15.84 Argentina 431.2412
Note:
This only shows the first 10 lines of the example data.


yield_regression


The gaia::yield_regression function performs empirical model fitting and generates diagnostic plots comparing modeled yields to FAO recorded yields for each crop type at the GCAM region scale. An example of this comparison for soybean is illustrated in Figure 2.

# Path to the output folder where you wish to save the outputs. Change it accordingly
output_dir <- file.path(getwd(), 'gaia_output')

# perform empirical regression
yield_regression(diagnostics = TRUE,
                 output_dir = output_dir)

Figure 2: Model fitted yields versus FAO yields for soybean.


The parameters of the fitted model can be found in the file located at output_dir/data_processed/reg_out_[crop-name]_fit_lnyield_mmm_quad_noco2_nogdp.csv.

Table 5. Fitted model for soybean.
term estimate std.error statistic p.value
(Intercept) -17.3684531 0.9409990 -18.457461 0.0000000
year 0.0140001 0.0004217 33.203002 0.0000000
temp_mean -0.2550105 0.1173558 -2.172969 0.0300334
temp_mean_2 0.0084446 0.0038428 2.197496 0.0282299
temp_max 0.1501057 0.0757098 1.982646 0.0476996
temp_max_2 -0.0044598 0.0019971 -2.233172 0.0257738
temp_min 0.0436482 0.0189879 2.298740 0.0217397
temp_min_2 -0.0022589 0.0009430 -2.395559 0.0167910
precip_mean -0.0027821 0.0011221 -2.479350 0.0133377
precip_mean_2 0.0000092 0.0000049 1.871032 0.0616531
Note:
This only shows the first 10 lines of the example data.


yield_shock_projection


Once the gaia model has completed fitting, the gaia::yield_shock_projection function calculates the projected annual yield shocks based on the input climate data. For coarse-scale models like GCAM, gaia also computes smoothed yield shocks using a user-specified smoothing window (the default window is 20 years). In the smoothed outputs, the yield shocks at the base year will be set to 1. The results are provided in both CSV outputs and diagnostic plots. An example of annual soybean yield shocks is illustrated in Figure 3.

# Path to the output folder where you wish to save the outputs. Change it accordingly
output_dir <- file.path(getwd(), 'gaia_output')

# calculate projected yield shocks
out_yield_shock <- yield_shock_projection(use_default_coeff = FALSE,
                                          climate_model = 'canesm5',
                                          climate_scenario = 'gcam-ref',
                                          base_year = 2015,
                                          start_year = 2015,
                                          end_year = 2100,
                                          smooth_window = 20,
                                          diagnostics = TRUE,
                                          output_dir = output_dir)

Figure 3: Projected yield shocks for soybean.


The output data for annual and smoothed yield shocks projection are located under folders output_dir/yield_impacts_annual (Table 6) and output_dir/yield_impacts_smooth (Table 7).

Table 6. Annual yield shocks for soybean.
GCAM_region_name iso crop year yield_impact
Africa_Southern tza soybean 2015 1.0057519
Africa_Western nga soybean 2015 1.0377940
Argentina arg soybean 2015 1.0151492
Canada can soybean 2015 1.0049194
China chn soybean 2015 0.9769140
Colombia col soybean 2015 NA
EU-15 ita soybean 2015 0.9985774
Europe_Non_EU tur soybean 2015 1.0566004
India ind soybean 2015 1.0545602
Mexico mex soybean 2015 0.9773951
Note:
This only shows the first 10 lines of the example data.
Table 7. 20-year smoothed yield shocks for soybean.
crop model scenario iso 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090
soybean canesm5 gcam-ref arg 1 0.9993807 0.9987614 0.9981420 0.9975227 0.9969034 0.9968355 0.9967676 0.9966996 0.9966317 0.9965638 0.9964959 0.9964280 0.9963600 0.9962921 0.9962242 0.9958960 0.9955678 0.9952396 0.9949114 0.9945832 0.9942550 0.9939268 0.9935986 0.9932704 0.9929422 0.9919359 0.9909297 0.9899234 0.9889172 0.9879110 0.9869047 0.9858985 0.9848922 0.9838860 0.9828797 0.9821853 0.9814908 0.9807964 0.9801019 0.9794075 0.9787130 0.9780186 0.9773241 0.9766297 0.9759352 0.9760368 0.9761383 0.9762399 0.9763414 0.9764430 0.9765446 0.9766461 0.9767477 0.9768492 0.9769508 0.9767368 0.9765229 0.9763089 0.9760950 0.9758811 0.9756671 0.9754532 0.9752393 0.9750253 0.9748114 0.9749882 0.9751650 0.9753418 0.9755187 0.9756955 0.9758723 0.9760491 0.9762259 0.9764028 0.9765796
soybean canesm5 gcam-ref bol 1 1.0004914 1.0009828 1.0014743 1.0019657 1.0024571 1.0022937 1.0021304 1.0019670 1.0018036 1.0016403 1.0014769 1.0013135 1.0011502 1.0009868 1.0008234 0.9995553 0.9982872 0.9970191 0.9957510 0.9944829 0.9932148 0.9919467 0.9906786 0.9894105 0.9881424 0.9874969 0.9868514 0.9862059 0.9855603 0.9849148 0.9842693 0.9836238 0.9829782 0.9823327 0.9816872 0.9814435 0.9811997 0.9809560 0.9807123 0.9804686 0.9802248 0.9799811 0.9797374 0.9794937 0.9792500 0.9789164 0.9785829 0.9782493 0.9779157 0.9775822 0.9772486 0.9769151 0.9765815 0.9762480 0.9759144 0.9772488 0.9785831 0.9799174 0.9812517 0.9825860 0.9839204 0.9852547 0.9865890 0.9879233 0.9892576 0.9890063 0.9887549 0.9885035 0.9882521 0.9880008 0.9877494 0.9874980 0.9872466 0.9869952 0.9867439
soybean canesm5 gcam-ref can 1 0.9973227 0.9946455 0.9919682 0.9892909 0.9866137 0.9872040 0.9877942 0.9883845 0.9889748 0.9895651 0.9901554 0.9907457 0.9913359 0.9919262 0.9925165 0.9917872 0.9910579 0.9903287 0.9895994 0.9888701 0.9881408 0.9874115 0.9866823 0.9859530 0.9852237 0.9842641 0.9833044 0.9823448 0.9813851 0.9804255 0.9794658 0.9785062 0.9775466 0.9765869 0.9756273 0.9761157 0.9766042 0.9770926 0.9775811 0.9780695 0.9785580 0.9790465 0.9795349 0.9800234 0.9805118 0.9802660 0.9800202 0.9797744 0.9795287 0.9792829 0.9790371 0.9787913 0.9785455 0.9782997 0.9780539 0.9784909 0.9789279 0.9793649 0.9798019 0.9802388 0.9806758 0.9811128 0.9815498 0.9819868 0.9824238 0.9821757 0.9819277 0.9816797 0.9814316 0.9811836 0.9809356 0.9806875 0.9804395 0.9801915 0.9799434
soybean canesm5 gcam-ref chn 1 0.9967303 0.9934605 0.9901908 0.9869211 0.9836513 0.9831567 0.9826620 0.9821673 0.9816727 0.9811780 0.9806833 0.9801887 0.9796940 0.9791993 0.9787047 0.9789300 0.9791552 0.9793805 0.9796058 0.9798311 0.9800564 0.9802816 0.9805069 0.9807322 0.9809575 0.9808478 0.9807382 0.9806285 0.9805188 0.9804092 0.9802995 0.9801899 0.9800802 0.9799705 0.9798609 0.9800423 0.9802237 0.9804052 0.9805866 0.9807680 0.9809495 0.9811309 0.9813123 0.9814938 0.9816752 0.9813962 0.9811172 0.9808383 0.9805593 0.9802803 0.9800014 0.9797224 0.9794434 0.9791644 0.9788855 0.9788117 0.9787379 0.9786641 0.9785903 0.9785165 0.9784427 0.9783689 0.9782951 0.9782213 0.9781475 0.9782861 0.9784247 0.9785633 0.9787019 0.9788405 0.9789791 0.9791177 0.9792564 0.9793950 0.9795336
soybean canesm5 gcam-ref col 1 1.0020314 1.0040628 1.0060942 1.0081256 1.0101570 1.0111680 1.0121789 1.0131899 1.0142008 1.0152118 1.0162227 1.0172336 1.0182446 1.0192555 1.0202665 1.0203511 1.0204358 1.0205204 1.0206051 1.0206897 1.0207744 1.0208590 1.0209437 1.0210283 1.0211130 1.0202092 1.0193055 1.0184017 1.0174980 1.0165942 1.0156905 1.0147868 1.0138830 1.0129793 1.0120755 1.0109141 1.0097526 1.0085912 1.0074297 1.0062683 1.0051068 1.0039454 1.0027839 1.0016225 1.0004610 1.0005619 1.0006628 1.0007636 1.0008645 1.0009654 1.0010663 1.0011672 1.0012680 1.0013689 1.0014698 1.0021532 1.0028366 1.0035199 1.0042033 1.0048867 1.0055701 1.0062535 1.0069369 1.0076202 1.0083036 1.0087079 1.0091123 1.0095166 1.0099209 1.0103253 1.0107296 1.0111339 1.0115383 1.0119426 1.0123469
soybean canesm5 gcam-ref guy 1 1.0016505 1.0033010 1.0049515 1.0066020 1.0082525 1.0076475 1.0070426 1.0064376 1.0058326 1.0052276 1.0046227 1.0040177 1.0034127 1.0028078 1.0022028 1.0005761 0.9989495 0.9973228 0.9956961 0.9940695 0.9924428 0.9908161 0.9891895 0.9875628 0.9859362 0.9851151 0.9842941 0.9834731 0.9826521 0.9818311 0.9810101 0.9801891 0.9793680 0.9785470 0.9777260 0.9781414 0.9785568 0.9789722 0.9793877 0.9798031 0.9802185 0.9806339 0.9810493 0.9814647 0.9818801 0.9811923 0.9805044 0.9798165 0.9791287 0.9784408 0.9777529 0.9770651 0.9763772 0.9756894 0.9750015 0.9756735 0.9763456 0.9770176 0.9776897 0.9783617 0.9790338 0.9797058 0.9803778 0.9810499 0.9817219 0.9824824 0.9832430 0.9840035 0.9847640 0.9855245 0.9862850 0.9870455 0.9878061 0.9885666 0.9893271
soybean canesm5 gcam-ref ind 1 0.9947227 0.9894454 0.9841681 0.9788907 0.9736134 0.9764248 0.9792362 0.9820476 0.9848590 0.9876704 0.9904818 0.9932931 0.9961045 0.9989159 1.0017273 1.0023780 1.0030288 1.0036795 1.0043303 1.0049810 1.0056318 1.0062825 1.0069333 1.0075840 1.0082348 1.0052712 1.0023076 0.9993440 0.9963804 0.9934168 0.9904532 0.9874896 0.9845260 0.9815624 0.9785988 0.9800357 0.9814725 0.9829094 0.9843463 0.9857831 0.9872200 0.9886568 0.9900937 0.9915306 0.9929674 0.9936697 0.9943720 0.9950743 0.9957765 0.9964788 0.9971811 0.9978833 0.9985856 0.9992879 0.9999902 1.0049641 1.0099381 1.0149121 1.0198860 1.0248600 1.0298340 1.0348080 1.0397819 1.0447559 1.0497299 1.0480319 1.0463339 1.0446359 1.0429379 1.0412399 1.0395419 1.0378439 1.0361459 1.0344479 1.0327499
soybean canesm5 gcam-ref ita 1 1.0027258 1.0054515 1.0081773 1.0109031 1.0136289 1.0120174 1.0104059 1.0087944 1.0071829 1.0055714 1.0039599 1.0023485 1.0007370 0.9991255 0.9975140 0.9961448 0.9947757 0.9934065 0.9920374 0.9906682 0.9892991 0.9879299 0.9865608 0.9851916 0.9838225 0.9836711 0.9835197 0.9833683 0.9832170 0.9830656 0.9829142 0.9827628 0.9826114 0.9824601 0.9823087 0.9814239 0.9805390 0.9796542 0.9787694 0.9778845 0.9769997 0.9761148 0.9752300 0.9743452 0.9734603 0.9733874 0.9733144 0.9732415 0.9731685 0.9730955 0.9730226 0.9729496 0.9728766 0.9728037 0.9727307 0.9725583 0.9723859 0.9722135 0.9720411 0.9718687 0.9716963 0.9715239 0.9713515 0.9711791 0.9710067 0.9695777 0.9681486 0.9667195 0.9652905 0.9638614 0.9624323 0.9610033 0.9595742 0.9581451 0.9567161
soybean canesm5 gcam-ref mex 1 1.0030933 1.0061865 1.0092798 1.0123731 1.0154663 1.0161667 1.0168670 1.0175673 1.0182677 1.0189680 1.0196684 1.0203687 1.0210690 1.0217694 1.0224697 1.0214565 1.0204433 1.0194302 1.0184170 1.0174038 1.0163906 1.0153774 1.0143642 1.0133510 1.0123378 1.0116733 1.0110087 1.0103442 1.0096796 1.0090151 1.0083505 1.0076860 1.0070214 1.0063569 1.0056923 1.0063728 1.0070533 1.0077338 1.0084142 1.0090947 1.0097752 1.0104557 1.0111362 1.0118167 1.0124971 1.0118407 1.0111843 1.0105278 1.0098714 1.0092150 1.0085585 1.0079021 1.0072457 1.0065892 1.0059328 1.0049872 1.0040416 1.0030960 1.0021504 1.0012048 1.0002592 0.9993136 0.9983679 0.9974223 0.9964767 0.9966744 0.9968720 0.9970696 0.9972672 0.9974648 0.9976625 0.9978601 0.9980577 0.9982553 0.9984530
soybean canesm5 gcam-ref nga 1 1.0004543 1.0009086 1.0013630 1.0018173 1.0022716 1.0032933 1.0043150 1.0053368 1.0063585 1.0073802 1.0084019 1.0094236 1.0104453 1.0114670 1.0124887 1.0131240 1.0137593 1.0143945 1.0150298 1.0156650 1.0163003 1.0169356 1.0175708 1.0182061 1.0188414 1.0192797 1.0197181 1.0201565 1.0205948 1.0210332 1.0214716 1.0219099 1.0223483 1.0227867 1.0232250 1.0234941 1.0237632 1.0240322 1.0243013 1.0245704 1.0248394 1.0251085 1.0253776 1.0256466 1.0259157 1.0254327 1.0249496 1.0244666 1.0239836 1.0235005 1.0230175 1.0225345 1.0220515 1.0215684 1.0210854 1.0213908 1.0216963 1.0220017 1.0223072 1.0226126 1.0229180 1.0232235 1.0235289 1.0238344 1.0241398 1.0248050 1.0254701 1.0261353 1.0268005 1.0274656 1.0281308 1.0287960 1.0294611 1.0301263 1.0307915
Note:
This only shows the first 10 lines of the example data.


gcam_agprodchange


The gcam_agprodchange function is specifically designed for the Global Change Analysis Model (GCAM). GCAM requires the agricultural productivity growth rate (APG) as an input, which is calculated based on yield shocks and the baseline APG, varying according to different SSP scenarios. Additionally, the APG for GCAM must be at the region-basin scale. The gaia::gcam_agprodchange function directly remaps country-level yield shocks to region-basin APG. In the example below, since climate_scenario = 'gcam-ref', it will use the APG without SSP impact (Reference scenario APC) to calculate the climate-impacted APG based on the yield shocks computed in the previous step.

# Path to the output folder where you wish to save the outputs. Change it accordingly
output_dir <- file.path(getwd(), 'gaia_output')

# calculate region-basin agricultural productivity growth rate for GCAM
gcam_apg <- gcam_agprodchange(data = out_yield_shock,
                              climate_model = 'canesm5',
                              climate_scenario = 'gcam-ref',
                              member = 'r1i1p1f1',
                              bias_adj = 'w5e5',
                              cfe = 'no-cfe',
                              gcam_version = 'gcam7',
                              diagnostics = TRUE,
                              output_dir = output_dir)


Once the run is complete, a folder named [gcam-version]_agprodchange_[cfe] (e.g., gcam7_agprodchange_no-cfe) will be created in your specified output location. This folder contains the XML file of the agricultural productivity growth rate (APG) for GCAM. Additionally, it includes diagnostic figures illustrating the APG by region-basin. An example of APG for soybean is shown in Figure 4 below.

Figure 4: Agricultural productivity growth rate for soybean. Each line under a region indicates the APG for the region-basin intersection.


Back to top