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 |
Calculates the date on which a specified number of Accumulated Thermal Units (ATUs) are meet or exceeded.
date_atus(x, atus = 600, start_date = as.Date("1972-03-01"))
date_atus(x, atus = 600, start_date = as.Date("1972-03-01"))
x |
A data frame with two columns |
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 |
A tibble with four columns year
, start_date
, end_date
and atus
.
date_atus(gsdd::temperature_data)
date_atus(gsdd::temperature_data)
Calculate the number of growing degree days to the specified end date.
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 )
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 )
x |
A data frame with two columns |
start_date |
A Date scalar of the first date
within each year to consider (the year is ignored).
#' If |
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 |
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. |
A tibble with two columns year
and gdd
.
gdd(gsdd::temperature_data)
gdd(gsdd::temperature_data)
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.
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 )
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 )
x |
A data frame with two columns |
start_date |
A Date scalar of the first date
within each year to consider (the year is ignored).
#' If |
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_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. |
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.
A tibble with two columns year
and gsdd
.
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.
gsdd_vctr()
, gdd()
and gss()
gsdd(gsdd::temperature_data)
gsdd(gsdd::temperature_data)
Calculate Growing Season Degree Days (GSDD) from a vector
gsdd_vctr( x, ignore_truncation = FALSE, min_length = 274, start_temp = 5, end_temp = 4, window_width = 7, pick = "all", complete = FALSE, msgs = TRUE )
gsdd_vctr( x, ignore_truncation = FALSE, min_length = 274, start_temp = 5, end_temp = 4, window_width = 7, pick = "all", complete = FALSE, msgs = TRUE )
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_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. |
A non-negative real number of the GSDD.
gsdd_vctr(c(rep(1, 10), rep(10, 20), rep(1, 200))) gsdd_vctr(gsdd::temperature_data$temperature)
gsdd_vctr(c(rep(1, 10), rep(10, 20), rep(1, 200))) gsdd_vctr(gsdd::temperature_data$temperature)
Calculate the start and end and gsdd values of all growing seasons in a year.
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 )
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 )
x |
A data frame with two columns |
start_date |
A Date scalar of the first date
within each year to consider (the year is ignored).
#' If |
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 |
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. |
A tibble with four columns:
year
, start_dayte
, end_dayte
and gsdd
.
gss(gsdd::temperature_data)
gss(gsdd::temperature_data)
Plots the growing seasons in a year.
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 )
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 )
x |
A data frame with two columns |
start_date |
A Date scalar of the first date
within each year to consider (the year is ignored).
#' If |
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 |
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. |
A ggplot object.
gss_plot(gsdd::temperature_data)
gss_plot(gsdd::temperature_data)
Mean Daily Water Temperature Data
temperature_data
temperature_data
A tibble with columns:
A Date vector.
A real vector of mean daily water temperature values based on a seasonal sine wave.
A real vector of mean daily water temperature values with two discrete growing seasons.