Skip to content

Commit

Permalink
drop ...
Browse files Browse the repository at this point in the history
  • Loading branch information
joethorley committed Mar 24, 2024
1 parent 996e6a1 commit eaeef22
Show file tree
Hide file tree
Showing 7 changed files with 80 additions and 45 deletions.
5 changes: 3 additions & 2 deletions R/gdd.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#' Calculate Growing Degree Days (GDD) from a Data Frame
#' Calculate Growing Degree Days (GDD)
#'
#' The GDD which is a the growing degree days to the end date
#' is calculated for each study year from a data frame.
Expand Down Expand Up @@ -52,6 +52,7 @@ gdd <- function(
msgs = msgs,
start_temp = start_temp,
end_temp = end_temp,
window_width = window_width) |>
window_width = window_width,
pick = pick) |>
dplyr::rename(gdd = "gsdd")
}
28 changes: 14 additions & 14 deletions R/gsdd.R
Original file line number Diff line number Diff line change
@@ -1,19 +1,13 @@
#' Calculate Growing Season Degree Days (GSDD) from a Data Frame
#' Calculate Growing Season Degree Days (GSDD)
#'
#' The GSDD is calculated for each study year from a data frame
#' with `date` and `temperature` columns.
#' `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. For additional information on
#' GSDD and the various arguments that can be passed via `...` see [`gsdd()`].
#' The GSDD is calculated for each study year.
#'
#' @inheritParams params
#' @param ... Additional arguments passed to [`gsdd_vctr()`].
#' @return A tibble with two columns `year` and `gsdd`.
#' `year`, which is an integer vector, indicates the year in which the window
#' began and `gsdd` which is a non-negative real number provides the GSDD
#' or a missing value if it cannot be calculated.
#' @seealso [gsdd()] and [gdd()]
#' @seealso [gsdd_vctr()], [gdd()] and [gss()]
#' @export
#'
#' @examples
Expand All @@ -25,11 +19,17 @@ gsdd <- function(
start_date = as.Date("1972-01-01"),
end_date = as.Date("1972-12-31"),
ignore_truncation = FALSE,
msgs = TRUE,
...) {
start_temp = 5,
end_temp = 4,
window_width = 7,
pick = "longest",
msgs = TRUE) {

.gsdd(x, start_date = start_date, end_date = end_date,
ignore_truncation = ignore_truncation,
msgs = msgs,
...)
ignore_truncation = ignore_truncation,
start_temp = start_temp,
end_temp = end_temp,
window_width = window_width,
pick = pick,
msgs = msgs)
}
18 changes: 12 additions & 6 deletions R/gss.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#' Calculate Growing Seasons from a Data Frame
#' Calculate Growing Seasons
#'
#'
#' @inheritParams gsdd_vctr
Expand All @@ -16,11 +16,17 @@ gss <- function(
start_date = as.Date("1972-01-01"),
end_date = as.Date("1972-12-31"),
ignore_truncation = FALSE,
msgs = TRUE,
...) {
start_temp = 5,
end_temp = 4,
window_width = 7,
pick = "longest",
msgs = TRUE) {

.gsdd(x, start_date = start_date, end_date = end_date,
ignore_truncation = ignore_truncation,
msgs = msgs,
..., gss = TRUE)
ignore_truncation = ignore_truncation,
start_temp = start_temp,
end_temp = end_temp,
window_width = window_width,
pick = pick,
msgs = msgs, gss = TRUE)
}
9 changes: 5 additions & 4 deletions R/internal.R
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,10 @@
end_date,
ignore_truncation,
msgs,
start_temp = 5,
end_temp = 4,
window_width = 7,
start_temp,
end_temp,
window_width,
pick,
gss = FALSE) {
check_data(x, list(date = dttr2::dtt_date("1970-01-01"), temperature = c(1, NA)))
chk_date(start_date)
Expand Down Expand Up @@ -134,7 +135,7 @@
gsdd <- x |>
dplyr::summarise(gsdd = gsdd_vctr(
.data$temperature,
ignore_truncation = ignore_truncation, msgs = msgs, start_temp, end_temp = end_temp, window_width = window_width), .groups = "keep") |>
ignore_truncation = ignore_truncation, msgs = msgs, start_temp, end_temp = end_temp, window_width = window_width, pick = pick), .groups = "keep") |>
dplyr::ungroup()

if(!gss) {
Expand Down
2 changes: 1 addition & 1 deletion man/gdd.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

35 changes: 23 additions & 12 deletions man/gsdd.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 22 additions & 6 deletions man/gss.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit eaeef22

Please sign in to comment.