This function enables to retrieve daily weather data from NASA POWER source for each environment and derive environmental covariates over non-overlapping time windows, which can be defined in various ways by the user. The user can also provide own daily weather data, even for only part of the total number of environments. For the remaining environments, weather data will be retrieved using the NASA POWER query.

get_ECs(
  info_environments,
  raw_weather_data = NULL,
  method_ECs_intervals = "fixed_nb_windows_across_env",
  save_daily_weather_tables = T,
  path_data = NULL,
  crop_model = NULL,
  nb_windows_intervals = 10,
  duration_time_window_days = 10,
  base_temperature = 10,
  max_temperature = 30,
  capped_max_temperature = F,
  intervals_growth_manual = NULL,
  only_get_daily_data = FALSE,
  et0 = F,
  ...
)

Arguments

info_environments

a data.frame with the following columns:

  1. year: numeric Year label of the environment

  2. location: character Name of the location

  3. longitude: numeric longitude of the environment

  4. latitude: numeric latitude of the environment

  5. IDenv: character ID of the environment (location-year)

  6. planting.date: (optional) Date YYYY-MM-DD

  7. harvest.date: (optional) Date YYYY-MM-DD

  • The data.frame should contain as many rows as Year x Location combinations which will be used in pheno_new.

raw_weather_data

a data.frame which contains the following mandatory columns:

  1. longitude numeric

  2. latitude numeric

  3. year numeric

  4. location character

  5. YYYYMMDD Date Date of the daily observation written as YYYY-MM-DD

  6. IDenv character Environmt ID written Location_Year

  7. T2M numeric Average mean temperature (degree Celsius)

  8. T2M_MIN numeric Min. temperature (degree Celsius)

  9. T2M_MAX numeric Max. temperature (degree Celsius)

  10. PRECTOTCORR numeric Total daily precipitation (mm)

Additional weather data provided by user must be a subset of the following weather variable names (= next columns): (Any imputation step should be performed before providing this daily weather dataset to the package. ):

  1. RH2M numeric Daily mean relative humidity (%)

  2. RH2M_MIN numeric Daily minimum relative humidity (%)

  3. RH2M_MAX numeric Daily maximum relative humidity (%)

  4. daily_solar_radiation numeric daily solar radiation (MJ/m^2/day)

  5. T2MDEW numeric Dew Point (°C)

Default is NULL.

method_ECs_intervals

character A method among the four available:

  1. user_defined_intervals: if chosem the user must provide a data.frame intervals_growth_manual, described as parameter.

  2. GDD: day-intervals are determined based on growing degree days estimation, given a crop_model (argument must be provided).

  3. fixed_nb_windows_across_env: in each environment, the growing season is split into a number of windows equal to nb_windows_intervals.

  4. fixed_length_time_windows_across_env: in each environment, the growing season is divided into windows which always span the same length determined by the argument duration_time_window_days.

Default method is fixed_nb_windows_across_env.

save_daily_weather_tables

logical indicates whether the daily weather tables should be saved. Default is TRUE.

path_data

character Path of the folder where a RDS object will be created to save the daily weather tables if saved. (Do not use a Slash after the name of the last folder.)

crop_model

character A crop_model among those implemented in gdd_information(). This argument is necessary only when the method_ECs_intervals called is "GDD". Default is NULL.

nb_windows_intervals

numeric Number of day-windows covering the growing season length (common number of day-windows across all environments). This argument is used if the default option for method_ECs_intervals is used ('fixed_nb_windows_across_env'). Default is 10.

duration_time_window_days

This argument is used only when the option 'fixed_length_time_windows_across_env' is chosen. It determines the fixed number of days spanned within each window, across all environments. Default value is 10.

base_temperature

numeric It can be chosen by the user, to calculate GDD more accurately, based on the crop. Default value is 10 degree Celsius. Base temperature will always be used by default.

max_temperature

numeric It can be chosen by the user, to calculate GDD by capping max temperature above this given threshold, based on the crop. Default value is 30 degree Celsius. By default, it is not used.

intervals_growth_manual

data.frame which is required only if the method_ECs_intervals chosen is "user_defined_intervals".

  • column 1: numeric year

  • column 2: character location

  • columns 3 and +: numeric Date (in Days after Planting) at which the crop enters a new growth stage in a given environment. "P" refers to the planting date and should contain 0 as value, "VE" to emergence, etc... Day 0 (Planting Date, denoted "P") should be in the third column. At least 4 columns should be in this data.frame. There is no need to indicate the column "Harvest" - already considered in the function. An example of how this data.frame should be provided is given in intervals_growth_manual_G2F.
    Default is NULL.

only_get_daily_data

logical Only get daily weather data

...

Arguments passed to the compute_EC() function.

fixed_length_time_windows_across_env

logical indicates if the growing season lengths should be divided in non-overlapping time windows of fixed lengths (in days) across all environments. This implies that the total number of time windows, which need to be common across all environments, is determined by the shortest growing season included in the MET environments. This further implies that the total growing season may not be covered by the environmental predictors for the longest growing seasons.
Default is TRUE.

fixed_nb_windows_across_env

logical indicates if the growing season lengths should be divided in a fixed number of non-overlapping windows, which fully cover the growing season of each environment. This means that these time windows might not be of same length across environments (but always of same length in one environment).
Default is FALSE.

Value

A data.frame object containing the weather-based environmental covariates.

References

Sparks AH (2018). “nasapower: a NASA POWER global meteorology, surface solar energy and climatology data client for R.” Journal of Open Source Software, 3 (30), 1035.

Author

Cathy C. Westhues cathy.jubin@uni-goettingen.de