band: Extract Regions by Date

View source: R/band.R

bandR Documentation

Extract Regions by Date

Description

This function allows the user to pass a previously created get_*() object to get a time series from a collection, e.g. banding/toBands. This uses the ee_extract function from rgee.

Usage

band(
  imageCol,
  geeFC = NULL,
  scale,
  band = NULL,
  temporal = "yearly",
  temporal_stat = "median",
  lazy = FALSE,
  reducer = "median",
  variable = NULL,
  ggplot = FALSE,
  save.plot = F,
  user_geom = NULL,
  startDate = NULL,
  endDate = NULL,
  c.low = NULL,
  c.high = NULL
)

Arguments

imageCol

A previously created get_* object or ee.ImageCollection

geeFC

A known GEE FeatureCollection or asset, e.g. "USGS/WBD/2017/HUC12"

scale

numeric value indicating what to reduce the regions by, e.g. 800 (m) default.

band

A character indicating what bands/type to use when you have more than one.

temporal

A character indicating what temporal filter to use on the collection, e.g. 'yearly' (default), 'monthly', 'year_month', 'all'.

temporal_stat

A character indicating what to reduce the ImageCollection when using temporal filtering, e.g. 'median' (default), 'mean', 'max', 'min', 'sum', 'stdDev', 'first'.

lazy

logical whether to run a 'sequential' future in the background or not.

reducer

A character 'median' (default) for reducing.

variable

character indicating what to facet ggplot by. Need to know ahead of time.

ggplot

logical TRUE/FALSE. Whether to print side-effect ggplot. See details.

save.plot

logical TRUE/FALSE. Whether to save the plot in a list.

user_geom

logical TRUE/FALSE.

startDate

character format date, e.g. "2018-10-23". NULL (default)

endDate

character format date, e.g. "2018-10-23". NULL (default)

c.low

numeric lower month value for calendar range. NULL (default)

c.high

numeric higher month value for calendar range. NULL (default)

Value

A data.frame and a side-effect plot (if ggplot = TRUE); unless using save.plot then a list with data.frame and ggplot.

Note

If using a get_() object band() doesn't use the image generated. It only uses the ImageCollection. Additional arguments to pass if using a ImageCollection without get_()'s are the startDate, endDate, c.low and c.high arguments. Faster with points or centroids of polygons. If lazy is TRUE, the function will be run in the background.

Examples

## Not run: 

# Load Libraries

library(rgee)
rgee::ee_intialize()
library(exploreRGEE)

# Bring in data
huc <- exploreRGEE::huc

ld8 <- get_landsat(huc, method = 'ld8', startDate = '2014-01-01',
                  endDate = '2018-12-31', c.low = 6, c.high = 11)

# without plotting save to object
ld8_ts <- ld8 %>% band(scale = 30, band = 'NDVI')

# with plotting as side-effect
ld8 %>% band(scale = 30, band = 'NDVI', ggplot = TRUE, variable = 'name')

# save both plot and data
ld8_ts <- ld8 %>% band(scale = 30, band = 'NDVI',
                       ggplot = TRUE, variable = 'name',
                       save.plot = TRUE)


## End(Not run)

joshualerickson/exploreRGEE documentation built on May 9, 2022, 10:33 p.m.