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.

band(
  data,
  geeFC = NULL,
  scale,
  band = NULL,
  temporal = "yearly",
  lazy = FALSE,
  fun = ee$Reducer$median(),
  variable = NULL,
  ggplot = FALSE,
  save.plot = F
)

Arguments

data

A previously created get_* object

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'.

lazy

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

fun

A earth engine reducer, e.g. ee$Reducer$median() (default).

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, e.g. data + ggplot.

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

Goal is to add more capabilities to this function in the future by using map() server-side, e.g. monthly and annual filters. Faster with points or centroids of polygons. If lazy is TRUE, the function will be run in the background.

Examples

if (FALSE) {

# 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)

}