event_line {RmarineHeatWaves}R Documentation

Create a Line Plot of Marine Heat Waves or Cold Spells.

Description

Creates a graph of warm or cold events as per the second row of Figure 3 in Hobday et al. (2016).

Usage

event_line(data, x = t, y = temp, min_duration = 5, spread = 150,
  metric = "int_cum", start_date, end_date)

Arguments

data

The function receives the output from the detect function.

x

This column is expected to contain a vector of dates as per the specification of make_whole. If a column headed t is present in the dataframe, this argument may be ommitted; otherwise, specify the name of the column with dates here.

y

This is a column containing the measurement variable. If the column name differs from the default (i.e. temp), specify the name here.

min_duration

The minimum duration that an event has to for it to qualify as a marine heat wave or marine cold spell.

spread

The the number of days leading and trailing the largest event (as per metric) detected within the time period specified by start_date and end_date. The default is 150 days.

metric

One of the following options: int_mean, int_max, int_var, int_cum, int_mean_rel_thresh, int_max_rel_thresh, int_var_rel_thresh, int_cum_rel_thresh, int_mean_abs, int_max_abs, int_var_abs, int_cum_abs, int_mean_norm, int_max_norm, rate_onset, rate_decline. Partial name matching is currently not supported so please specify the metric name precisely. The default is int_cum.

start_date

The start date of a period of time within which the largest event (as per metric) is retrieved and plotted. This may not necessarily correspond to the biggest event of the specified metric within the entire data set. To plot the biggest event within the whole time series, make sure start_date and end_date straddle this event, or simply specify the start and end dates of the full time series given to detect.

end_date

The end date of a period of time within which the largest event (as per metric) is retrieved and plotted. See start_date for additional information.

Value

The function will return a line plot indicating the climatology, threshold and temperature, with the hot or cold events that meet the specifications of Hobday et al. (2016) shaded in as appropriate. The plotting of hot or cold events depends on which option is specified in detect. The top event detect during the selected time period will be visible in a brighter colour. This function differs in use from geom_flame in that it creates a stand alone figure. The benefit of this being that one must not have any prior knowledge of ggplot2 to create the figure.

Author(s)

Robert W. Schlegel

References

Hobday, A.J. et al. (2016), A hierarchical approach to defining marine heatwaves, Progress in Oceanography, 141, pp. 227-238, doi: 10.1016/j.pocean.2015.12.014

Examples

ts_dat <- make_whole(sst_WA)
res <- detect(ts_dat, climatology_start = "1983-01-01",
              climatology_end = "2012-12-31")

## Not run: 
event_line(res, spread = 200, metric = "int_cum",
start_date = "2010-10-01", end_date = "2011-08-30")

## End(Not run)

[Package RmarineHeatWaves version 0.17.0 Index]