convertQuarterlyToList | R Documentation |
Takes quarterly EDEN data and produces output identical to lapply(dateVector, getEDEN), much more rapidly than downloading individual days of data.
convertQuarterlyToList(quarterlyEDEN_data, returnClass = "SpatialPolygonsDataFrame")
quarterlyEDEN_data |
quarterly EDEN water level data, as produced by, e.g., getOldEDEN(YYYYMMDD = gsub(x = Sys.Date(), pattern = "-", replacement = ""), quarterly = TRUE) |
returnClass |
class of data returned. Needs to be either SpatialPolygonsDataFrame or raster |
list convertQuarterlyToList
returns a list with an element for each day in the quarter. Each sub-list contains two elements: (1) the date (character vector), and (2) an sf multipolygon object with water depths (not stages) in the EDEN grid.
## Not run: ### Example of use in context of other functions in RSM and fireHydro library(RSM) sim_means <- polyDat$traceDataLong[!is.na(polyDat$traceDataLong$value), ] ### add grouping variable sim_means$cluster <- sim_clusters[match(sim_means$simulation, sim_clusters$simulation), 1] IR_pattern <- "WCA-1" # pull EDEN data for quarter EDEN_qtr <- getOldEDEN(YYYYMMDD = "20200312", quarterly = TRUE) # convert quarterly data to list-of-lists (match output from lapply(dates, getEDEN)) inputTest <- convertQuarterlyToList(EDEN_qtr) ### convoluted transformation from list of Dates to character vector dateVec <- sapply(inputTest, "[[", 1) EDEN_by_IR <- RSM::getEDENbyROI(targetLocations = ROIs, targetLocationNames = targetLocationNames, dateRange = dateVec, needEDEN = inputTest) RSM::tracePlot(namesMatching = IR_pattern, simMeansObject = sim_means) + geom_line(data = EDEN_by_IR, mapping = aes(x = date, y = ave), size = 1.5) ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.