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:
year: numeric Year label of the environment
location: character Name of the location
longitude: numeric longitude of the environment
latitude: numeric latitude of the environment
IDenv: character ID of the environment (location-year)
planting.date: (optional) Date YYYY-MM-DD
harvest.date: (optional) Date YYYY-MM-DD
|
raw_weather_data |
a data.frame which contains the following
mandatory columns:
longitude numeric
latitude numeric
year numeric
location character
YYYYMMDD Date Date of the daily observation written as
YYYY-MM-DD
IDenv character Environmt ID written Location_Year
T2M numeric Average mean temperature (degree Celsius)
T2M_MIN numeric Min. temperature (degree Celsius)
T2M_MAX numeric Max. temperature (degree Celsius)
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. ):
RH2M numeric Daily mean relative humidity (%)
RH2M_MIN numeric Daily minimum relative humidity (%)
RH2M_MAX numeric Daily maximum relative humidity (%)
daily_solar_radiation numeric daily solar radiation
(MJ/m^2/day)
T2MDEW numeric Dew Point (°C)
Default is NULL . |
method_ECs_intervals |
character A method among the four
available:
user_defined_intervals: if chosem the user must provide a data.frame
intervals_growth_manual, described as parameter.
GDD: day-intervals are determined based on growing degree days
estimation, given a crop_model (argument must be provided).
fixed_nb_windows_across_env: in each environment,
the growing season is split into a number of windows equal to
nb_windows_intervals.
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