monitor_subsetByDistance: Subset ws_monitor Object by Distance from Target Location

Description Usage Arguments Value See Also Examples

View source: R/monitor_subsetByDistance.R

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

1
2
3
4
5
6
7
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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
# 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)

PWFSLSmoke documentation built on Nov. 23, 2021, 5:06 p.m.