Skip to contents

Searches for stations in NOAA's National Centers for Environmental Information (NCEI) using the Common Access Search Service API.

Usage

ncei_stations(
  dataset,
  bbox = NULL,
  start_date = NULL,
  end_date = NULL,
  data_types = NULL,
  text = NULL,
  limit = 100L,
  offset = 0L
)

Arguments

dataset

Character string. The dataset to search within, such as "daily-summaries" (GHCND) or "global-hourly" (ISD). See ncei_datasets() for more dataset identifiers.

bbox

Optional numeric vector of length 4 specifying the geographic search area as c(north, west, south, east) in decimal degrees. North and south must be between -90 and 90; west and east between -180 and 180. When NULL no geographic filter is applied.

start_date, end_date

Optional date range filter. Only stations with data overlapping this period are returned. Accepts Date objects or "YYYY-MM-DD" strings.

data_types

Optional character vector of data type codes. Only stations that include all requested types are returned.

text

Optional character string. Filters results to stations whose names contain this text.

limit

Integer. Maximum number of stations to return per page (default 100, max 1000).

offset

Integer. Zero-based pagination offset (default 0).

Value

A tibble with one row per station and the following columns:

station_id

Station identifier (dataset prefix stripped, e.g., "USW00023183" rather than "GHCND:USW00023183").

name

Station name.

latitude,longitude

Decimal-degree coordinates.

elevation

Elevation in metres.

start_date,end_date

Period of record as Date objects.

data_coverage

Fraction of expected observations present (0–1).

Details

This function calls https://www.ncei.noaa.gov/access/services/search/v1/data.

To find stations near a specific point, compute a bounding box with ncei_bbox() and pass it to bbox. For site-level station searches prefer closest_noaa_stations(), which computes the bounding box automatically and filters by geodesic distance.

Examples

if (FALSE) { # \dontrun{
# All daily-summaries stations in a region
ncei_stations(
  dataset = "daily-summaries",
  bbox = c(40, -100, 38, -98)
)

# Hourly stations with temperature data and a long record
ncei_stations(
  dataset = "global-hourly",
  start_date = "1990-01-01",
  end_date = Sys.Date()
)
} # }