Get timeseries summary from CalCOFI API

get_timeseries(
  variable = "ctdcast_bottle.t_deg_c",
  aoi_wkt = NULL,
  depth_m_min = NULL,
  depth_m_max = NULL,
  date_beg = NULL,
  date_end = NULL,
  time_step = "year",
  stats = c("p10", "mean", "p90")
)

Arguments

variable

Variable to fetch from the CalCOFI API. One of table_field values from get_variables(). Default is "ctdcast_bottle.t_deg_c".

aoi_wkt

Area of interest (AOI), spatially described as well-known text (WKT).

depth_m_min

Minimum depth range in meters, e.g. 0. Default is NULL, as in not filtered.

depth_m_max

Maximum depth range in meters, e.g. 5351. Default is NULL, as in not filtered.

date_beg

Beginning of date range, e.g."1949-02-28". Default is NULL, as in not filtered.

date_end

End of date range, e.g. "2020-01-26". Default is NULL, as in not filtered.

time_step

Time step over which to summarize. One of: a sequential increment ("decade","year","year.quarter","year.month","year.week","date"), or a climatology ("quarter","month","week","julianday","hour"). Default is "year".

stats

Statistics to show per date_step. Acceptable values include any combination of: "avg", "median", "min", "max", "sd" or "p#" where "sd" is the standard deviation and "p#" represents the percentile value 0 to 100 within available range of values. Default is c("p10", "mean", "p90").

Value

data frame of values

Examples

get_timeseries(
  variable = "ctdcast_bottle.t_deg_c",
  aoi_wkt = "POLYGON ((-120.6421 33.36241, -118.9071 33.36241, -118.9071 34.20707, -120.6421 34.20707, -120.6421 33.36241))",
  depth_m_min = 0, depth_m_max = 200,
  date_beg = "2000-01-01", date_end = "2020-01-01",
  time_step = "year",
  stats = c("p10", "mean", "p90"))
#> Error in req_perform(req) : HTTP 500 Internal Server Error.
#> Error in last_response() %>% resp_body_json() %>% .$message %>% stop(): Error in (function (variable = "ctd_bottles.t_degc", species_group = NULL, : nrow(v) == 1 is not TRUE