Learn R Programming

rnoaa (version 0.5.6)

isd_stations: Get NOAA ISD/ISH station data from NOAA FTP server.

Description

Get NOAA ISD/ISH station data from NOAA FTP server.

Usage

isd_stations(refresh = FALSE, path = NULL, ...)

isd_stations_search(lat = NULL, lon = NULL, radius = NULL, bbox = NULL, ...)

Arguments

refresh
(logical) Download station data from NOAA ftp server again. Default: FALSE
path
(character) If refresh=TRUE, this is the path where file is saved. If refresh=FALSE, this argument is ignored.
...
Curl options passed on to GET
lat
(numeric) Latitude, in decimal degree
lon
(numeric) Latitude, in decimal degree
radius
(numeric) Radius (in km) to search from the lat,lon coordinates
bbox
(numeric) Bounding box, of the form: min-longitude, min-latitude, max-longitude, max-latitude

Value

isd_stations returns a data.frame with the columns:
  • usaf - USAF number, character
  • wban - WBAN number, character
  • station_name - station name, character
  • ctry - Country, if given, character
  • state - State, if given, character
  • icao - ICAO number, if given, character
  • lat - Latitude, if given, numeric
  • lon - Longitude, if given, numeric
  • elev_m - Elevation, if given, numeric
  • begin - Begin date of data coverage, of form YYYYMMDD, numeric
  • end - End date of data coverage, of form YYYYMMDD, numeric
isd_stations_search returns a data.frame, if any matches, with the same columns as listed above

Details

isd_stations_search requires geojsonio and lawn, but are not imported in this package, so they aren't required for the rest of the package to operate - only this function. Install those from CRAN if you don't already have them. When using isd_station_search we clean up the data.frame, removing stations with no lat/long coordinates, those with impossible lat/long coordinates, and those at 0,0.

References

ftp://ftp.ncdc.noaa.gov/pub/data/noaa/

See Also

isd

Examples

Run this code
## Not run: ------------------------------------
# # Get station table
# stations <- isd_stations()
# head(stations)
# 
# ## plot stations
# ### remove incomplete cases, those at 0,0
# df <- stations[complete.cases(stations$lat, stations$lon), ]
# df <- df[df$lat != 0, ]
# ### make plot
# library("leaflet")
# leaflet(data = df) %>%
#   addTiles() %>%
#   addCircles()
# 
# # Search for stations by various inputs
# ## bounding box
# bbox <- c(-125.0, 38.4, -121.8, 40.9)
# (out <- isd_stations_search(bbox = bbox))
# 
# ## lat, long, radius
# isd_stations_search(lat = 38.4, lon = -123, radius = 250)
# 
# ### then plot...
## ---------------------------------------------

Run the code above in your browser using DataLab