Returns stations that match the name provided OR which are within dist
km of the location provided. This is designed to provide the user with
information with which to decide which station to then get weather data from.
stations_search( name = NULL, coords = NULL, dist = 10, interval = c("hour", "day", "month"), normals_only = FALSE, stn = weathercan::stations, starts_latest = NULL, ends_earliest = NULL, verbose = FALSE, quiet = FALSE )
name | Character. A vector of length 1 or more with text against which
to match. Will match station names that contain all components of
|
---|---|
coords | Numeric. A vector of length 2 with latitude and longitude of a
place to match against. Overrides |
dist | Numeric. Match all stations within this many kilometres of the
|
interval | Character. Return only stations with data at these intervals. Must be any of "hour", "day", "month". |
normals_only | Logical. Return only stations with climate normals? |
stn | Data frame. The |
starts_latest | Numeric. Restrict results to stations with data collection beginning in or before the specified year. |
ends_earliest | Numeric. Restrict results to stations with data collection ending in or after the specified year. |
verbose | Logical. Include progress messages |
quiet | Logical. Suppress all messages (including messages regarding missing data, etc.) |
Returns a subset of the stations data frame which match the search
parameters. If the search was by location, an extra column 'distance' shows
the distance in kilometres from the location to the station. If no stations
are found withing dist
, the closest 10 stations are returned.
To search by coordinates, users must make sure they have the sp package installed.
stations_search(name = "Kamloops")#> # A tibble: 40 x 14 #> prov station_name station_id climate_id WMO_id TC_id lat lon elev tz #> <chr> <chr> <dbl> <chr> <dbl> <chr> <dbl> <dbl> <dbl> <chr> #> 1 BC KAMLOOPS 1274 1163779 NA NA 50.7 -120. 379. Etc/… #> 2 BC KAMLOOPS 1274 1163779 NA NA 50.7 -120. 379. Etc/… #> 3 BC KAMLOOPS A 1275 1163780 71887 YKA 50.7 -120. 345. Etc/… #> 4 BC KAMLOOPS A 1275 1163780 71887 YKA 50.7 -120. 345. Etc/… #> 5 BC KAMLOOPS A 1275 1163780 71887 YKA 50.7 -120. 345. Etc/… #> 6 BC KAMLOOPS A 51423 1163781 71887 YKA 50.7 -120. 345. Etc/… #> 7 BC KAMLOOPS A 51423 1163781 71887 YKA 50.7 -120. 345. Etc/… #> 8 BC KAMLOOPS AF… 1276 1163790 NA NA 50.7 -120. 701 Etc/… #> 9 BC KAMLOOPS AF… 1276 1163790 NA NA 50.7 -120. 701 Etc/… #> 10 BC KAMLOOPS AUT 42203 1163842 71741 ZKA 50.7 -120. 345 Etc/… #> # … with 30 more rows, and 4 more variables: interval <chr>, start <dbl>, #> # end <dbl>, normals <lgl>stations_search(name = "Kamloops", interval = "hour")#> # A tibble: 3 x 14 #> prov station_name station_id climate_id WMO_id TC_id lat lon elev tz #> <chr> <chr> <dbl> <chr> <dbl> <chr> <dbl> <dbl> <dbl> <chr> #> 1 BC KAMLOOPS A 1275 1163780 71887 YKA 50.7 -120. 345. Etc/… #> 2 BC KAMLOOPS A 51423 1163781 71887 YKA 50.7 -120. 345. Etc/… #> 3 BC KAMLOOPS AUT 42203 1163842 71741 ZKA 50.7 -120. 345 Etc/… #> # … with 4 more variables: interval <chr>, start <dbl>, end <dbl>, #> # normals <lgl>stations_search(name='Ottawa', starts_latest=1950, ends_earliest=2010)#> # A tibble: 3 x 14 #> prov station_name station_id climate_id WMO_id TC_id lat lon elev tz #> <chr> <chr> <dbl> <chr> <dbl> <chr> <dbl> <dbl> <dbl> <chr> #> 1 ON OTTAWA CDA 4333 6105976 NA WCG 45.4 -75.7 79.2 Etc/… #> 2 ON OTTAWA MACD… 4337 6106000 71628 YOW 45.3 -75.7 114 Etc/… #> 3 ON OTTAWA MACD… 4337 6106000 71628 YOW 45.3 -75.7 114 Etc/… #> # … with 4 more variables: interval <chr>, start <dbl>, end <dbl>, #> # normals <lgl>#> # A tibble: 17 x 15 #> prov station_name station_id climate_id WMO_id TC_id lat lon elev tz #> <chr> <chr> <dbl> <chr> <dbl> <chr> <dbl> <dbl> <dbl> <chr> #> 1 BC PRINCE GEOR… 629 1096435 NA NA 53.9 -123. 569. Etc/… #> 2 BC PRINCE GEOR… 629 1096435 NA NA 53.9 -123. 569. Etc/… #> 3 BC PRINCE GEOR… 637 1096470 NA NA 53.9 -123. 591. Etc/… #> 4 BC PRINCE GEOR… 637 1096470 NA NA 53.9 -123. 591. Etc/… #> 5 BC PRINCE GEOR… 50169 1096454 NA VPX 53.9 -123. 601 Etc/… #> 6 BC PRINCE GEOR… 50169 1096454 NA VPX 53.9 -123. 601 Etc/… #> 7 BC PR GEORGE F… 634 1096460 NA NA 53.9 -123. 579. Etc/… #> 8 BC PR GEORGE F… 634 1096460 NA NA 53.9 -123. 579. Etc/… #> 9 BC PRINCE GEOR… 636 1096468 NA NA 53.9 -123. 579 Etc/… #> 10 BC PRINCE GEOR… 636 1096468 NA NA 53.9 -123. 579 Etc/… #> 11 BC PRINCE GEOR… 631 1096450 71896 YXS 53.9 -123. 691. Etc/… #> 12 BC PRINCE GEOR… 631 1096450 71896 YXS 53.9 -123. 691. Etc/… #> 13 BC PRINCE GEOR… 631 1096450 71896 YXS 53.9 -123. 691. Etc/… #> 14 BC PRINCE GEOR… 48248 1096453 71302 VXS 53.9 -123. 680 Etc/… #> 15 BC PRINCE GEOR… 48248 1096453 71302 VXS 53.9 -123. 680 Etc/… #> 16 BC PRINCE GEOR… 48370 1096439 71896 YXS 53.9 -123. 691 Etc/… #> 17 BC PRINCE GEOR… 48370 1096439 71896 YXS 53.9 -123. 691 Etc/… #> # … with 5 more variables: interval <chr>, start <dbl>, end <dbl>, #> # normals <lgl>, distance <dbl>