Skip to contents

This function retrieves the nearest weather stations from the NOAA GHCN-Daily dataset given a latitude and longitude coordinate. It returns information about each station, including its location, elevation, the date range of available data, and available variables.

Usage

get_ghcn_daily_stations(lat, lon, token, radius = 50, limit = 5)

Arguments

lat

Numeric. Latitude of the point of interest.

lon

Numeric. Longitude of the point of interest.

token

Character. NOAA API token for authentication.

radius

Numeric. Search radius in kilometers. Default is 50 km.

limit

Integer. Maximum number of stations to return. Default is 5.

Value

A data frame containing information about the nearest weather stations, including:

id

Character. The station identifier.

name

Character. The name of the station.

latitude

Numeric. The station's latitude.

longitude

Numeric. The station's longitude.

elevation

Numeric. The station's elevation.

mindate

Date. The earliest date for which the station has data.

maxdate

Date. The latest date for which the station has data.

distance

Numeric. The calculated distance from the input coordinates in degrees.

available_vars

Character. Comma-separated list of available variables.

Examples

if (FALSE) { # \dontrun{
stations <- get_ghcn_daily_stations(lat = 40.7128, lon = -74.006, token = "your_noaa_token_here")
print(stations)
} # }