Author: Gerald C. Nelson
This page describes the code and data needed to reproduce the results in the Global Change Biology paper, "Global reductions in manual agricultural work capacity due to climate change", available at the Zenodo site ().
The Directory structure section describes the directories needed (which should automatically be created when the zenodo files are downloaded) and what is contained in them.The Order of operations section describes the order in which the R code files need to be run to generate the results.
The directory structure for the code is described below.
- code — Contains all R code needed to generate the results
- data — Code to import data from the ISIMP project and process them
- plots — Code to generate graphics used in the paper
- tables — Code to generate tables used in the paper and the supplementary material
- other — Experimental code to investigate the impacts of using hourly data instead of daily data
- data-raw — Downloaded climate files from the ISIMIP project and other data imported from open sources.
The ISIMIP project prepares daily bias-corrected 1/2 degree resolution data from five earth system models (ESMs) - GFDL-ESM4, UKESM1-0-LL, MPI-ESM1-2-HR, MRI-ESM2-0, and IPSL-CM6A-LR). The paper uses the ISIMIP3b data from
https://doi.org/10.48364/ISIMIP.842396.1. The data sets used are collectively about 2 terabytes. It can be useful to store them on an external drive and then use a symlink from the external drive to the data-raw
directory (Mac directions, PC directions) to access them.
- data — processed data files
- graphics — graphics included in the paper
- tables — tables included in the paper
The R code in the R/code/data directory contains the following R files. These need to be run in the order listed below.
1a_get_weather.R
- create a set oftxt
files in thedata-raw/ISIMIP/filelists/
directory with ISIMIP climate data file names to be used in1b_get_weather.R
. Installed needed packages that are not already installed.1b_get_weather.R
- download a set of climate data files from the ISIMIP server based on the.txt
files created in1a_get_weather.R
. Each file is about 2.5 GB. For each of the three scenarios plus the recent past data files, the combined data sets require 285 GB. You will need at last terabyte of space for all the data. The download process can take a long time.2a_daytemp.R
- calculate the average temperature in daylight hours using thetasmin
andtasmax
data files2b_fix_radiation.R
- converts thersds
data file to average solar radiation during daylight hours.3_wbgt.R
- calculatewbgt
values for each combination of climate scenario and time period. The code includes a switch to calculatewbgt
with solar radiation values or without to simulate complete shade. The default isnosun <- FALSE
. Change toTRUE
to create thewbgt
values with solar radiation set to zero.4_pwc.R
- calculate PWC values for each combination of climate scenario and time period.5_agg_time.R
- aggregate daily PWC values over one of the 20 year periods - 1991-2010, 2041-2060, and 2081-2100, for individual models6_agg_models.R
- aggregate the results of5_agg_time.R
across all models to get aspatraster
with 365 layers for each scenario.7_get_crops.R
- sum area of the 172 crops in thegeodata
library from the Monfreda, et al. data, and generated weighted crop calendar data based on the Sacks, et al, 2010 crop calendars in thegeodata
library8_summarize.R
- Aggregate to daily means of annual, growing season and hottest periods. Setnosun <- TRUE
to calculate the impact of eliminating the radiation effect in PWC values.10_FAO_ERS_employment.R
- create rasterized versions of the country-specific labor data from either ERS or FAO. ERS version used in the paper.
The R/code/plots directory contains the following R files that produce figures in the GCB paper. These can be run in any order.
GCB_Figure_1_cumul.R
- create Figure 1. Cumulative distribution of early 21st century cropland Physical Work Capacity (PWC) for recent \past (1991-2010) and potential future thermal conditions and Table S2. Physical Work Capacity (PWC) in the tropics (23S – 23N latitude), 1991-2010 and potential future thermal conditions (2041-2060 and 2081-2100), for three emission scenarios (SSP1-2.6, SSP3-7.0 and SSP5-8.5GCB_Figure_2_latitude.R
- create Figure 2. Physical Work Capacity (PWC) by latitude for global cropland for recent past (1991-2010) and potential future thermal conditionsGCB_Figure_3_global.R
- create Figure 3. Average PWCs during the crop growing season and the hottest periodGCB_Figure_4_regions.R
- create Figure 4. Average PWCs during the growing season for three countriesGCB_Figure_5_global_noSun.R
- create Figure 5. Impact of eliminating radiation effect in PWC valuesGCB_Figure_6_mech_needs.R
- create Figure 6. The additional HP per hectare to make at least 1 HP per cropped hectare availableGCB_Figure_S1_aggregation_methods.R
- not used in GCB paper. Produces global figures using SSP1-2.6 and SSP5-8.5 data for recent past, mid-century, and end-century for annual, growing season, and hottest 90 days periods.
The R/code/tables directory contains the following R files that produce the tables in the GCB paper. These can be run in any order.
GCB_table_1.R
- create Table 1. Physical Work Capacity (PWC) for 1991-2010 and potential future thermal conditionsGCB_Table_2_labor_global_share.R
- create Table 2. Share of early century agricultural workers during the crop growing season with mean growing season PWC at or below a cutoff value of PWC by period and emission scenarioGCB_Table_3_countries.R
- create Table 3. Summary of PWC results for selected countriesGCB_Table_4_labor_regions.R
- create Table 4. Early century agricultural labor experiencing growing season thermal environments for selected countriesGCB_table_5_delta_NoSun.R
- create Table 5. Change in the PWC ratio from elimination of the radiation effectGCB_SM_Table_1_countries_all.R
- create Table S1, Physical Work Capacity (PWC) for 1991-2010 and potential future thermal conditions (2041-2060 and 2081-2100) for three emission scenarios (SSP1-2.6, SSP3-7.0 and SSP5-8.5GCB_SM_Table_3_countries_all_other.R
- create Table S3. Summary data used in adaptation analysis for all countries (See Table 3 in main text for details)
All data used in this paper are downloaded in the code from open source data sites or with the R geodata
package.
The main sources are
- Climate data from the ISIMIP project [https://www.isimip.org] that are daily bias-corrected and 1/2 degree resolution from five earth system models (ESMs - GFDL-ESM4, UKESM1-0-LL, MPI-ESM1-2-HR, MRI-ESM2-0, and IPSL-CM6A-LR). This paper uses the ISIMIP3b data from https://doi.org/10.48364/ISIMIP.842396.1.
- Area of the 172 crops in the
geodata
library described in Monfreda, et al. data and an area -weighted crop calendar data based on the Sacks, et al, 2010 crop calendars in thegeodata
library. - Country-level data on agricultural labor and machinery, downloaded from the USDA/ERS website Fuglie, Jelliffe, and Morgan.
Identify code/data issues in the Issues section of this repository. Questions/Comments to [email protected]