PWFSLSmoke (version 1.2.100)

monitor_subsetByDistance: Subset ws_monitor Object by Distance from Target Location

Description

Subsets ws_monitor to include only those monitors (or grid cells) within a certain radius of a target location. If no monitors (or grid cells) fall within the specified radius, ws_monitor$data and ws_monitor$meta are set to NULL.

When count is used, a ws_monitor object is created containing up to count monitors, ordered by increasing distance from the target location. Thus, note that the number of monitors (or grid cells) returned may be less than the specified count value if fewer than count monitors (or grid cells) are found within the specified radius of the target location.

Usage

monitor_subsetByDistance(ws_monitor, longitude = NULL, latitude = NULL,
  radius = 50, count = NULL)

Arguments

ws_monitor

ws_monitor object

longitude

target longitude from which the radius will be calculated

latitude

target latitude from which the radius will be calculated

radius

distance (km) of radius from target location -- default=300

count

number of grid cells to return

Value

A ws_monitor object with monitors near a location.

See Also

monitorDistance

Examples

Run this code
# NOT RUN {
# Napa Fires -- October, 2017
ca <- airnow_loadAnnual(2017) %>%
  monitor_subset(tlim=c(20171001,20171101), stateCodes='CA')
Vallejo <- monitor_subset(ca, monitorIDs='060950004_01')
Napa_Fires <- monitor_subsetByDistance(ca,
                                       longitude = Vallejo$meta$longitude,
                                       latitude = Vallejo$meta$latitude,
                                       radius = 50)
monitor_leaflet(Napa_Fires)
# }

Run the code above in your browser using DataLab