Skip to content

Commit

Permalink
Merge pull request #2 from JGCRI/dev-paper
Browse files Browse the repository at this point in the history
Dev paper
  • Loading branch information
mengqi-z authored Nov 4, 2024
2 parents a61b691 + 45189e9 commit 6e3120a
Show file tree
Hide file tree
Showing 11 changed files with 30 additions and 29 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/R-CDM-check.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: R-CMD-check.yaml
name: R-CMD-check

on:
push:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-coverage.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: test-coverage.yaml
name: test-coverage

on:
push:
Expand Down
5 changes: 1 addition & 4 deletions R/crop_calendars.R
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,7 @@ crop_calendars <- function(output_dir = file.path(getwd(), 'output')){
d <- gaia::iso_replace( d )

# Indicators for crops
crops <- tibble::tibble(
crop_mirca = c('wheat', 'sorghum', 'maize', 'rice', 'soybean', 'sugarcane', 'sugarbeet', 'cotton', 'cassava', 'root_tuber', 'sunflower'),
crop_sage = c('wheat', 'sorghum', 'maize', 'rice', 'soybeans', 'sugarcane', 'sugarbeets', 'cotton', 'cassava', 'potatoes', 'sunflower')
)
crops <- mapping_mirca_sage

for(i in 1:nrow(crops)){

Expand Down
2 changes: 1 addition & 1 deletion R/yield_impact.R
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ yield_impact <- function(pr_hist_ncdf = NULL,
output_dir = file.path(getwd(), 'output'))
{

# Step 1b: Process standard NetCDF files from ISIMIP to country level historical climate
# Step 1a: Process standard NetCDF files from ISIMIP to country level historical climate
if(any(!is.null(pr_hist_ncdf), !is.null(tas_hist_ncdf))){

gaia::weighted_climate(pr_ncdf = pr_hist_ncdf,
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<!-- badges: start -->
[![R-CMD-check.yaml](https://github.com/JGCRI/gaia/actions/workflows/R-CDM-check.yaml/badge.svg?branch=main)](https://github.com/JGCRI/gaia/actions/workflows/R-CDM-check.yaml)
[![test-coverage.yaml](https://github.com/JGCRI/gaia/actions/workflows/test-coverage.yaml/badge.svg)](https://github.com/JGCRI/gaia/actions/workflows/test-coverage.yaml)
[![R-CMD-check](https://github.com/JGCRI/gaia/actions/workflows/R-CDM-check.yaml/badge.svg?branch=main)](https://github.com/JGCRI/gaia/actions/workflows/R-CDM-check.yaml)
[![test-coverage](https://github.com/JGCRI/gaia/actions/workflows/test-coverage.yaml/badge.svg)](https://github.com/JGCRI/gaia/actions/workflows/test-coverage.yaml)
[![codecov](https://codecov.io/gh/JGCRI/gaia/branch/main/graph/badge.svg?token=XQ913U4IYM)](https://codecov.io/gh/JGCRI/gaia)
[![docs](https://github.com/JGCRI/gaia/actions/workflows/docs.yaml/badge.svg)](https://github.com/JGCRI/gaia/actions/workflows/docs.yaml)
<!-- badges: end -->
Expand All @@ -13,12 +13,12 @@
<!-- ------------------------>
<!-- ------------------------>

`gaia` is an open-source R package designed to estimate crop yield shocks in response to annual temperature and precipitation variations and CO~2~ concentrations at the country scale for 12 major crops. `gaia` streamlines the workflow from raw climate data processing to the production of different forms of yield shocks, such as agricultural productivity changes at the region-basin level, which can be directly integrated into the latest Global Change Analysis Model (GCAM).
`gaia` is an open-source R package designed to estimate crop yield shocks in response to annual temperature and precipitation variations and CO<sub>2</sub> concentrations at the country scale for 12 major crops. `gaia` streamlines the workflow from raw climate data processing to the production of different forms of yield shocks, such as agricultural productivity changes at the region-basin level, which can be directly integrated into the latest Global Change Analysis Model (GCAM).

<br />

<p align="center">
<a href="https://jgcri.github.io/gaia/" target="_blank"><img src="https://github.com/JGCRI/gaia/blob/main/vignettes/vignetteFigs/button_user_guide.png?raw=true"
<a href="https://jgcri.github.io/gaia/articles/vignette.html" target="_blank"><img src="https://github.com/JGCRI/gaia/blob/main/vignettes/vignetteFigs/button_user_guide.png?raw=true"
alt="https://jgcri.github.io/gaia/articles/vignette.html" height="60"/></a>
<img src="https://github.com/JGCRI/jgcricolors/blob/main/vignettes/button_divider.PNG?raw=true" height="40"/>
</p>
Expand Down
3 changes: 2 additions & 1 deletion _pkgdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ home:
navbar:
type: inverse
left:
- icon: fa-home
- text: "Home"
icon: fa-home
href: index.html
- text: "User Guide"
icon: fas fa-book
Expand Down
2 changes: 1 addition & 1 deletion data-raw/DATASET.R
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ usethis::use_data(agprodchange_ni_gcam7, overwrite = TRUE)
# is provided
coef_default <- data.table::data.table()
for(crop_name in mapping_mirca_sage$crop_mirca){
coef_crop <- gaia::input_data(folder_path = 'C:/WorkSpace/github/test_scripts/gaia/output/data_processed',
coef_crop <- gaia::input_data(folder_path = 'C:/WorkSpace/GCIMS/GCIMS_Yield/regression_analysis/output/20230706_0942/data_processed',
input_file = paste("reg_out_", crop_name, "_", fit_name, ".csv", sep = ""),
skip_number = 0 )
coef_default <- dplyr::bind_rows(
Expand Down
Binary file modified data/coef_default.rda
Binary file not shown.
8 changes: 4 additions & 4 deletions paper/paper.bib
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ @article{Portmann_2010
number = {1},
pages = {},
keywords = {land use, irrigation, agricultural systems},
doi = {https://doi.org/10.1029/2008GB003435},
doi = {10.1029/2008GB003435},
url = {https://agupubs.onlinelibrary.wiley.com/doi/abs/10.1029/2008GB003435},
eprint = {https://agupubs.onlinelibrary.wiley.com/doi/pdf/10.1029/2008GB003435},
year = {2010}
Expand All @@ -60,7 +60,7 @@ @article{Chapagain_2022
pages = {108448},
year = {2022},
issn = {0378-4290},
doi = {https://doi.org/10.1016/j.fcr.2022.108448},
doi = {10.1016/j.fcr.2022.108448},
url = {https://www.sciencedirect.com/science/article/pii/S0378429022000193},
author = {Ranju Chapagain and Tomas A. Remenyi and Rebecca M.B. Harris and Caroline L. Mohammed and Neil Huth and Daniel Wallach and Ehsan Eyshi Rezaei and Jonathan J. Ojeda},
keywords = {Crop model, Input uncertainty, Structural uncertainty, Parameter uncertainty, Grain yield, Mechanistic modelling}
Expand Down Expand Up @@ -100,7 +100,7 @@ @article{Sacks_2010
number = {5},
pages = {607-620},
keywords = {Agricultural management, crop calendars, crop modelling, global agricultural systems, harvesting dates, maize, phenology, planting dates, spring wheat, winter wheat},
doi = {https://doi.org/10.1111/j.1466-8238.2010.00551.x},
doi = {10.1111/j.1466-8238.2010.00551.x},
url = {https://onlinelibrary.wiley.com/doi/abs/10.1111/j.1466-8238.2010.00551.x},
eprint = {https://onlinelibrary.wiley.com/doi/pdf/10.1111/j.1466-8238.2010.00551.x},
year = {2010}
Expand Down Expand Up @@ -161,7 +161,7 @@ @article{von-Lampe_2014
number = {1},
pages = {3-20},
keywords = {Computable general equilibrium, Partial equilibrium, Meta-analysis, Socioeconomic pathway, Climate change, Bioenergy, Land use, Model intercomparison, C63, C68, Q11, Q16, Q24, Q42, Q54},
doi = {https://doi.org/10.1111/agec.12086},
doi = {10.1111/agec.12086},
url = {https://onlinelibrary.wiley.com/doi/abs/10.1111/agec.12086},
eprint = {https://onlinelibrary.wiley.com/doi/pdf/10.1111/agec.12086},
year = {2014}
Expand Down
13 changes: 5 additions & 8 deletions paper/paper.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,29 +28,26 @@ bibliography: paper.bib

# Summary

`gaia` is an open-source R package designed to estimate crop yield shocks in response to annual weather variations and CO~2~ concentrations at the country scale for 12 major crops. It enables the projection of annual yield shocks under various future climate scenarios, differentiated by crop type, country, and year. This innovative tool streamlines the workflow from raw climate data processing to projections of annual shocks to crop yields at the country level, using the response surfaces developed and documented in @Waldhoff_2020, an empirical econometric model that leverages historical weather, CO~2~, and crop yield data for robust empirical fitting for 12 crops. `gaia` uses these response surfaces with bias-corrected, gridded monthly temperature and precipitation projections (e.g., from the Coupled Model Intercomparison Project Phase 6 (CMIP6, @Oneil_2016) and Inter-Sectoral Impact Model Intercomparison Project (ISIMIP, @Warszawski_2014)) to project shocks that can be applied to agricultural productivity changes at the country-level for use in economic models. The historical and future projections use gridded, country-crop specific monthly growing season precipitation and temperature data, aggregated to the national level, weighted by cropland area derived from MIRCA [@Portmann_2010]. These annual, country, crop-specific yield shocks can be aggregated to different regional definitions, crop commodity definitions, and time periods (e.g., 20-year rolling-average trends), as needed by specific economic models. `gaia` serves as a lightweight, powerful model that equips researchers with projections of annual yield shocks for multiple crops, at a model-specific spatial resolution that is necessary to explore crop yields responses to a broad range of future climate projections, enhancing human-Earth system analysis capabilities.
`gaia` is an open-source R package designed to estimate crop yield shocks in response to annual weather variations and CO2 concentrations at the country scale for 12 major crops. This innovative tool streamlines the workflow from raw climate data processing to projections of annual shocks to crop yields at the country level, using the response surfaces developed and documented in @Waldhoff_2020, an empirical econometric model that leverages historical weather, CO~2~, and crop yield data for robust empirical fitting for 12 crops. `gaia` uses these response surfaces with bias-corrected, gridded monthly temperature and precipitation projections (e.g., from the Coupled Model Intercomparison Project Phase 6 (CMIP6, @Oneil_2016) and Inter-Sectoral Impact Model Intercomparison Project (ISIMIP, @Warszawski_2014)) to project shocks that can be applied to agricultural productivity changes at the country-level for use in economic models. The historical and future projections use gridded, country-crop specific monthly growing season precipitation and temperature data, aggregated to the national level, weighted by cropland area derived from MIRCA [@Portmann_2010]. These annual, country, crop-specific yield shocks can be aggregated to different definitions of regions, crop commodities, and time periods, as needed by specific economic models. `gaia` serves as a lightweight, powerful model that can aid exploration of crop yields responses under a broad range of future climate projections, enhancing human-Earth system analysis capabilities.


# Statement of need

Agricultural production is highly responsive to annual weather patterns, which are becoming increasingly variable in response to climate change (e.g. @Iizumi_2016). Agricultural markets are global, with significant volumes of international trade, and yield shocks due to this variability in one region will therefore impact others. In addition, agricultural production is closely connected with energy and water sectors. Improving the representation of agricultural production in global multi-sector dynamics models is the key to better understanding economic impacts of climate change that account for human-Earth system interactions. To better represent future agricultural production and study these interactions, multisector dynamics models, such as the Global Change Analysis Model (GCAM, @Calvin_2019, @GCAM_Documentation_2023), require projections of yield responses to changing weather patterns, which are key drivers of production and vital to understanding the co-evolution of energy, water, and land systems.
Agricultural production is highly responsive to annual weather patterns, which are becoming increasingly variable in response to climate change (e.g. @Iizumi_2016). Agricultural markets are global, with significant volumes of international trade, and yield shocks due to this variability in one region will therefore impact others. In addition, agricultural production is closely connected with energy and water sectors. Improving the representation of agricultural production and their yield responses to changing weather patterns in global multi-sector dynamics models, such as the Global Change Analysis Model (GCAM, @Calvin_2019, @GCAM_Documentation_2023), is key to better understanding economic impacts of climate change that account for human-Earth system interactions.

Most economic, multisectoral modeling of climate change impacts on agriculture has relied on the representation of the effects of long term, gradual trends in temperature and precipitation on crop yields for a few key crops [@von-Lampe_2014]. Improved understanding of the effects of climate change on agricultural production requires projections of the impacts of annual weather changes on a broad range of crops for a range of climate projections [@Ray_2015]. However, the current crop modeling landscape lacks globally comprehensive, computationally efficient, validated models capable of simulating yield responses to both inter-annual variability and long-term trends across a wide range of climate change scenarios and crop types [@Waldhoff_2020]. To address the gap, we have developed `gaia`, which uses the empirical model described in @Waldhoff_2020. `gaia` produces projections of both future annual variations and long-term trends in yield changes at the country-level for a wide range of crops (cassava, cotton, maize, rice, potatoes, sorghum, soybean, sugar beet, sugarcane, sunflower, and wheat) using gridded monthly temperature and precipitation inputs for any future climate scenario.
Most economic, multisectoral modeling of climate change impacts on agriculture address only the long-term trends in temperature and precipitation effects on crop yields for a few key crops [@von-Lampe_2014]. There is a need to include projections of the impacts of inter-annual weather changes on yield responses for multiple crop under a wide range of climate projections [@Ray_2015]. However, the current crop modeling landscape lacks globally comprehensive, computationally efficient, validated models capable of the aforementioned needs [@Waldhoff_2020]. To address the gap, we have developed `gaia`, which uses the empirical model described in @Waldhoff_2020. `gaia` produces projections of both future annual variations and long-term trends in yield changes at the country-level for a wide range of crops (cassava, cotton, maize, rice, potatoes, sorghum, soybean, sugar beet, sugarcane, sunflower, and wheat) using gridded monthly temperature and precipitation inputs for any future climate scenario.


# States of the Field

The exploration of effects of future climate change on agricultural production is crucial for providing insights into global food, energy, water, and economic development. Various crop models, including process-based and empirical models, have been developed to simulate crop yields under different climate scenarios [@Chapagain_2022; @Rauff_2015]. @Muller_2017 conducted a global gridded crop model (GGCM) intercomparison experiment involving 14 process-based crop models, which allow users to simulate diverse crop management options, soil types, and weather conditions. However, GGCMs require large amounts of site-specific data for calibration, making extension to many crops and regions more challenging [@Muller_2017]. In addition, these models can take significant time to run and the yield shock projections are often available for only a limited number of climate change scenarios.

These considerations may limit the usefulness of yield changes from process models as inputs to global economic, multisector models, which include a wider range of crops and many future climate scenarios. In the multisector dynamics modeling field, there is a need for projections of future crop yield shocks due to changing climate and weather patterns that can strike a balance between simulation fidelity and lightweight modeling capabilities. Such models are essential for exploring a wide range of future climate scenarios with global coverage. `gaia` achieves this balance by employing computationally efficient statistical methods to model 12 major crops globally, while maintaining the sensitivity to capture both gradual climate changes and interannual variability impacts on crop yields. In addition, users can estimate yield shocks for additional crops by providing the appropriate input data.
These considerations may limit the usefulness of yield changes from process models as inputs to global economic, multisector models, which include a wider range of crops and many future climate scenarios. `gaia` achieves this balance by employing computationally efficient statistical methods to model 12 major crops globally, while maintaining the sensitivity to capture both gradual climate changes and interannual variability impacts on crop yields. In addition, users can estimate yield shocks for additional crops by providing the appropriate input data.


# Functionality

`gaia` is designed as an empirical model, which is driven by monthly average growing season temperature and precipitation, integrated into an efficient modular structure. This architecture streamlines the entire workflow, from initial climate model and crop yield data inputs and processing, through empirical model fitting, yield shock projections under future climate scenarios, to the calculation of agricultural productivity changes for GCAM. The modular design also facilitates comprehensive diagnostic outputs, enhancing the tool’s utility for researchers and decision makers.

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 (\autoref{fig:workflow}). Detailed instructions on `gaia` can be accessed at https://jgcri.github.io/gaia.

The primary functionality of `gaia` is encapsulated in the yield_impact wrapper function that streamlines the entire workflow shown in \autoref{fig:workflow}. The modular design also facilitates comprehensive diagnostic outputs, enhancing the tool’s utility for researchers and decision makers. Users can also execute individual functions to work through the main steps of the process. Detailed instructions on `gaia` can be accessed at https://jgcri.github.io/gaia.

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_calenders`: Generates crop planting months for each country and crop based on crop calendar data [@Sacks_2010].
Expand Down
Loading

0 comments on commit 6e3120a

Please sign in to comment.