exceedence(data, threshold = 20, below = FALSE, min_duration = 5, join_across_gaps = TRUE, max_gap = 2, max_pad_length = 3)
date
column which is a vector of dates of class Date
,
and a temp
column, which is the temperature on those given
dates. The function will not accurately detect consecutive days of
temperatures in exceedence of the threshold
if missing days of
data are not filled in with NA
. Data of the appropriate format are created
by the function make_whole
, but your own data may be used
directly if they meet the given criteria.20
degrees.FALSE
. When set to TRUE, consecutive days of temperature
below the threshold
variable are calculated. When set to FALSE,
consecutive days above the threshold
variable are calculated.threshold
variable. Default is 5
days.threshold
across a small gap between groups before/after a short
gap as specified by max_gap
. Default is TRUE
.threshold
when
join_across_gaps
is TRUE
.NA
) in the input
temperature time series; i.e., any consecutive blocks of NAs with length
greater than max_pad_length
will be left as NA
. Set as an
integer. Default is 3
days.threshold
, which shows the daily temperatures and on which specific days
the given threshold
was exceeded. The second component of the list is
exceedence
, which shows a medley of statistics for each discrete group
of days in exceedence of the given threshold
. Note that any additional
columns left in the data frame given to this function will be output in the
threshold
component of the output. For example, if one uses
make_whole
to prepare a time series for analysis and leaves
in the doy
column, this column will appear in the output.The information shown in the threshold
component is:The individual exceedences are summarised using the following metrics:int_max_abs
, int_mean_abs
, int_var_abs
, and
int_cum_abs
are as above except as absolute magnitudes
rather than relative to the threshold.
make_whole
aids in the preparation of a time series that is
suitable for use with exceedence
, although this may also be accomplished
'by hand' as long as the criteria are met as discussed in the documentation
to make_whole
.
threshold
started a half-day before the start day and ended a half-day
after the end-day. This is consistent with the duration definition as implemented,
which assumes duration = end day - start day + 1.
max_pad_length
) will remain as
NA
. This means they will trigger the end of an exceedence if the adjacent
temperature values are in exceedence of the threshold
.
theshold
, these temperatures are then taken as being in
exceedence below the threshold
as there is no antonym in the English
language for 'exceedence'.
This function is based largely on the detect
function found in this
package, which was ported from the Python algorithm that was written by Eric
Oliver, Institute for Marine and Antarctic Studies, University of Tasmania,
Feb 2015, and is documented by Hobday et al. (2016).
t_dat <- make_whole(sst_WA)
res <- exceedence(t_dat, threshold = 25)
# show first ten days of daily data:
res$threshold[1:10, ]
# show first five exceedences:
res$exceedence[1:5, ]
Run the code above in your browser using DataLab