degday

Compute degree days from daily min and max temperatures to model growth of plants and animals.

https://github.com/ucanr-igis/degday

Science Score: 23.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
  • .zenodo.json file
  • DOI references
    Found 7 DOI reference(s) in README
  • Academic publication links
    Links to: zenodo.org
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (16.4%) to scientific vocabulary

Keywords

degree-days ipm
Last synced: 9 months ago · JSON representation

Repository

Compute degree days from daily min and max temperatures to model growth of plants and animals.

Basic Info
Statistics
  • Stars: 2
  • Watchers: 4
  • Forks: 1
  • Open Issues: 0
  • Releases: 0
Topics
degree-days ipm
Created over 4 years ago · Last pushed over 1 year ago
Metadata Files
Readme Contributing License Code of conduct

README.Rmd

---
title: Compute Degree Days
output: github_document
---



```{r, include = FALSE}
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "man/figures/README-",
  out.width = "100%"
)
```



[![CRAN status](https://www.r-pkg.org/badges/version/degday)](https://CRAN.R-project.org/package=degday) 
[![Monthly downloads](https://cranlogs.r-pkg.org/badges/degday?color=brightgreen)](https://CRAN.R-project.org/package=degday) 
[![R-Universe status badge](https://ajlyons.r-universe.dev/badges/degday)](https://ajlyons.r-universe.dev) 
[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.7083181.svg)](https://doi.org/10.5281/zenodo.7083181) 
[![degree-day-challenge: passing](https://raw.githubusercontent.com/ucanr-igis/degree-day-challenge/main/badges/degree-day-challenge-passing.svg)](https://ucanr-igis.github.io/degree-day-challenge/) 
[![R-CMD-check](https://github.com/UCANR-IGIS/degday/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/UCANR-IGIS/degday/actions/workflows/R-CMD-check.yaml) 
[![Lifecycle: stable](https://img.shields.io/badge/lifecycle-stable-brightgreen.svg)](https://lifecycle.r-lib.org/articles/stages.html#stable) 



**degday** provides formulas for estimating [degree days](https://en.wikipedia.org/wiki/Growing_degree-day) from daily minimum and maximum temperatures. Degree days are commonly used in agriculture to predict the development of plants and insects, which are strongly correlated with accumulated heat above a certain a temperature. To use the formulas, you must pass a record of daily minimum and maximum temperatures, as well as a species-dependent temperature range in which growth is possible.

Formulas are based on the work by Zalom et al ([1983](#references)) and McMaster and Wilhelm ([1997](#references)). These same formulas are used on the University of California [Integrated Pest Management](http://ipm.ucanr.edu/WEATHER/) (UC IPM) website. See the UC IPM website for additional background on [degree days](http://ipm.ucanr.edu/WEATHER/ddconcepts.html), [detailed figures and formulas](http://ipm.ucanr.edu/WEATHER/ddfigindex.html), and [models](http://www.ipm.ucdavis.edu/MODELS/) that predict growth stages of various crops and pests based on degree days.

`degday` implements all formulas from Zalom et al ([1983](#references)), including the single and double triangle methods, and the single and double sine methods. All formulas use the horizontal cutoff method. `degday` does not currently support the vertical cutoff method, nor the corrected sine and triangle methods. The simple average method is based on McMaster and Wilhelm ([1997](#references)), which allows for an optional upper threshold and supports the so-called 'corn' method for dealing with temperatures below the lower and above the upper thresholds.

You might be wondering, *which of the four estimation methods should I use?* Most people compute degree days not as an end in itself, but rather to look-up when a development milestone is predicted to take place, such as blooming for a tree crop, or larvae emergence in an insect. Hence you should use the same method that was used to build the reference table. When in doubt, use the single-sine method. For more info about the different methods, see Roltsch et al ([1999](#references)).

Degree days are sometimes referred to as *growing degree days*, which generally refers to data that drives models of specifically plant growth. Other terms that are more or less synonymous with degree days are *heat units* and *thermal units*. *Chill hours* is a related concept, but uses accumulated cold to predict plant and insect development rather than accumulated heat. Formulas for computing chill hours and chill portions may be found in [chillR](https://cran.r-project.org/package=chillR).

## Installation

`degday` can be installed from CRAN:

```
install.packages("degday")
```

The development version of `degday` is available on [r-universe](https://ajlyons.r-universe.dev/){target="_blank" rel="noopener"}. To install it, you can run:

```
options(repos = c(ajlyons = 'https://ajlyons.r-universe.dev',
                  CRAN = 'https://cloud.r-project.org'))
install.packages('degday')
```

Alternately, you can install the development version directly from [GitHub](https://github.com/ucanr-igis/degday){target="_blank" rel="noopener"}. (This requires the `remotes` package plus [RTools](https://cran.r-project.org/bin/windows/Rtools/){target="_blank" rel="noopener"} for Windows users.)

```
remotes::install_github("ucanr-igis/degday")
```

## Example

To illustrate, we can compute degree days for a sample dataset consisting of one year of minimum and maximum daily temperatures from the [Esparto.A](http://ipm.ucanr.edu/calludt.cgi/WXSTATIONDATA?MAP=yolo.html&STN=Esparto.A) CIMIS weather station in Yolo County, California.

```{r example, message=FALSE}
library(degday)
library(dplyr)

espartoa_csv <- system.file("extdata/espartoa-weather-2020.csv", package = "degday")
espartoa_temp <- read.csv(espartoa_csv) %>% mutate(date = as.Date(date))
espartoa_temp %>% head()
```

To compute degree days, we have to tell it a range of temperatures in which development occurs. We'll select 55.0°F and 93.9°F, which are the lower and upper thresholds for [Navel Orangeworm](http://ipm.ucanr.edu/PHENOLOGY/ma-navel_orangeworm.html).

```{r thresholds}
thresh_low <- 55
thresh_up <- 93.9
```

The single-triangle and single-sine methods can be computed with `dd_sng_tri()` and `dd_sng_sine()`. We can add them as columns in our table using `mutate()`:

```{r compute_single}
espartoa_dd <- espartoa_temp %>%
  mutate(sng_tri = dd_sng_tri(daily_min = tmin, daily_max = tmax, 
                              thresh_low = thresh_low, thresh_up = thresh_up),
         sng_sine = dd_sng_sine(daily_min = tmin, daily_max = tmax, 
                                thresh_low = thresh_low, thresh_up = thresh_up))

espartoa_dd %>% head()
```

To compute degree days using the double-triangle and double-sine methods, we need to first add a column to our temperature table for the "day after" minimum temperature. That's because these methods use the minimum temperature of the next day to better model cooling in the afternoon and evening hours.

We can add the next-day minimum temperature to our table with a little dplyr.

```{r}
espartoa_temp2 <- espartoa_temp %>%
  mutate(tmin_next = lead(tmin, n = 1))

espartoa_temp2 %>% head()
```

The double-triangle and double-sine methods can be computed with `dd_dbl_tri()` and `dd_dbl_sine()`.

```{r}
espartoa_dd2 <- espartoa_temp2 %>%
  mutate(dbl_tri = dd_dbl_tri(daily_min = tmin, daily_max = tmax, nextday_min = tmin_next,
                              thresh_low = thresh_low, thresh_up = thresh_up),
         dbl_sine = dd_dbl_sine(daily_min = tmin, daily_max = tmax, nextday_min = tmin_next,
                                thresh_low = thresh_low, thresh_up = thresh_up))

espartoa_dd2 %>% head()
```

\

# References {#references}

Zalom, F.G., P.B. Goodell, L.T. Wilson, W.W. Barnett, and W.J. Bentley. 1983. *Degree-days: The calculation and use of heat units in pest management*. UC DANR Leaflet 21373. Available from [Hathi Trust](https://catalog.hathitrust.org/Record/008707238).

McMaster, G. S., and Wilhelm, W. W. 1997. *Growing degree-days: one equation, two interpretations*. Agricultural and forest meteorology, 87(4), 291-300. Available from [unl.edu](https://digitalcommons.unl.edu/cgi/viewcontent.cgi?article=1086&context=usdaarsfacpub)

Roltsch, W. J.; Zalom, F. G.; Strawn, A. J.; Strand, J. F.; Pitcairn, M. J. 1999. *Evaluation of several degree-day estimation methods in California climates*. Int. J. Biometeorol. 42:169-176. [https://doi.org/10.1007/s004840050101](https://doi.org/10.1007/s004840050101)

Owner

  • Name: UCANR-IGIS
  • Login: UCANR-IGIS
  • Kind: organization

GitHub Events

Total
  • Watch event: 3
  • Push event: 1
Last Year
  • Watch event: 3
  • Push event: 1

Issues and Pull Requests

Last synced: 10 months ago

All Time
  • Total issues: 0
  • Total pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Total issue authors: 0
  • Total pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
Pull Request Authors
Top Labels
Issue Labels
Pull Request Labels

Packages

  • Total packages: 1
  • Total downloads:
    • cran 263 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 1
  • Total maintainers: 1
cran.r-project.org: degday

Compute Degree Days

  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 263 Last month
Rankings
Forks count: 21.9%
Dependent packages count: 29.8%
Stargazers count: 35.2%
Dependent repos count: 35.5%
Average: 38.7%
Downloads: 71.1%
Maintainers (1)
Last synced: 11 months ago

Dependencies

DESCRIPTION cran
  • R >= 3.5 depends
  • crayon * imports
  • dplyr * imports
  • magrittr * imports
  • methods * imports
  • zoo * imports
  • cimir * suggests
  • knitr * suggests
  • testthat >= 3.0.0 suggests
  • tidyr * suggests
  • units * suggests