package

# r-degday

Description

Compute Degree Days.

Description
Compute degree days from daily min and max temperatures for modeling plant and insect development.

# Compute Degree Days

degday provides formulas for estimating degree days 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) and McMaster and Wilhelm (1997). These same formulas are used on the University of California Integrated Pest Management (UC IPM) website. See the UC IPM website for additional background on degree days, detailed figures and formulas, and models that predict growth stages of various crops and pests based on degree days.

`degday` implements all formulas from Zalom et al (1983), 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), 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).

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.

## Installation

`degday` is available on r-universe. 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 it directly from GitHub. (This requires the `remotes` package plus RTools 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 CIMIS weather station in Yolo County, California.

``````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))
#>     station       date tmin tmax
#> 1 Esparto.A 2020-01-01   38   55
#> 2 Esparto.A 2020-01-02   36   67
#> 3 Esparto.A 2020-01-03   33   59
#> 4 Esparto.A 2020-01-04   37   59
#> 5 Esparto.A 2020-01-05   38   63
#> 6 Esparto.A 2020-01-06   36   58
``````

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.

``````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()`:

``````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))
#>  - using single triangle method
#>  - using single sine method

#>     station       date tmin tmax sng_tri sng_sine
#> 1 Esparto.A 2020-01-01   38   55    0.00     0.00
#> 2 Esparto.A 2020-01-02   36   67    2.32     3.31
#> 3 Esparto.A 2020-01-03   33   59    0.31     0.68
#> 4 Esparto.A 2020-01-04   37   59    0.36     0.74
#> 5 Esparto.A 2020-01-05   38   63    1.28     1.99
#> 6 Esparto.A 2020-01-06   36   58    0.20     0.48
``````

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.

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

#>     station       date tmin tmax tmin_next
#> 1 Esparto.A 2020-01-01   38   55        36
#> 2 Esparto.A 2020-01-02   36   67        33
#> 3 Esparto.A 2020-01-03   33   59        37
#> 4 Esparto.A 2020-01-04   37   59        38
#> 5 Esparto.A 2020-01-05   38   63        36
#> 6 Esparto.A 2020-01-06   36   58        30
``````

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

``````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))
#>  - using double triangle method
#>  - using double sine method

#>     station       date tmin tmax tmin_next dbl_tri dbl_sine
#> 1 Esparto.A 2020-01-01   38   55        36    0.00     0.00
#> 2 Esparto.A 2020-01-02   36   67        33    2.22     3.23
#> 3 Esparto.A 2020-01-03   33   59        37    0.34     0.71
#> 4 Esparto.A 2020-01-04   37   59        38    0.37     0.75
#> 5 Esparto.A 2020-01-05   38   63        36    1.23     1.95
#> 6 Esparto.A 2020-01-06   36   58        30    0.18     0.45
``````

# 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.

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

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

`0.4.0`

Unknown

### Platforms71 (71)

Darwin
FreeBSD 13
Genode
GHCJS
Linux
MMIXware
NetBSD
none
OpenBSD
Redox
Solaris
WASI
Windows
Show all
• `aarch64-darwin`
• `aarch64-genode`
• `aarch64-linux`
• `aarch64-netbsd`
• `aarch64-none`
• `aarch64_be-none`
• `arm-none`
• `armv5tel-linux`
• `armv6l-linux`
• `armv6l-netbsd`
• `armv6l-none`
• `armv7a-darwin`
• `armv7a-linux`
• `armv7a-netbsd`
• `armv7l-linux`
• `armv7l-netbsd`
• `avr-none`
• `i686-cygwin`
• `i686-darwin`
• `i686-freebsd13`
• `i686-genode`
• `i686-linux`
• `i686-netbsd`
• `i686-none`
• `i686-openbsd`
• `i686-windows`
• `javascript-ghcjs`
• `loongarch64-linux`
• `m68k-linux`
• `m68k-netbsd`
• `m68k-none`
• `microblaze-linux`
• `microblaze-none`
• `microblazeel-linux`
• `microblazeel-none`
• `mips64el-linux`
• `mipsel-linux`
• `mipsel-netbsd`
• `mmix-mmixware`
• `msp430-none`
• `or1k-none`
• `powerpc-netbsd`
• `powerpc-none`
• `powerpc64-linux`
• `powerpc64le-linux`
• `powerpcle-none`
• `riscv32-linux`
• `riscv32-netbsd`
• `riscv32-none`
• `riscv64-linux`
• `riscv64-netbsd`
• `riscv64-none`
• `rx-none`
• `s390-linux`
• `s390-none`
• `s390x-linux`
• `s390x-none`
• `vc4-none`
• `wasm32-wasi`
• `wasm64-wasi`
• `x86_64-cygwin`
• `x86_64-darwin`
• `x86_64-freebsd13`
• `x86_64-genode`
• `x86_64-linux`
• `x86_64-netbsd`
• `x86_64-none`
• `x86_64-openbsd`
• `x86_64-redox`
• `x86_64-solaris`
• `x86_64-windows`
mnos-build-web-prod-20230506T105712Z-2f940cd