Skip to contents

The Landsat kelp area data is a quarterly product per pixel, so this function serves to aggregate these pixels to a time series for each segment, either quarterly or annually, with a few different methods for the annualization.

Usage

extract_time_series(
  segmented_landsat_data,
  ...,
  frequency = c("annual", "quarterly"),
  annualization_method = c("sum_first", "max_first", "Q1", "Q2", "Q3", "Q4"),
  segment_id = NULL
)

Arguments

segmented_landsat_data

A dataframe generated by segment_landsat_data() with rows for each pixel, and columns for each quarter and year of the landsat data, with the assigned segment from a given shapefile

...

These dots are for future extensions and must be empty.

frequency

The frequency of the time series to extract. Either "annual" (default) or "quarterly"

annualization_method

The method used to convert the quarterly time series to an annual time series.

  • "sum_first": sums together all quarterly area values for each pixel within each segment, and then the maximum area per year for each segment is calculated

  • "max_first": for each pixel, the maximum quarterly area in a year is calculated first, and then all these maximum areas per year are summed together within each kelp segment.

  • "Q1": selects the first quarter of every year

  • "Q2": selects the second quarter of every year

  • "Q3": selects the third quarter of every year

  • "Q4": selects the fourth quarter of every year

segment_id

A character vector containing the subset of segment_id's of interest, e.g. c("CA_71", "CA_78"), or NULL for all segment IDs (default).

Value

A dataframe with the following columns:

  • Segment_ID: The ID of the kelp area segment

  • max_occupiable: The maximum occupiable kelp area for the given segment. This column repeats the same value for all rows in a single kelp area segment

  • historical_med: The historical (1984-2013) median kelp area for the segment. The median is computed across the quarterly or annualized kelp area values, depending on frequency. This column repeats the same value for all rows in a single kelp area segment

  • quarter*: If frequency == "quarterly", the quarter in the time series, otherwise not present

  • year: Year in the time series

  • date: date representation of the year/quarter, for simpler plotting

  • area_abs: Kelp area in absolute magnitude, in km^2

  • area_hist: Kelp area relative to the historical median, expressed as a percentage

  • area_pct: Kelp area relative to the maximum occupiable kelp area, expressed as a percentage