Skip to content

User Guide responses #10

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
jrising opened this issue Jan 14, 2025 · 11 comments
Open

User Guide responses #10

jrising opened this issue Jan 14, 2025 · 11 comments

Comments

@jrising
Copy link

jrising commented Jan 14, 2025

openjournals/joss-reviews#7538

These comments refer to the User Guide vignette (https://jgcri.github.io/gaia/articles/vignette.html).

  • What is the CMIP-ISIMIP format? I am not familiar with this data format: please provide a reference to a specification (also include this in example 2). Also, I wouldn't use raw CMIP data-- one needs downscaled data. Do you mean the protocol data produced for GGCMI?
  • Sacks et al., (2020) link is broken. Also, that paper is from 2010, not 2020.
  • Sacks et al. reports day-of-year, not month-level crop calendars (as referred in the text). While the Waldhoff paper derives predictors from month-level data, much other work starts with daily data, so presumably you don't want to drop to month-level.
  • The user guide should include installation instructions.
  • It is very odd that you are translating data to ".txt format". This isn't even a format-- the extension just suggests that the file has some kind of text encoding.
  • Why do you recommend the use of WATCH climate observations? This is a very old dataset, based on an outdated ERA model, and you only need temperature and precipitation anyway.
  • It is odd that Example 1 under Run gaia! uses both Example 1 and Example 2 from the climate data section. If both are required, then these are not separate examples.
  • Run gaia! Example 2 refers to weighted climate data from Example Climate Data Example 2, but Example Climate Data Example 2 does not refer to weighted data.
  • It seems like Run gaia! Example 3 is just more information on the API and diagnostic outputs. It should be presented as such.
@jrising
Copy link
Author

jrising commented Jan 15, 2025

  • output_dir <- file.path(getwd(), 'gaia_output')
    : This is identical to output_dir <- 'gaia_output'.
  • Most research that might want to use gaia will not be at the country level. Is this possible?
  • weighted_climate: What happens if the weather data does not cover all countries?
  • There is a printed error in the user guide under weighted_climate.
  • crop_calendars: You don't explain what this function does. I think it outputs the crop calendars-- possibly both as a return value and to the output directory?
  • You say that new crops can be added to the crop calendar under the existing format. I think you mean that one should add an additional column, filled with 0s, and then additional rows with 1 in that column for each country, and then fill in plan and harvest. It's not clear from the example of plant and harvest months are 1-based or 0-based. It's also not clear where this should be added-- maybe you mean that crop_calendars produces the default crop_calendar, but one wouldn't run it if one has a modified crop calendar with additional crops?
  • Table 3: Why does the output produced by data_aggregation have a separate yield for each month? What is grow_season? I can guess the others, but they should be defined. Why does Table 3 have temp and precip if the weather data is intended for table 4?
  • Table 4: What are the min and max calculated over? Is it over mean monthly temperature and total monthly precip?
  • yield_regression: Report the default yield regression used here.
  • Report the meaning of the output values for yield_shock_projection. I'm guessing it's the ratio of projected yields in each year to the projected yield in the base year.

@jrising
Copy link
Author

jrising commented Jan 15, 2025

General comments:

  • Based on the User Guide, this strikes me as more as a repo repository than a tool. It is not clear that the provided functions can be used for a different project, and we are only given examples that are part of a single workstream.
  • Although the guide mentions in multiple places that inputs can be changed-- as long as they follow the same format-- the user guide does not particularly facilitate. The formats aren't provided, and it's often not clear how changes at one point will affect things later on. Someone just has to follow the single workstream and hope for the best.
  • The regression uses a log dependent variable, so a weighted average isn't theoretically justified. It's okay at higher resolutions, but at the country level, you end up with a log-sum-exp problem.
  • It should be clarified that projected climate data needs to be BCSD relative to the same observational dataset used in the regression.
  • Standard errors are reported in the regression, but I don't see how uncertainty is handled. Ignoring it wouldn't be consistent with the regression results.

@mengqi-z
Copy link
Collaborator

@jrising - Thank you for your comments! We are working on addressing the issues you've highlighted and preparing responses to some questions you've raised. Thanks for the time and effort you put into reviewing our work!

@jrising
Copy link
Author

jrising commented Jan 16, 2025

One more point: I was trying to follow the vignette, but the second example download (to https://zenodo.org/records/13976521/files/gaia_example_climate.zip) has timed out on me 5 times. I suggest you offer an option for people to download the files outside of that function, or reduce the size.

mengqi-z added a commit that referenced this issue Jan 28, 2025
mengqi-z added a commit that referenced this issue Jan 28, 2025
For #10

Update to clarify several instructions and languages in the user guides
mengqi-z added a commit that referenced this issue Jan 28, 2025
mengqi-z added a commit that referenced this issue Jan 28, 2025
For #10

Better clarify the differences between two output tables and add explanations of the variables in the outputs
mengqi-z added a commit that referenced this issue Feb 14, 2025
For #11 #10

- flexibility to use user provided crop calendar
- flexibility to select crops
- updated to the latest FAO data
- updated with FAO crop to MIRCA2000 crop mapping
- updated default MIRCA2000 crops to GCAM commodity mapping
- make cleaning sage data its own function
mengqi-z added a commit that referenced this issue Feb 14, 2025
mengqi-z added a commit that referenced this issue Feb 17, 2025
For #10
Added more instruction on adding crops to crop calendar
@mengqi-z
Copy link
Collaborator

Dear @jrising,

Thank you so much for your detailed review of gaia. Your feedback has been so helpful for us in improving its functionality, documentation, and overall user experience! I have addressed most of your comments in different commits that listed above. Here is a summary of the major updates:

  1. Enhanced the overall user guide and clarified the purpose of each example to help users determine which example to follow/adapt to best suits their research needs.
  2. Added details on the example climate data, including explanations of raw CMIP6 versus ISIMIP-processed CMIP6 data and the required climate data format for gaia.
  3. Provided additional explanations on both intermediate and final model outputs.
  4. Updated the crop_calendars function to support more crop selections and included example code to guide users in modifying crop calendar data.
  5. Improved the documentation of input data sources in the code.
  6. Reduced the size of the example climate dataset to minimize download errors and improve testing efficiency.
  7. Removed unnecessary files from the repository.

The followings are more detailed response to specific comments.

Why do you recommend the use of WATCH climate observations? This is a very old dataset, based on an outdated ERA model, and you only need temperature and precipitation anyway.

We appreciate the reviewer’s feedback regarding the WATCH dataset. We used the WATCH dataset because this is the same climate data used in Waldhoff et al., 2020 study, which developed the core approach embedded in gaia. However, we agreed with the reviewer that the WATCH dataset may be considered outdated. We have revised the tutorial language to remind users the options to choose alternative historical climate datasets. Please see commit 8876557.

It is odd that Example 1 under Run gaia! uses both Example 1 and Example 2 from the climate data section. If both are required, then these are not separate examples.

The historical cropland-weighted climate data used in both Example 1 and Example 2 is sourced from example-data-1. The key difference between Examples 1 and 2 lies in the projected climate data: Example 1 utilizes a small-sized, cropland-weighted future climate dataset if users want to do a quick test of gaia, whereas Example 2 relies on larger climate NetCDF files and would take longer time to run and it is for those who would like to reproduce similar experiment but with their own NetCDF data. To avoid redundant downloads of the historical data, we put all cropland-weighted climate data within example-data-1.
We have revised the Example Data section to make this clearer. Please see commit 8876557.

Most research that might want to use gaia will not be at the country level. Is this possible?

Thanks for your question. Currently, gaia supports outputs at both the country level and the region-basin level (specifically for the Global Change Analysis Model GCAM). The methodology is limited to the country scale because the model relies on global crop yield data from FAOSTAT, which is typically available at the country scale. Additionally, gaia was designed primarily to support global multisector dynamics models and integrated assessment models, which generally operate at the country level or even coarser scales.

weighted_climate: What happens if the weather data does not cover all countries?

Thank you for your question. gaia requires weather data with global coverage to get the best results. If the data does not have global coverage, the model will encounter missing weather information for certain crop types that may cause error and it will have less data for empirical fitting.

Table 3: Why does the output produced by data_aggregation have a separate yield for each month? What is grow_season? I can guess the others, but they should be defined. Why does Table 3 have temp and precip if the weather data is intended for table 4?

Thanks for your question. The annual yield varies by country, crop, and year. The data is formatted to show the monthly information on growing season, precipitation and temperature, so the annual yield is repeatedly showing at the monthly time step. Table 3 is for historical information and Table 4 is for the future weather. We have added more explanations in the section for clarity. Please see commit 6e0153a.

Table 4: What are the min and max calculated over? Is it over mean monthly temperature and total monthly precip?

Thanks for your question. The min, max, and mean temperature and precipitation are all calculated based on cropland-weighted monthly temperature and precipitation for each year. We added explanations for the outputs. Please see commit 6e0153a.

Report the meaning of the output values for yield_shock_projection. I'm guessing it's the ratio of projected yields in each year to the projected yield in the base year.

Thank you. The yield shock is the fractional change in the yield of a given crop grown in a specific country in a future period compared to the baseline yield expected under stable climate conditions. We have added explanations of yield shock in this section. Please see commit b8b2ad5.

Based on the User Guide, this strikes me as more as a repo repository than a tool. It is not clear that the provided functions can be used for a different project, and we are only given examples that are part of a single workstream.

Thank you for your comment. The primary goal of this model is to equip researchers with tools to estimate country-level yield shocks under different future climate forcings using a peer-reviewed methodology. Gaia is designed as a crop model with built-in capabilities to processes, clean, and format climate data, global crop data (e.g., yield, planting, and harvesting) and outputs.

A key advantage of gaia is that it simplifies complex processes for researchers who may not have extensive experience in data manipulation or model development. It provides seamless integration for visualizing results and processing outputs in a format compatible with different versions of GCAM, which has a broad user community.

In addition, the provided functions are modular and adaptable for different projects that require country level yield shocks. Users can customize the inputs and workflow to suit their specific research needs, such as configuring the model, fitting the model with different climate and socioeconomic scenarios, CO2 emission trajectories, adding more crops, select time series of interest, and specifying the output options.

I was trying to follow the vignette, but the second example download (to https://zenodo.org/records/13976521/files/gaia_example_climate.zip) has timed out on me 5 times. I suggest you offer an option for people to download the files outside of that function, or reduce the size.

Thank you for pointing that out. To make the example data more suitable for download, we have reduced the size of the climate NetCDF file by shortening the time coverage from 2015-2100 to 2015-2030. This adjustment reduces the ZIP file size from 1.4 GB to 261 MB. Users who would like to try the full 21st-century time series can use the alternative dataset, example-data-1. We have also offered two options to download the data in the user guide, including through download URL link and through gaia's get_example_data function.

@jrising
Copy link
Author

jrising commented Feb 20, 2025

This is just a quick comment to thank you for your responses. I can't go through them now, but I will respond in a couple weeks.

@jrising
Copy link
Author

jrising commented Mar 10, 2025

Thank you for your responses. Most of these are fine, but I still have the following concerns:

Re: "CMIP-ISIMIP format": The link directs one to the protocol for simulation formatting, not input climate formatting. Also, it is a 17 page document. If the goal to for users to be able to provide their own data, the specific requirements needed for gaia should be specified. Also, the new text "Processes CMIP climate NetCDF data in accordance with the ISIMIP simulation protocols" suggests that you are processing data in accordance with the protocols, not that the data is in accordance with the protocols.

Re: "Run gaia! Example 3": This is still confusing. You label it an example. Presumably, you intend for it to be an example of how to use gaia, so what is the goal of the example and how do I follow it?

Re: adding new crop calendars: Table 3 shows 0's for every row under the oil_palm column, because only the first 10 rows are included.

I don't see responses to the following questions:

  • Although the guide mentions in multiple places that inputs can be changed-- as long as they follow the same format-- the user guide does not particularly facilitate. The formats aren't provided, and it's often not clear how changes at one point will affect things later on. Someone just has to follow the single workstream and hope for the best.
  • The regression uses a log dependent variable, so a weighted average isn't theoretically justified. It's okay at higher resolutions, but at the country level, you end up with a log-sum-exp problem.
  • It should be clarified that projected climate data needs to be BCSD relative to the same observational dataset used in the regression.
  • Standard errors are reported in the regression, but I don't see how uncertainty is handled. Ignoring it wouldn't be consistent with the regression results.

Additional issues trying to run the vignette:

  • In the Run gaia! Example 1 yield_impact command,base_year = 2015 does not end with a comma.
  • I get the following error when I run either Run gaia! Example 1 or Example 2:
...
column names: iso, wheat, maize, rice, sorghum, soybean, sunflower, root_tuber, cassava, sugarcane, sugarbeet, cotton, plant, harvest
[1] "Merged historical yield data saved to: ~/research/reviews/gaia/gaia_output/data_processed/historic_vars_wheat.csv"
[1] "Merged historical yield data saved to: ~/research/reviews/gaia/gaia_output/data_processed/historic_vars_maize.csv"
[1] "Merged historical yield data saved to: ~/research/reviews/gaia/gaia_output/data_processed/historic_vars_rice.csv"
[1] "Merged historical yield data saved to: ~/research/reviews/gaia/gaia_output/data_processed/historic_vars_sorghum.csv"
[1] "Merged historical yield data saved to: ~/research/reviews/gaia/gaia_output/data_processed/historic_vars_soybean.csv"
[1] "Merged historical yield data saved to: ~/research/reviews/gaia/gaia_output/data_processed/historic_vars_sunflower.csv"
[1] "Merged historical yield data saved to: ~/research/reviews/gaia/gaia_output/data_processed/historic_vars_root_tuber.csv"
[1] "Merged historical yield data saved to: ~/research/reviews/gaia/gaia_output/data_processed/historic_vars_cassava.csv"
[1] "Merged historical yield data saved to: ~/research/reviews/gaia/gaia_output/data_processed/historic_vars_sugarcane.csv"
[1] "Merged historical yield data saved to: ~/research/reviews/gaia/gaia_output/data_processed/historic_vars_sugarbeet.csv"
[1] "Merged historical yield data saved to: ~/research/reviews/gaia/gaia_output/data_processed/historic_vars_cotton.csv"
Error in data.table::fread(file, skip = 0, stringsAsFactors = FALSE, header = TRUE) : 
  input= must be a single character string containing a file name, a system command containing at least one space, a URL starting 'http[s]://', 'ftp[s]://' or 'file://', or, the input data itself containing at least one \n or \r

mengqi-z added a commit that referenced this issue Mar 11, 2025
mengqi-z added a commit that referenced this issue Mar 11, 2025
For #10

- Rename example 3 to be explore output to clarify the purpose of this section
- Update the example code provided for users to modify crop calendar, so that people can see the immediate changes decribed in Table 3
mengqi-z added a commit that referenced this issue Mar 12, 2025
For #10

Solve the error with writing processed example-data-2 into the example-data-1 folder.
@mengqi-z
Copy link
Collaborator

Dear @jrising,

Thank you for your comments. We have made several updates, as demonstrated in the linked commits above. Below are our responses to your comments:

Re: "CMIP-ISIMIP format": The link directs one to the protocol for simulation formatting, not input climate formatting. Also, it is a 17 page document. If the goal to for users to be able to provide their own data, the specific requirements needed for gaia should be specified. Also, the new text "Processes CMIP climate NetCDF data in accordance with the ISIMIP simulation protocols" suggests that you are processing data in accordance with the protocols, not that the data is in accordance with the protocols.

Thank you for your comment. The ISIMIP climate forcing data format shares similarities with the impact model simulation output format. Unfortunately, there is no dedicated ISIMIP page detailing the input climate forcing format, which is why we referenced the simulation protocols. We agree that this document is quite long. To address this, we have summarized the key formatting requirements compatible with gaia here. We've also updated the text to "Processes CMIP6 daily or monthly climate NetCDF data formatted in accordance with the ISIMIP simulation protocols."

Re: "Run gaia! Example 3": This is still confusing. You label it an example. Presumably, you intend for it to be an example of how to use gaia, so what is the goal of the example and how do I follow it?

Thank you for pointing this out. This section is intended to explain the intermediate and final outputs from running gaia. The section is organized into subsections that align with each step of the workflow, corresponding to a function, for a clearer structure. Another purpose of this section is to provide guidance on advanced application of gaia, such as customizing the crop calendar to include new crops. To address your concern, we have renamed the section from "Example 3" to "Explore Outputs", and added a brief introductory description to clarify the purpose of this section.

Re: adding new crop calendars: Table 3 shows 0's for every row under the oil_palm column, because only the first 10 rows are included.

Thank you for catching this! To keep the documentation relatively concise, we initially included only a limited number of rows for each table. We have now modified the example code to ensure that countries with newly added oil palm planting and harvesting months appear in the first 10 rows for demonstration purpose.

Although the guide mentions in multiple places that inputs can be changed-- as long as they follow the same format-- the user guide does not particularly facilitate. The formats aren't provided, and it's often not clear how changes at one point will affect things later on. Someone just has to follow the single workstream and hope for the best.

Thank you. In our last revision, we made several updates to improve this, which are summarized in our update log. Specifically:

  • We have provided detailed instructions on modifying inputs such as crop calendars.
  • We have added more resources on the required format of climate forcing data.
  • The documentation for each function includes detailed argument formats that users can follow, available here.
  • In the section Explore Outputs (previously Example 3), we have provided output tables so users can compare results and ensure they can reproduce the example.

We acknowledge that gaia has limitations regarding compatibility with different climate data sources, which is a common challenge as climate data can vary significantly across temporal and spatial scales. However, the User Guide provides full example data to demonstrate acceptable climate data formats and complete examples that allow users to verify input and output formats in case modifications are needed.

The regression uses a log dependent variable, so a weighted average isn't theoretically justified. It's okay at higher resolutions, but at the country level, you end up with a log-sum-exp problem.

We appreciate your thoroughness. However, we are unclear about what the "log-sum-exponent" problem you are referencing. In our search, we only find the LSE "trick" referenced as one used to deal with very large or small numbers, which does not seem applicable in this case. Could you please provide a reference or more detailed description of the potential issue?

It should be clarified that projected climate data needs to be BCSD relative to the same observational dataset used in the regression.

Thank you for your suggestion. We have added a note in the User Guide clarifying this requirement here.

Standard errors are reported in the regression, but I don't see how uncertainty is handled. Ignoring it wouldn't be consistent with the regression results.

Thank you for your comment. Could you clarify which specific aspect of uncertainty you are referring to? The regression model follows standard practices by using the best estimates. We’d appreciate any further details on how uncertainty should be addressed in this context.

In the Run gaia! Example 1 yield_impact command,base_year = 2015 does not end with a comma.

Thank you for catching this. We have updated the example to include the missing comma.

I get the following error when I run either Run gaia! Example 1 or Example 2:

Thank you for catching this error. The issue is caused by saving the processed climate data from example-data-2 into the weighted_climate/canesm5 folder of the downloaded example-data-1. This results in multiple weighted climate datasets with different time lengths being stored in the same folder, leading to issues when reading the climate data.

I have thoroughly updated the example codes to ensure separate output folders for Example 1 and Example 2. Please delete your current outputs and rerun the "Run gaia!" section from the beginning.

@jrising
Copy link
Author

jrising commented Mar 25, 2025

Re: log-sum-exp problem:

The problem comes from the fact that there is no pont-level data-generating process that is consistent with a log dependent variable regression. When you use different sized regions (countries), you are assuming that there is. If your regression is log(y) = f(T), but y = \sum_i w_i y_i, summing production over regions in a country, then you get log(y) = log(\sum_i w_i exp(f(T_i))). According to the log-sum-exp relationship (https://en.wikipedia.org/wiki/LogSumExp), that's approximately equal to f(T_j), where j is the largest yielding region, not f(\sum_i w_i T_i) like you use.

Re: Standard errors are reported in the regression

Standard practice when projecting econometric results under future climate is to report uncertainty around the final projection, as driven by uncertainty in the underlying coefficients. The normal way to do this is by taking Monte Carlo draws from the multivariate normal distribution of all parameters (using the variance-covariance matrix) and projecting each set of parameters, which then gives you an empirical distribution of final outcomes.

Further problems with the examples:

I was able to get the Run gaia! example 2 working with data from example 1. It may be confusing to users that the example 1 data doesn't map to the example 1 running.

I deleted all my data, updated the package, and ran the code from scratch, but when I try to do Run gaia! example 1 I get the error:

Error in data.table::fread(file, skip = 0, stringsAsFactors = FALSE, header = TRUE) : 
  input= must be a single character string containing a file name, a system command containing at least one space, a URL starting 'http[s]://', 'ftp[s]://' or 'file://', or, the input data itself containing at least one \n or \r

mengqi-z added a commit that referenced this issue Mar 25, 2025
#10

This will only filter the climate files for the right climate model, scenario, and time periods
@mengqi-z
Copy link
Collaborator

Hi @jrising,

Re: log-sum-exp problem:
Thank you for your clarification. We believe there may be a misunderstanding regarding our approach. The empirical model conducts regression at the country level using country-level yield observation data, along with cropland area-weighted country-level precipitation and temperature. Importantly, there is no aggregation from point-level yield or production data to country level.

Re: Standard errors are reported in the regression
Thank you for the explanation. The uncertainty analysis is beyond the purpose of the software. However, gaia provides all the information in the output files reg_out_[crop]_xxx.csv for users to do a Monte Carlo analysis if desired.

Re: Further problems with the examples
Thank you for testing. Could you please confirm that you have also deleted all example climate data? I suspect that your previous runs following Example 1 may have generated climate output files in the downloaded climate data folder (e.g., weighted_climate/canesm5), which could be causing the errors you encountered.

@jrising
Copy link
Author

jrising commented Apr 2, 2025

Re: log-sum-exp problem:
That is what I understood. To be clear, though, crop yields are generated by a point-level (field-level) data-generating process. Anyway, the question then is, why did you do cropland area-weighted weather variables? The theoretical justification for that, when using a linear dependent variable, is because you have a point-level data generating process. With a log dependent variable, you are (I believe) using an approach that is both empirical biased and theoretically incorrect. In any case, you are saying you have no theoretical justification, so I see two options. You could run a hind-casting empirical test (probably outside the scope of your work here publishing a software package) or include a "limitations" section of the user guide where you note that only crop-weighted weather is allowed.

Re: Standard errors are reported in the regression:
Okay, this can also be included in a "limitations" section.

Re: Further problems with the examples:
This time I deleted all folders in the gaia_output directory before running the code. Here is output from the whole process:

> library(gaia)
> 
> output_dir <- '~/research/reviews/gaia/gaia_output'
> data_dir <- gaia::get_example_data(
+   download_url = 'https://zenodo.org/records/14888816/files/weighted_climate.zip?download=1',
+   data_dir = output_dir
+ )
Starting download.
trying URL 'https://zenodo.org/records/14888816/files/weighted_climate.zip?download=1'
Content type 'application/octet-stream' length 47798548 bytes (45.6 MB)
==================================================
downloaded 45.6 MB

Download complete.
Starting unzip.
Data unzipped to: ~/research/reviews/gaia/gaia_output/weighted_climate
> 
> climate_hist_dir <- file.path(data_dir, 'climate_hist')
> climate_impact_dir <- file.path(data_dir, 'canesm5')
> 
> data_dir <- gaia::get_example_data(
+   download_url = 'https://zenodo.org/records/14888816/files/gaia_example_climate.zip?download=1',
+   data_dir = output_dir
+   )
Starting download.
trying URL 'https://zenodo.org/records/14888816/files/gaia_example_climate.zip?download=1'
Content type 'application/octet-stream' length 261537964 bytes (249.4 MB)
==================================================
downloaded 249.4 MB

Download complete.
Starting unzip.
Data unzipped to: ~/research/reviews/gaia/gaia_output/gaia_example_climate
> 
> pr_projection_file <- file.path(data_dir, 'pr_monthly_canesm5_w5e5_ssp245_2015_2030.nc')
> tas_projection_file <- file.path(data_dir, 'tas_monthly_canesm5_w5e5_ssp245_2015_2030.nc')
> 
> 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 = 'ssp245',            # 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 = 2030,                        # 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
+   crop_select = NULL,                     # set to NULL for the default crops
+   diagnostics = TRUE,                     # set to TRUE to output diagnostic plots
+   output_dir = output_dir                 # path to the output folder
+ )
No precipitation files provided. Skipping.
No temperature files provided. Skipping.
Processing irc_crop01
Processing irc_crop02
Processing irc_crop03
...
Processing rfc_crop26
The function weighted_climate is complete.
Processing: ~/research/reviews/gaia/gaia_output/gaia_example_climate/pr_monthly_canesm5_w5e5_ssp245_2015_2030.nc
Processing: ~/research/reviews/gaia/gaia_output/gaia_example_climate/tas_monthly_canesm5_w5e5_ssp245_2015_2030.nc
Processing irc_crop01
Processing irc_crop02
Processing irc_crop03
...
Processing rfc_crop26
The function weighted_climate is complete.
Starting Step: crop_calendars
[1] "Final selected crops are: wheat, maize, rice, sorghum, soybean, sunflower, root_tuber, cassava, sugarcane, sugarbeet, cotton"
Starting Step: data_aggregation
Reading data... crop_calendar.csv
789 rows
14 columns
column names: iso, wheat, maize, rice, sorghum, soybean, sunflower, root_tuber, cassava, sugarcane, sugarbeet, cotton, plant, harvest
[1] "Merged historical yield data saved to: ~/research/reviews/gaia/gaia_output/data_processed/historic_vars_wheat.csv"
[1] "Merged historical yield data saved to: ~/research/reviews/gaia/gaia_output/data_processed/historic_vars_maize.csv"
[1] "Merged historical yield data saved to: ~/research/reviews/gaia/gaia_output/data_processed/historic_vars_rice.csv"
[1] "Merged historical yield data saved to: ~/research/reviews/gaia/gaia_output/data_processed/historic_vars_sorghum.csv"
[1] "Merged historical yield data saved to: ~/research/reviews/gaia/gaia_output/data_processed/historic_vars_soybean.csv"
[1] "Merged historical yield data saved to: ~/research/reviews/gaia/gaia_output/data_processed/historic_vars_sunflower.csv"
[1] "Merged historical yield data saved to: ~/research/reviews/gaia/gaia_output/data_processed/historic_vars_root_tuber.csv"
[1] "Merged historical yield data saved to: ~/research/reviews/gaia/gaia_output/data_processed/historic_vars_cassava.csv"
[1] "Merged historical yield data saved to: ~/research/reviews/gaia/gaia_output/data_processed/historic_vars_sugarcane.csv"
[1] "Merged historical yield data saved to: ~/research/reviews/gaia/gaia_output/data_processed/historic_vars_sugarbeet.csv"
[1] "Merged historical yield data saved to: ~/research/reviews/gaia/gaia_output/data_processed/historic_vars_cotton.csv"
Error in data.table::fread(file, skip = 0, stringsAsFactors = FALSE, header = TRUE) : 
  input= must be a single character string containing a file name, a system command containing at least one space, a URL starting 'http[s]://', 'ftp[s]://' or 'file://', or, the input data itself containing at least one \n or \r
In addition: There were 50 or more warnings (use warnings() to see the first 50)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants