Description Usage Arguments Details Value Author(s) Examples
Takes a series of dates and temperatures, and if irregular (but ordered), inserts missing dates and fills correpsonding temperatures with NAs.
1 | make_whole(data, x = t, y = temp)
|
data |
A data frame with columns for date and temperature data. Ordered daily data are expected, and although missing values (NA) can be accommodated, the function is only recommended when NAs occur infrequently, preferably at no more than 3 consecutive days. |
x |
A column with the daily time vector (see details). For backwards
compatibility, the column is named |
y |
A column with the response vector. RmarineHeatWaves version <= 0.15.9
assumed that this would be daily seawater temperatures, but as of version 0.16.0
it may be any arbitrary measurement taken at a daily frequency. The default
remains temperature, and the default column name is therefore |
Upon import, the package uses 'zoo' and 'lubridate' to process the input
date and temperature data. It reads in daily data with the time vector
specified as either POSIXct
or Date
(e.g. "1982-01-01 02:00:00" or
"1982-01-01"). The data may be an irregular time series, but date must be
ordered. The function constructs a complete time series from the start date
to the end date, and fills in the regions in the time series where temperature
data are missing, with NAs in the temperature vector. There must only be one
temperature value per day otherwise the function will fail. It is up to the
user to calculate daily data from sub-daily measurements. Leap years are
automatically accommodated by 'zoo'.
This function can handle some of missing days, but this is not a
licence to actually use these data for the detection of anomalous thermal
events. Hobday et al. (2016) recommend gaps of no more than 3 days, which
may be adjusted by setting the max_pad_length
argument of the
detect
function. The longer and more frequent the gaps become
the lower the fidelity of the annual climatology and threshold that can be
calculated, which will not only have repercussions for the accuracy at which
the event metrics can be determined, but also for the number of events that
can be detected.
It is recommended that a climatology period of at least 30 years is specified in order to capture any decadal thermal periodicities.
The function will return a data frame with three columns. The column
headed doy
(day-of-year) is the Julian day running from 1 to 366, but
modified so that the day-of-year series for non-leap-years runs 1...59 and
then 61...366. For leap years the 60th day is February 29. See the example,
below. The other two columns take the names of x
and y
, if supplied,
or it will be t
and temp
in case the default values were used.
The x
(or t
) column is a series of dates of class Date
,
while y
(or temp
) is the measured variable. This time series will
be uninterrupted and continuous daily values between the first and last dates
of the input data.
Smit, A. J.
1 2 3 4 5 6 7 8 9 | require(dplyr); require(tidyr); require(lubridate)
ts_dat <- make_whole(sst_WA) # default columns "t" and "temp", in that order
clim_start <- "1983-01-01"
clim_end <- "2012-12-31"
ts_dat %>%
filter(t >= clim_start & t <= clim_end) %>%
mutate(t = year(t)) %>%
spread(t, temp) %>%
filter(doy >= 55 & doy <= 65)
|
RmarineHeatWaves has been superceded by heatwaveR 0.2.7, which is available on
* CRAN: https://cran.r-project.org/package=heatwaveR
* GitHub: https://github.com/robwschlegel/heatwaveR
Only bug fixes will be implemented in RmarineHeatWaves, but active
development continues in heatwaveR.
See https://robwschlegel.github.io/heatwaveR for more information.
Loading required package: dplyr
Attaching package: 'dplyr'
The following objects are masked from 'package:stats':
filter, lag
The following objects are masked from 'package:base':
intersect, setdiff, setequal, union
Loading required package: tidyr
Loading required package: lubridate
Attaching package: 'lubridate'
The following object is masked from 'package:base':
date
doy 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994
1 55 23.13 25.25 24.37 22.65 22.47 23.26 24.23 23.85 21.87 23.00 21.30 21.45
2 56 23.47 25.00 24.21 22.51 22.54 23.38 24.07 25.02 21.83 22.89 21.06 21.11
3 57 23.65 23.65 24.34 22.32 22.49 23.46 24.18 25.01 21.82 23.76 20.81 21.15
4 58 23.67 23.80 24.39 22.36 21.95 23.62 24.08 24.10 21.84 23.75 20.98 21.39
5 59 23.76 24.27 24.08 22.37 22.59 23.89 23.85 23.49 21.99 23.34 21.08 21.65
6 60 NA 24.63 NA NA NA 23.80 NA NA NA 23.19 NA NA
7 61 24.39 24.76 24.10 22.47 22.80 23.56 23.96 23.07 22.55 22.91 22.78 22.00
8 62 24.07 23.83 23.94 22.71 22.84 23.50 24.08 22.82 21.96 22.64 22.47 22.04
9 63 23.26 23.71 23.71 23.20 22.53 23.29 24.27 23.00 21.83 22.11 21.95 21.95
10 64 22.98 23.42 24.02 23.25 22.00 23.35 24.32 23.13 21.79 21.98 21.57 21.83
11 65 23.21 23.50 24.07 23.27 22.03 23.34 24.37 23.00 21.46 21.89 21.68 21.84
1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006
1 24.33 23.06 22.64 22.97 24.04 22.91 22.96 23.41 23.03 21.96 21.88 20.93
2 23.93 22.81 24.76 22.01 24.62 23.04 22.99 23.48 23.06 21.95 21.83 20.93
3 23.75 22.50 24.72 22.06 24.61 23.13 22.77 23.03 23.34 22.11 21.77 21.16
4 22.59 22.29 24.37 22.28 24.61 23.13 22.64 22.96 23.42 22.23 21.74 21.34
5 22.41 22.41 24.40 22.70 23.80 23.31 22.73 23.07 23.41 23.15 21.76 21.44
6 NA 22.69 NA NA NA 23.47 NA NA NA 23.22 NA NA
7 22.53 22.68 24.66 22.62 23.83 23.59 23.20 22.97 23.36 23.40 21.78 22.29
8 22.85 22.59 24.57 22.56 23.76 23.33 23.46 23.09 23.36 23.24 21.80 22.58
9 22.48 22.20 24.59 22.45 23.82 23.32 24.17 23.28 23.92 22.36 21.80 22.60
10 22.48 22.13 24.62 22.60 23.88 23.71 24.59 23.17 24.04 22.43 22.56 22.67
11 22.64 22.54 24.64 22.81 23.80 23.80 24.83 23.04 24.22 23.17 22.86 24.91
2007 2008 2009 2010 2011 2012
1 22.90 23.18 22.64 22.78 28.50 24.96
2 23.12 23.62 22.00 23.02 29.29 24.94
3 23.20 23.90 21.96 23.43 29.45 24.58
4 23.12 24.41 21.94 24.28 29.52 24.52
5 22.80 25.00 21.92 24.31 29.74 24.57
6 NA 24.68 NA NA NA 24.51
7 22.63 24.07 21.86 23.96 29.69 24.60
8 22.56 23.99 21.07 23.79 29.20 24.88
9 22.65 23.65 21.23 23.12 28.84 25.44
10 22.83 23.76 21.65 22.13 28.54 25.54
11 23.49 23.95 22.14 22.15 28.18 25.65
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.