Calculate Growing Degree Days above a baseline baseline, (GDD) from daily values of temperature.

gdd(.data, ...)

# S3 method for numeric
gdd(.data, baseline = 0, pb = NULL, ...)

# S3 method for tbl_df
gdd(.data, baseline = 0, cpus = 1, ...)

Arguments

.data

Object with daily values of temperature. The object can be a:

  • Numeric vector

  • Data frame (tibble object) with a column called tmp, with values of daily temperature.

...

Optional parameters, including the baseline for the calculation of the Growing Degree Days, cpus and pb.

baseline

Numeric value to be used as the baseline for the calculation of the Growing Degree Days, default: 0.

pb

Function to signal the execution of one cycle (e.g. progressr::progressor(...)). Default: NULL, do nothing.

cpus

Numeric value with the number of CPUs to be used for the computation. Default: 1, serial computation.

Value

If the input (.data) is a

  • Numeric vector, it returns a single value for GDD.

  • Data frame (tibble object), it returns the same data frame with an additional column called gddX (where X represents the value of the baseline; e.g., gdd0 when baseline = 0), containing values for GDD.

See also

plot_gdd

Other utils climate: mat(), mi(), mtco(), mtwa()

Examples

if (FALSE) {
`%>%` <- magrittr::`%>%`
data <- tibble::tibble(entity_name = "University of Reading",
                       latitude = 51.44140,
                       longitude = -0.9418,
                       elevation = 61)
smpds::gwr(.ref = "/path/to/reference-tmp.nc",
           .tar = data,
           varid = "tmp") %>%
  smpds::pivot_data(varname = "tmp") %>%
  smpds::gdd()
}