R/monitor_subsetByDistance.R
monitor_subsetByDistance.Rd
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.
monitor_subsetByDistance( ws_monitor, longitude = NULL, latitude = NULL, radius = 50, count = NULL )
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 |
A ws_monitor object with monitors near a location.
monitorDistance
# \donttest{ # Fail gracefully if any resources are not available try({ library(PWFSLSmoke) # 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) if ( interactive() ) { monitor_leaflet(Napa_Fires) } }, silent = FALSE) # }