knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
#Automatically write R package citation entries to a .bib file knitr::write_bib(c(.packages(), 'chillR', 'dplyr', 'ggplot2', 'kableExtra', 'dormancyR'), 'packages.bib') require(tidyverse) require(kableExtra)
Winter chill directly affects tree dormancy and therefore the cultivation of deciduous fruit and nut trees [@Campoyetal2011; @Faustetal1997; @Lang1987]. To quantify chill, researchers have developed a number of mathematical models that only use temperatures as input [@Luedeling2012]. These models are normally used in orchard planing and management [@Luedeling2012]. For example, a common practice in orchard planing is to compare the historic availability of winter chill in a place with the Chill Requirement of the species and cultivar of interest to overcome winter dormancy.
In warm winter climates (e.g. Mediterranean), the cultivation of deciduous fruit trees relies on the use of chemical substances such as hydrogen cyanamide (HC) that help overcoming dormancy stage [@Perez2009]. This is based on the low chill availability in such kind of climates [@Luedeling2012]. Knowing the correct moment of application is crucial to obtain adequate results. For this aim, farmers rely on chill models to estimate the accumulation of chill during a given winter [@Luedeling2012]. In this vignette, I will show one example on how to use functions from the dormancyR
[@R-dormancyR] package to handle weather data downloaded from Chilean databases. Then, I will use these data to perform an analysis on chill accumulation by using a number of chill models in both the dormancyR
[@R-dormancyR] and the chillR
[@R-chillR] package.
First, install the package from the github repository and load it by using the library
function.
#devtools::install_github("EduardoFernandezC/dormancyR") library(dormancyR)
Usually, accessible weather data is difficult to use due to format issues. dormancyR
contains a dataframe from a Chilean database to serve as example.
agromet_weather_data
knitr::kable(head(agromet_weather_data[1 : 6], 5)) %>% kableExtra::kable_styling(bootstrap_options = "condensed")
This data set shows hourly records for r colnames(agromet_weather_data)[2]
, r colnames(agromet_weather_data)[3]
, r colnames(agromet_weather_data)[4]
, r colnames(agromet_weather_data)[5]
and r colnames(agromet_weather_data)[6]
(additional variables can be found in the main website) between 1 May 2019 and 31 August 2019. This period is considered as the most plausible dormancy season for sweet cherries in Quillota, Chile. The data were recorded by a weather station located about 10 km of Quillota town.
To get the data in a user-friendly format, dormancyR
includes the function handle_agromet_chile
. The output format is compatible withe the chillR
format [@R-chillR]. Since chill models only use temperature as input variable, we can request only Temp in vars
parameter when calling the function. Additionally, in agricultural studies in general it is useful to compute the day of the year. This can be done applying the function make_JDay
from chillR
.
data <- handle_agromet_chile(agromet_weather_data, vars = "Temp") data <- chillR::make_JDay(data)
knitr::kable(head(data, 10)) %>% kableExtra::kable_styling(bootstrap_options = "condensed")
The later step returns a dataframe of weather data in the chillR
format. However, as usual, the dataframe might contains some missing data points. perc_complete
from dormancyR
computes the total percentage of data complete in each column of any dataframe.
perc_complete <- perc_complete(data) knitr::kable(perc_complete(data)) %>% kableExtra::kable_styling(bootstrap_options = "condensed")
In this case, the variable selected presents r paste(round(perc_complete[which(perc_complete$variable == "Temp"), 2], 1), "%", sep = "")
of data complete. Since no missing records were found in the example dataframe, the next step is to compute chill metrics according to different chill models in both the chillR
and dormancyR
libraries. As the example is designed to monitor daily chill accumulation, we can compute accumulated chill over the period of interest.
models <- list(`Dynamic Model` = chillR::Dynamic_Model, `Chilling Hours`= chillR::Chilling_Hours, `Positive Utah` = positive_utah_model, `North Carolina` = north_carolina_model) for (m in 1 : length(models)) { data[, names(models)[m]] <- do.call(models[[m]], list(data$Temp))}
knitr::kable(head(data, 10)) %>% kableExtra::kable_styling(bootstrap_options = "condensed")
The output is a dataframe containing accumulated chill during the winter season. The names of the columns for the chill models are defined in the list models
. Please note that Chill_portions, and Chilling_hours stand for Dynamic [@Fishmanetal1987a; @Fishmanetal1987b; @Erezetal1990] and Chilling Hours [@Weinberger1950] models programmed in chillR
. On the other hand, Positive_Utah_units, and North_Carolina_units stand for Positive Utah [@Linsley-Noakesetal1994] and North Carolina [@ShaltoutandUnrath1983] models respectively, which are programmed in dormancyR
. To use other chill models that use hourly temperature please see the documentation of the dormancyR
package.
After this analysis, a farmer or farm adviser could plot the chill accumulated during winter to get an idea of the time when a given percentage of chill has been accumulated in a particular season. In this regard, this could support the decision about the moment of spraying dormancy breaker agents. To do this, this vignette shows one example by using the ggplot2
package [@R-ggplot2]. One option is to plot the data by using geom_line
comparing the outputs from different chill models.
First, it is important to have the data in an adequate format. To this end, it is useful to have the date column in the dataframe. This can be done by applying the JDay_to_date
from dormancyR
.
data["Date"] <- JDay_to_date(data$JDay, year = 2019)
data_gather <- tidyr::pivot_longer(data, c("Dynamic Model", "Chilling Hours", "Positive Utah", "North Carolina"), names_to = "Chill Model", values_to = "Chill") ggplot(data_gather, aes(as.Date(Date), Chill)) + geom_line() + labs(x = "Date", y = "Chill accumulation (in each model unit)") + facet_wrap(~ `Chill Model`, scales = "free_y") + theme_bw()
Other option may be to obtain the total accumulation for the winter 2019 in Quillota, Chile.
total <- data_gather %>% group_by(`Chill Model`) %>% summarise(`Total chill` = round(max(Chill), 1)) knitr::kable(total) %>% kableExtra::kable_styling(bootstrap_options = "condensed")
dormancyR
provides functions, such as handle_agromet_chile
, to manage weather data and get it in an adequate format to compute relevant horticultural metrics. Most weather databases are not always performed in an user-friendly way and for most people. Moreover, after getting the data, commonly used programming interfaces do not ease the application of analysis such as those covered in this example. dormancyR
aims to close the gap between getting the data in useful formats and computing relevant horticultural analysis such as the estimation of winter chill availability by using several modeling approaches. In this regard, dormancyR
aims to help horticultural stakeholders in the decision-making process.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.