This function generates a plot of the accumulation of a climate metric throughout the year. Its standard output are the mean daily accumulation and the standard deviation. It is also possible to add one or several so-called focusyears to add the daily accumulation during these years to the plots. Plots can be produced in R or directly exported as .png files.
make_daily_chill_plot(
daily_chill,
metrics = NA,
startdate = 1,
enddate = 366,
useyears = NA,
metriclabels = NA,
focusyears = "none",
cumulative = FALSE,
image_type = NA,
outpath = NA,
filename = NA,
fonttype = "serif",
title = NA,
plotylim = NA
)
The main purpose of the function is a side effect - plots of daily climate metric accumulation. However, all the data used for making the plots is returned as a list containing an element for each metric, which consists of a data.table with the daily means, standard deviation and daily values for all focusyears.
a daily chill object generated with the daily_chill function, which can calculate several standard chilling metrics or be supplied with user-written temperature models. Since the format for the input file must meet certain requirements, I recommend that you follow the steps shown in the example below to prepare it.
list of the metrics to be evaluated. This defaults to NA, in which case the function makes a guess on what metrics you want to calculated. This is done by choosing all column headers that are not required for a daily_chill object.
the first day of the season for which the metrics are to be summarized (as a Julian date = day of the year)
the last day of the season for which the metrics are to be summarized (as a Julian date = day of the year)
if only certain years are to be used, these can be provided here as a numeric vector. Defaults to NA, which means all years in the daily_chill object are used.
Character vector with labels for each metric to be analyzed. Defaults to NA, which means that the strings passed as metrics will be used.
Numeric vector containing the years that are to be highlighted in the plot. Years for which no data are available are automatically removed.
Boolean argument (TRUE or FALSE) indicating whether the climate metric should be shown as daily accumulation rates or as cumulative accumulation.
Character string indicating the file format that should be output. Image files are only produced for the moment, if this is "png". All other values, as well as the default NA lead to output as an R plot only.
Path to the folder where the images should be saved. Should include a trailing "/". The folder must already exists.
Suffix of the filenames for output graph files. These will be amended by the name of the metric and by the file extension.
The type of font to be used for the figures. Can be 'serif' (default) for a Times New Roman like font, 'sans' for an Arial type font or 'mono' for a typewriter type font.
title of the plot (if unhappy with the default).
numeric vector of length 2 indicating the extent of the y axis. Defaults to NA, which means that y limits are determined automatically.
Eike Luedeling
Plots daily accumulation of climatic metrics, such as winter chill, as daily accumulation rates or as cumulative accumulation. A legend is only added, when focusyears are also shown. Otherwise the plot is reasonably self-explanatory.
day_chill<-make_daily_chill_plot(daily_chill(stack_hourly_temps(fix_weather(
KA_weather[which(KA_weather$Year>2005),])),
running_mean=11),focusyears=c(2001,2005),cumulative=TRUE,startdate=300,enddate=30)
Run the code above in your browser using DataLab