Create a plot to be used as a single "frame" in a timeseries video. This function is tailored to communities working with the South Coast Air Quality Management District.
sensor_videoFrame( sensor = sensor_load(), communityRegion = NULL, frameTime = NULL, timeInfo = NULL, timeAxis = NULL, timeTicks = NULL, timeLabels = NULL, map = NULL, logo = NULL, colorPalette = NULL, colorBins = NULL )
sensor | An AirSensor object. |
---|---|
communityRegion | The area to display. |
frameTime | POSIXct specifying the time to use. |
timeInfo | Dataframe created with |
timeAxis | Movie time axis. |
timeTicks | Movie time ticks. |
timeLabels | Movie time labels. |
map | A pre-generated basemap image. |
logo | A PNG image to be placed near the upper right of the image. |
colorPalette | Vector of colors to use. |
colorBins | Vector of numeric breaks used to map pm25 values to colors |
A plot is generated. Nothing is returned.
if (FALSE) { # Fourth of July in Seal Beach library(MazamaSpatialUtils) start <- lubridate::ymd_h("2019-07-04 00", tz = "America/Los_Angeles") end <- start + lubridate::days(3) sensor <- sensor_load("scaqmd") movieData <- sensor %>% sensor_filterMeta(communityRegion == "Seal Beach") %>% sensor_filterDate(start, end) # Seal Beach map lon <- -118.083 lat <- 33.767 zoom <- 15 map <- PWFSLSmoke::staticmap_getStamenmapBrick( centerLon = lon, centerLat = lat, zoom = zoom, width = 770, height = 495 ) tickSkip <- 6 timeAxis <- movieData$data$datetime timeTicks <- timeAxis[(lubridate::hour(timeAxis) - 1) %% tickSkip == 0 & lubridate::minute(timeAxis) == 0] timeLabels <- strftime(timeTicks, "%l %P") timeInfo <- PWFSLSmoke::timeInfo(timeAxis, longitude = lon, latitude = lat) frameTime <- lubridate::ymd_h("2019-07-04 21", tz="America/Los_Angeles") timeInfo <- PWFSLSmoke::timeInfo(frameTime, lon, lat) sensor_videoFrame( sensor = sensor, communityRegion = "Seal Beach", frameTime = frameTime, timeInfo = timeInfo, timeAxis = timeAxis, timeTicks = timeTicks, timeLabels = timeLabels, map = map # logo = png::readPNG("~/Desktop/ms_logo.png") ) }