This package provides an R interface for the NOAA Climate Data Online API. Through this interface, different elements of weather data like temperatures (avg/min/max), precipitation, snowfall, etc. can be accessed for various cities for specific time periods.
devtools::install_github("harihp12/cdoapi", build_vignettes = TRUE)
To use this interface, you require a unique API access token. You can get your access token here by registering with your email address. Before using the functions provided by the cdoapi
package, you should set the character token as a system variable.
Sys.setenv("NOAA_TOKEN" = "YOUR_TOKEN_GOES_IN_HERE")
Lists all the available cities for which the weather data can be fetched with get_weatherdata
along with their data availability details.
cities = get_cities()
head(cities)
head(cities[which(cities$country == "SW"), ]) # Cities in Sweden
head(cities[which(cities$country == "GM"), ]) # Cities in Germany
Gets the weather data for a specified - data type (Refer here for detailed documentation about available data types), city ID, start date and end date.
# Get weatherdata for Berlin (only September)
weatherdata = get_weatherdata("TAVG", "GM000001", "2018-09-01", "2018-09-23")
Aggregates and simplifies weather data to an easy-to-use daily data format, which is particularly useful for cities having multiple stations.
weatherdata_simplified = simplify_weatherdata(weatherdata)
To load the shiny app you need to have the library installed and call the following commands on Rstudio:
library(cdoapi)
library(shiny)
runGitHub("harihp12/cdoapi")