getWeatherStationData: Get weather data from NOAA.

View source: R/getWeatherStationData.R

getWeatherStationDataR Documentation

Get weather data from NOAA.

Description

getWeatherStationData Get weather data from NOAA stations by proximity to specified georeference coordinates.

Usage

getWeatherStationData(lat_lon_df, station_data = NULL, hasCols = c("prcp",
  "tmax", "tmin"), verbose = T, date_min = "2000-01-01",
  date_max = "2017-01-01", limit = 100, ...)

Arguments

lat_lon_df

A data.frame with the following columns (names must match): "latitude","longitude","id". The id column specifies the name of the area to search for and is just used for object naming purposes. See rnoaa::meteo_nearby_stations.

station_data

This is an object containing the station names and locations to search though and must be generated by the rnoaa function ghcnd_stations. It is expected to keep this as NULL. When this is the case, the internally stored ghcnd_stations database is used.

hasCols

A character vector specifying the names of weather variables that must be present for the weather station to be used.

verbose

Logical, should status updates be printed?

date_min

The earliest data that must have data from the station. See rnoaa::meteo_nearby_stations.

date_max

The latest data that must have data from the station. See rnoaa::meteo_nearby_stations.

limit

The maximum number of stations to search. If none of these stations have sufficient data, an error is returned. See rnoaa::meteo_nearby_stations.

...

Not currently in use.

Details

This function iterates through NOAA weather collection sites, deterimining whether the data collected satisfies the time and datatype constraints specified.

Value

A data.frame of daily weather data for each location id. If more than one id are included, the data.frames are placed in a named list.

Examples

## Not run: 
ll = data.frame(latitude = c(27.54986,30.38398),
  longitude = c(-97.88101,-97.72938),
  id = c("KING","PKLE"),
  stringsAsFactors = F)
data(station_data)
histWeather<-getWeatherStationData(lat_lon_df = ll,
  station_data = station_data,
  date_min = "2000-01-01",
  hasCols = c("prcp","tmax","tmin"),
  date_max = "2016-12-31")
lapply(histWeather, head)

## End(Not run)


jtlovell/jtlTools documentation built on Jan. 17, 2024, 2:53 p.m.