Skip to contents

Finds the nearest long term NOAA gauge to each input site using sf::st_nearest_feature(), joins the corresponding gauge attributes to the site table, and calculates the straight-line distance between the site and gauge.

Usage

findNearestNoaaGauge(sites, site_lat = "latitude", site_lon = "longitude")

Arguments

sites

A data frame, tibble, or sf object containing site locations.

site_lat

Character. Name of the latitude column in sites. Default is "latitude".

site_lon

Character. Name of the longitude column in sites. Default is "longitude".

Value

An data.frame object containing the original site attributes and geometry, attributes of the nearest gauge, and distance to the gauge in meters and kilometers.

Details

sites may be data frame containing latitude and longitude columns or existing sf objects.

Distances are straight-line geographic distances. For coastal and estuarine applications, the nearest gauge by straight-line distance may not necessarily be the most hydrologically connected gauge. This also won't work outside the U.S.