extractEDEN | R Documentation |
This function extracts EDEN data for spatial locations of interest. This function can take a very long time depending on the number of regions-of-interest and their size, and if EDEN data is downloaded within the function call. NOTE: This is based on availability of data on the home page of EDEN. If data aren't there, they aren't accessible for this code.
extractEDEN(targetLocations, targetLocationNames, EDEN_data)
targetLocations |
locations to extract data from; should be class SpatVector or sf |
targetLocationNames |
option to specify the name of target locations (e.g., pts$gage) |
EDEN_data |
The name of the list of EDEN data generated from, e.g., lapply(dateRange, fireHydro::getEDEN, returnType = 'raster') or a rasterStack as generated by fireHydro::getAnnualEden(2020). Specifically, object is a list of lists with (1) a date (YYYYMMDD) and (2) EDEN data (must be a rasterStack; in ‘getEDEN()' use argument 'returnType = ’raster''). |
a dataframe formatted identically to the traceDataLong output from extractSimData()
## Not run:
### requires internet connection to download EDEN data
### set regions of interest
locs <- IRMap[[2]]
loc <- locs[locs$INDICATOR %in% 118:119, ]
dateVec <- format(seq.Date(from = as.Date("20201101", format = "%Y%m%d"),
to = as.Date("202012017", format = "%Y%m%d"), by = "day"), format = "%Y%m%d")
### pull and process EDEN data so it's retained in the global environment
EDEN_data <- lapply(dateVec, fireHydro::getEDEN, returnType = 'raster')
input_eden <- list(date = do.call(rbind, lapply(EDEN_data, function(x) {x[[1]]})),
data = do.call(stack, lapply(EDEN_data, function(x) {x[[2]]})))
EDEN_by_IR <- extractEDEN(targetLocations = loc,
targetLocationNames = loc$NAME,
EDEN_data = input_eden)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.