make_daily_chill_plot: Plot daily climate metric accumulation throughout the year

Description Usage Arguments Details Value Author(s) Examples

View source: R/make_daily_chill_plot.R

Description

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.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
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
)

Arguments

daily_chill

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.

metrics

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.

startdate

the first day of the season for which the metrics are to be summarized (as a Julian date = day of the year)

enddate

the last day of the season for which the metrics are to be summarized (as a Julian date = day of the year)

useyears

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.

metriclabels

Character vector with labels for each metric to be analyzed. Defaults to NA, which means that the strings passed as metrics will be used.

focusyears

Numeric vector containing the years that are to be highlighted in the plot. Years for which no data are available are automatically removed.

cumulative

Boolean argument (TRUE or FALSE) indicating whether the climate metric should be shown as daily accumulation rates or as cumulative accumulation.

image_type

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.

outpath

Path to the folder where the images should be saved. Should include a trailing "/". The folder must already exists.

filename

Suffix of the filenames for output graph files. These will be amended by the name of the metric and by the file extension.

fonttype

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

title of the plot (if unhappy with the default).

plotylim

numeric vector of length 2 indicating the extent of the y axis. Defaults to NA, which means that y limits are determined automatically.

Details

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.

Value

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.

Author(s)

Eike Luedeling

Examples

1
2
3
4
5
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)

 

chillR documentation built on Jan. 11, 2022, 5:07 p.m.