meteo_distance: Find all monitors within a radius of a location

View source: R/meteo_distance.R

meteo_distanceR Documentation

Find all monitors within a radius of a location


This function will identify all weather stations with a specified radius of a location. If no radius is given, the function will return a dataframe of all available monitors, sorted by distance to the location. The limit argument can be used to limit the output dataframe to the x closest monitors to the location.


  units = "deg",
  radius = NULL,
  limit = NULL



The output of ghcnd_stations(), which is a current list of weather stations available through NOAA for the GHCND dataset. The format of this is a dataframe with one row per weather station. Latitude and longitude for the station locations should be in columns with the names "latitude" and "longitude", consistent with the output from ghcnd_stations(). To save time, run the ghcnd_stations call and save the output to an object, rather than rerunning the default every time (see the examples in meteo_nearby_stations()).


Latitude of the location. Southern latitudes should be given as negative values.


Longitude of the location. Western longitudes should be given as negative values.


Units of the latitude and longitude values. Possible values are:

  • deg: Degrees (default);

  • rad: Radians.


A numeric vector giving the radius (in kilometers) within which to search for monitors near a location.


An integer giving the maximum number of monitors to include for each location. The x closest monitors will be kept. Default is NULL (pull everything available, within the radius if the radius is specified).


A dataframe of weather stations near the location. This is the single-location version of the return value for meteo_nearby_stations()


Alex Simmons, Brooke Anderson


## Not run: 
station_data <- ghcnd_stations()
meteo_distance(station_data, -33, 151, radius = 10, limit = 10)
meteo_distance(station_data, -33, 151, radius = 10, limit = 3)

# FIXME - units param is ignored
#meteo_distance(station_data, -33, 151, units = 'rad', radius = 10, limit = 3)

## End(Not run)

rnoaa documentation built on April 27, 2023, 9:08 a.m.