extract_data: Extract climate and weather variables

View source: R/new_functions.R

extract_dataR Documentation

Extract climate and weather variables

Description

Pulls climate or weather variables from a RasterBrick for different time periods and summarizes them by simple metrics

Usage

extract_data(
  brick,
  measures = c("mean"),
  timeframe = c("annual", "winter", "spring", "summer", "fall"),
  writefile = T,
  varname = NULL,
  layer_type = "month",
  hemisphere = "northern",
  directory = "./"
)

Arguments

brick

an object of class RasterBrick

measures

a character vector indicating how variables should be summarized (allows mean, min, max, and sum)

timeframe

a character vector indicating the time over which variables should be summarized (allows annual, winter, spring, summer, fall, or wateryear)

writefile

logical; if TRUE, saves a .csv file to the users' machine

varname

a character vector indicating which climate or weather variable you are extracting (e.g. tmin, tmax)

layer_type

a character vector indicating if each layer represents a month or a year

hemisphere

a character vector indicating if temperate northern or southen hemisphere seasons should be used

directory

a path to where files should be written if writefile=TRUE

Value

if writefile=TRUE, .csv files of matrices; if writefile=FALSE, a list of lists of matrices


elizagrames/climetric documentation built on Nov. 1, 2022, 6:26 a.m.