Package 'gsdd'

Title: Calculate Growing Season Degree Days from Water Temperature Data
Description: Calculates Growing Season Degree Days (GSDD), Growing Degree Days (GDD) and the Growing Seasons (GSS) from water temperature data. GSSD is a water temperature metric that is a useful predictor of age-0 trout size at the beginning of winter. It is the accumulated thermal units (in C) during the growing season based on the mean daily water temperature values. GDD is the GSSD to a particular date.
Authors: Joe Thorley [aut, cre] , Sarah Lyons [aut] , Jill Brooks [ctb], Bronwen Lewis [ctb], Teck Resources [fnd, cph]
Maintainer: Joe Thorley <[email protected]>
License: MIT + file LICENSE
Version: 0.3.0.9000
Built: 2024-12-18 05:25:15 UTC
Source: https://github.com/poissonconsulting/gsdd

Help Index


Calculate Date of Accumulated Thermal Units (ATUs)

Description

Calculates the date on which a specified number of Accumulated Thermal Units (ATUs) are meet or exceeded.

Usage

date_atus(x, atus = 600, start_date = as.Date("1972-03-01"))

Arguments

x

A data frame with two columns date and temperature. date, which must be of class Date provides the dates and temperature which must be a numeric vector provides the mean daily water temperature in degrees centigrade.

atus

A positive number of the accumulated thermal units to exceed.

start_date

A Date scalar of the first date within each year to consider (the year is ignored). #' If start_date occurs before the end_date (when ignoring the year) then the window is considered to span two calendar years.

Value

A tibble with four columns year, start_date, end_date and atus.

Examples

date_atus(gsdd::temperature_data)

Calculate Growing Degree Days (GDD)

Description

Calculate the number of growing degree days to the specified end date.

Usage

gdd(
  x,
  start_date = as.Date("1972-03-01"),
  end_date = as.Date("1972-09-30"),
  min_length = NULL,
  ignore_truncation = FALSE,
  start_temp = 5,
  end_temp = 4,
  window_width = 7,
  pick = "all",
  msgs = TRUE
)

Arguments

x

A data frame with two columns date and temperature. date, which must be of class Date provides the dates and temperature which must be a numeric vector provides the mean daily water temperature in degrees centigrade.

start_date

A Date scalar of the first date within each year to consider (the year is ignored). #' If start_date occurs before the end_date (when ignoring the year) then the window is considered to span two calendar years.

end_date

A Date scalar of the last date within each year to consider (the year is ignored).

min_length

A whole number of the minimum length to consider. Must be at least twice the window width but no more than 365. If NULL then set to be the difference between start_date and end_date (ignoring the year).

ignore_truncation

A flag specifying whether to ignore start truncation (end truncation is always ignored).

start_temp

A positive real number of the average water temperature at the start of the growing season(s) in C.

end_temp

A positive real number of the average water temperature at the end of the growing season(s) in C. It must be greater than or equal to the start temperature.

window_width

A positive whole number of the width of the rolling mean window in days. By default 7.

pick

A string specifying whether to pick the "longest", "shortest", "first" or "last" 'season' or the season with the "biggest" or "smallest" GSDD. By default the returned value is the the GSDD value for the "longest" 'season'.

msgs

A flag specifying whether to provide messages.

Value

A tibble with two columns year and gdd.

See Also

gsdd()

Examples

gdd(gsdd::temperature_data)

Calculate Growing Season Degree Days (GSDD)

Description

Growing Season Degree Days (GSDD) is a water temperature metric that is a useful predictor of age-0 trout size at the beginning of winter. It is the accumulated thermal units (in C) during the growing season based on the mean daily water temperature values.

Usage

gsdd(
  x,
  start_date = as.Date("1972-03-01"),
  end_date = as.Date("1972-11-30"),
  ignore_truncation = FALSE,
  min_length = NULL,
  start_temp = 5,
  end_temp = 4,
  window_width = 7,
  pick = "all",
  msgs = TRUE
)

Arguments

x

A data frame with two columns date and temperature. date, which must be of class Date provides the dates and temperature which must be a numeric vector provides the mean daily water temperature in degrees centigrade.

start_date

A Date scalar of the first date within each year to consider (the year is ignored). #' If start_date occurs before the end_date (when ignoring the year) then the window is considered to span two calendar years.

end_date

A Date scalar of the last date within each year to consider (the year is ignored).

ignore_truncation

A flag specifying whether to ignore truncation of the mean daily water temperature vector or a string of "start", "end", "none" (equivalent to FALSE) or "both" (equivalent to TRUE) specifying which type of truncation to ignore.

min_length

A whole number of the minimum length to consider. Must be at least twice the window width but no more than 365. If NULL then set to be the difference between start_date and end_date (ignoring the year).

start_temp

A positive real number of the average water temperature at the start of the growing season(s) in C.

end_temp

A positive real number of the average water temperature at the end of the growing season(s) in C. It must be greater than or equal to the start temperature.

window_width

A positive whole number of the width of the rolling mean window in days. By default 7.

pick

A string specifying whether to pick the "longest", "shortest", "first" or "last" 'season' or the season with the "biggest" or "smallest" GSDD. By default the returned value is the the GSDD value for the "longest" 'season'.

msgs

A flag specifying whether to provide messages.

Details

The GSDD is calculated across the longest consecutive sequence of non-missing values. Truncation occurs when the start and/or end of the sequence of non-missing values is part way through a growing season. If the user chooses to ignore truncation then the returned value very likely to be less than the actual value.

The default values and implementation of the growing season are based on Coleman and Fausch (2007) who stated that

We defined the start of the growing season as the beginning of the first week that average stream temperatures exceeded and remained above 5C for the season; the end of the growing season was defined as the last day of the first week that average stream temperature dropped below 4C.

For the purposes of the calculation week refers to a seven day rolling average as opposed to the calendar week. If there are multiple growing 'seasons' within the same year then by default the returned value is the sum of the GSDD values for "all" seasons.

The user has the option to pick the "first"/"last" or "longest"/"shortest" season or the season with the "biggest"/"smallest" GSDD. If the user picks the "longest" season but there are multiple seasons with the longest length then the candidate season with the "biggest" GSDD is selected. Conversely in the case of multiple "shortest" seasons then the candidate with the "smallest" GSDD is selected.

Value

A tibble with two columns year and gsdd.

References

Coleman, M.A., and Fausch, K.D. 2007. Cold Summer Temperature Limits Recruitment of Age-0 Cutthroat Trout in High-Elevation Colorado Streams. Transactions of the American Fisheries Society 136(5): 1231–1244. doi:10.1577/T05-244.1.

See Also

gsdd_vctr(), gdd() and gss()

Examples

gsdd(gsdd::temperature_data)

Calculate Growing Season Degree Days (GSDD) from a vector

Description

Calculate Growing Season Degree Days (GSDD) from a vector

Usage

gsdd_vctr(
  x,
  ignore_truncation = FALSE,
  min_length = 274,
  start_temp = 5,
  end_temp = 4,
  window_width = 7,
  pick = "all",
  complete = FALSE,
  msgs = TRUE
)

Arguments

x

A numeric vector of the mean daily water temperature values for the period of interest in C.

ignore_truncation

A flag specifying whether to ignore truncation of the mean daily water temperature vector or a string of "start", "end", "none" (equivalent to FALSE) or "both" (equivalent to TRUE) specifying which type of truncation to ignore.

min_length

A whole number of the minimum length to consider. Must be at least twice the window width but no more than 365. If NULL then set to be the difference between start_date and end_date (ignoring the year).

start_temp

A positive real number of the average water temperature at the start of the growing season(s) in C.

end_temp

A positive real number of the average water temperature at the end of the growing season(s) in C. It must be greater than or equal to the start temperature.

window_width

A positive whole number of the width of the rolling mean window in days. By default 7.

pick

A string specifying whether to pick the "longest", "shortest", "first" or "last" 'season' or the season with the "biggest" or "smallest" GSDD. By default the returned value is the the GSDD value for the "longest" 'season'.

complete

A flag specifying whether the vector of water temperatures represents the complete possible growing period (by default FALSE). If TRUE a growing season is not considered to be truncated at the start and/or end if the water temperature is above the threshold at the start and/or ends.

msgs

A flag specifying whether to provide messages.

Value

A non-negative real number of the GSDD.

See Also

gsdd()

Examples

gsdd_vctr(c(rep(1, 10), rep(10, 20), rep(1, 200)))
gsdd_vctr(gsdd::temperature_data$temperature)

Calculate Growing Seasons (GSS)

Description

Calculate the start and end and gsdd values of all growing seasons in a year.

Usage

gss(
  x,
  start_date = as.Date("1972-03-01"),
  end_date = as.Date("1972-11-30"),
  min_length = NULL,
  ignore_truncation = FALSE,
  start_temp = 5,
  end_temp = 4,
  window_width = 7,
  pick = "all",
  msgs = TRUE
)

Arguments

x

A data frame with two columns date and temperature. date, which must be of class Date provides the dates and temperature which must be a numeric vector provides the mean daily water temperature in degrees centigrade.

start_date

A Date scalar of the first date within each year to consider (the year is ignored). #' If start_date occurs before the end_date (when ignoring the year) then the window is considered to span two calendar years.

end_date

A Date scalar of the last date within each year to consider (the year is ignored).

min_length

A whole number of the minimum length to consider. Must be at least twice the window width but no more than 365. If NULL then set to be the difference between start_date and end_date (ignoring the year).

ignore_truncation

A flag specifying whether to ignore truncation of the mean daily water temperature vector or a string of "start", "end", "none" (equivalent to FALSE) or "both" (equivalent to TRUE) specifying which type of truncation to ignore.

start_temp

A positive real number of the average water temperature at the start of the growing season(s) in C.

end_temp

A positive real number of the average water temperature at the end of the growing season(s) in C. It must be greater than or equal to the start temperature.

window_width

A positive whole number of the width of the rolling mean window in days. By default 7.

pick

A string specifying whether to pick the "longest", "shortest", "first" or "last" 'season' or the season with the "biggest" or "smallest" GSDD. By default the returned value is the the GSDD value for the "longest" 'season'.

msgs

A flag specifying whether to provide messages.

Value

A tibble with four columns: year, start_dayte, end_dayte and gsdd.

See Also

gsdd()

Examples

gss(gsdd::temperature_data)

Plot Growing Seasons (GSS)

Description

Plots the growing seasons in a year.

Usage

gss_plot(
  x,
  start_date = as.Date("1972-03-01"),
  end_date = as.Date("1972-11-30"),
  min_length = NULL,
  ignore_truncation = FALSE,
  start_temp = 5,
  end_temp = 4,
  window_width = 7,
  pick = "all",
  latex = FALSE,
  nrow = NULL,
  ncol = NULL,
  msgs = TRUE
)

Arguments

x

A data frame with two columns date and temperature. date, which must be of class Date provides the dates and temperature which must be a numeric vector provides the mean daily water temperature in degrees centigrade.

start_date

A Date scalar of the first date within each year to consider (the year is ignored). #' If start_date occurs before the end_date (when ignoring the year) then the window is considered to span two calendar years.

end_date

A Date scalar of the last date within each year to consider (the year is ignored).

min_length

A whole number of the minimum length to consider. Must be at least twice the window width but no more than 365. If NULL then set to be the difference between start_date and end_date (ignoring the year).

ignore_truncation

A flag specifying whether to ignore truncation of the mean daily water temperature vector or a string of "start", "end", "none" (equivalent to FALSE) or "both" (equivalent to TRUE) specifying which type of truncation to ignore.

start_temp

A positive real number of the average water temperature at the start of the growing season(s) in C.

end_temp

A positive real number of the average water temperature at the end of the growing season(s) in C. It must be greater than or equal to the start temperature.

window_width

A positive whole number of the width of the rolling mean window in days. By default 7.

pick

A string specifying whether to pick the "longest", "shortest", "first" or "last" 'season' or the season with the "biggest" or "smallest" GSDD. By default the returned value is the the GSDD value for the "longest" 'season'.

latex

A flag specifying whether to use LaTeX to include degree symbol in y-axis label.

nrow

A count of the number of rows to facet by.

ncol

A count of the number of columns to facet by.

msgs

A flag specifying whether to provide messages.

Value

A ggplot object.

See Also

gss()

Examples

gss_plot(gsdd::temperature_data)

Mean Daily Water Temperature Data

Description

Mean Daily Water Temperature Data

Usage

temperature_data

Format

A tibble with columns:

date

A Date vector.

temperature

A real vector of mean daily water temperature values based on a seasonal sine wave.

temperature2

A real vector of mean daily water temperature values with two discrete growing seasons.