Learn R Programming

climate (version 1.2.1)

nearest_stations_noaa: List of nearby SYNOP stations for a defined geographical location

Description

Returns a data frame of meteorological stations with their coordinates and distance from a given location based on the noaa website. The returned list is valid only for a given day.

Usage

nearest_stations_noaa(
  country,
  date = Sys.Date(),
  add_map = TRUE,
  point = NULL,
  no_of_stations = 10,
  allow_failure = TRUE
)

Value

A data.frame with number of nearest station according to given point columns describing stations parameters (e.g. ID station, distance from point, geographic coordinates, etc.) where each row represent a measurement, each station which has a measurements on selected date. If add_map = TRUE additional map of downloaded data is added.

Arguments

country

country name (e.g., "SRI LANKA"). Single entries allowed only.

date

optionally, a day when measurements were done in all available locations; current Sys.Date used by default

add_map

logical - whether to draw a map for a returned data frame (requires maps/mapdata packages)

point

a vector of two coordinates (longitude, latitude) for a point we want to find nearest stations to (e.g. c(80, 6)). If not provided the query will be based on a mean longitude and latitude among available dataset.

no_of_stations

how many nearest stations will be returned from the given geographical coordinates; default 30

allow_failure

logical - whether to allow or stop on failure. By default set to TRUE. For debugging purposes change to FALSE

Examples

Run this code
# \donttest{
  nearest_stations_noaa(country = "SRI LANKA", 
  point = c(80, 6),
  add_map = TRUE, 
  no_of_stations = 10)
  
  uk_stations = nearest_stations_noaa(country = "UNITED KINGDOM", no_of_stations = 100)
# }

Run the code above in your browser using DataLab