output |
---|
github_document |
The GSOD or Global Surface Summary of the Day (GSOD) data provided by the US National Centers for Environmental Information (NCEI) are a valuable source of weather data with global coverage. {GSODR} aims to make it easy to find, transfer and format the data you need for use in analysis and provides six main functions for facilitating this:
-
get_GSOD()
- this function queries and transfers files from the NCEI's web server, reformats them and returns a data frame. -
reformat_GSOD()
- this function takes individual station files from the local disk and re-formats them returning a data frame. -
nearest_stations()
- this function returns adata.table
of stations with their metadata and the distance in which they fall from the given radius (kilometres) of a point given as latitude and longitude in order from nearest to farthest. -
get_inventory()
- this function downloads the latest station inventory information from the NCEI's server and returns the header information about the latest version as a message in the console and a tidy data frame of the stations' inventory for each month that data are reported. -
get_history()
- this function downloads the latest version of the isd-history.csv file from the NCEI's server and returns a {data.table} of the information for each station that is available. A version of this file is distributed with {GSODR} internally and can be updated withupdate_internal_isd_history()
. -
get_updates()
- this function downloads the changelog for the GSOD data from the NCEI's server and reorders it by the most recent changes first. -
update_internal_isd_history()
- this function downloads the latest station list from the NCEI's server updates the package's internal database of stations and their metadata. Not recommended for normal use.
When reformatting data either with get_GSOD()
or reformat_GSOD()
, all units are converted to International System of Units (SI), e.g., inches to millimetres and Fahrenheit to Celsius.
File output is returned as a data.table
object, summarising each year by station, which also includes vapour pressure and relative humidity elements calculated from existing data in GSOD.
Additional data are calculated by this R package using the original data and included in the final data.
These include vapour pressure (ea and es) and relative humidity calculated using the improved August-Roche-Magnus approximation (Alduchov and Eskridge 1996).
For more information see the description of the data provided by NCEI, https://www.ncei.noaa.gov/data/global-summary-of-the-day/doc/readme.txt.
A stable version of {GSODR} is available from CRAN.
install.packages("GSODR")
A development version is available from from GitHub. If you wish to install the development version that may have new features or bug fixes before the CRAN version does (but also may not work properly), please install from the rOpenSci R Universe. We strive to keep the main branch on GitHub functional and working properly.
install.packages("GSODR", repos = "https://ropensci.r-universe.dev")
The most common work might be getting data for a single location. Here's an example of fetching data for a station in Toowoomba, Queensland, AU in 2021.
library(GSODR)
tbar <- get_GSOD(years = 2021, station = "955510-99999")
tbar
#> STNID NAME CTRY COUNTRY_NAME ISO2C ISO3C STATE LATITUDE LONGITUDE ELEVATION BEGIN END YEARMODA YEAR MONTH DAY YDAY TEMP TEMP_ATTRIBUTES DEWP DEWP_ATTRIBUTES SLP SLP_ATTRIBUTES STP STP_ATTRIBUTES VISIB VISIB_ATTRIBUTES
#> <char> <char> <char> <char> <char> <char> <char> <num> <num> <num> <int> <int> <Date> <int> <int> <int> <int> <num> <int> <num> <int> <num> <int> <num> <int> <num> <int>
#> 1: 955510-99999 TOOWOOMBA AIRPORT AS AUSTRALIA AU AUS -27.55 151.917 642 19980301 20240909 2021-01-01 2021 1 1 1 20.9 16 18.1 15 1011.5 16 940.5 16 NA 0
#> 2: 955510-99999 TOOWOOMBA AIRPORT AS AUSTRALIA AU AUS -27.55 151.917 642 19980301 20240909 2021-01-02 2021 1 2 2 21.2 16 17.8 16 1009.1 16 938.2 16 NA 0
#> 3: 955510-99999 TOOWOOMBA AIRPORT AS AUSTRALIA AU AUS -27.55 151.917 642 19980301 20240909 2021-01-03 2021 1 3 3 21.0 16 19.2 16 1008.3 16 937.4 16 NA 0
#> 4: 955510-99999 TOOWOOMBA AIRPORT AS AUSTRALIA AU AUS -27.55 151.917 642 19980301 20240909 2021-01-04 2021 1 4 4 22.2 16 19.4 15 1008.6 16 937.7 16 NA 0
#> 5: 955510-99999 TOOWOOMBA AIRPORT AS AUSTRALIA AU AUS -27.55 151.917 642 19980301 20240909 2021-01-05 2021 1 5 5 23.6 16 19.8 16 1009.3 16 938.4 16 NA 0
#> ---
#> 358: 955510-99999 TOOWOOMBA AIRPORT AS AUSTRALIA AU AUS -27.55 151.917 642 19980301 20240909 2021-12-27 2021 12 27 361 20.5 24 16.2 24 1009.3 24 938.1 24 NA 0
#> 359: 955510-99999 TOOWOOMBA AIRPORT AS AUSTRALIA AU AUS -27.55 151.917 642 19980301 20240909 2021-12-28 2021 12 28 362 16.7 24 13.1 24 1012.0 24 940.7 24 NA 0
#> 360: 955510-99999 TOOWOOMBA AIRPORT AS AUSTRALIA AU AUS -27.55 151.917 642 19980301 20240909 2021-12-29 2021 12 29 363 18.1 24 13.7 24 1012.4 24 941.0 24 NA 0
#> 361: 955510-99999 TOOWOOMBA AIRPORT AS AUSTRALIA AU AUS -27.55 151.917 642 19980301 20240909 2021-12-30 2021 12 30 364 18.4 24 13.5 24 1012.6 24 941.2 24 NA 0
#> 362: 955510-99999 TOOWOOMBA AIRPORT AS AUSTRALIA AU AUS -27.55 151.917 642 19980301 20240909 2021-12-31 2021 12 31 365 18.4 24 17.0 21 1010.9 24 939.7 24 NA 0
#> WDSP WDSP_ATTRIBUTES MXSPD GUST MAX MAX_ATTRIBUTES MIN MIN_ATTRIBUTES PRCP PRCP_ATTRIBUTES SNDP I_FOG I_RAIN_DRIZZLE I_SNOW_ICE I_HAIL I_THUNDER I_TORNADO_FUNNEL EA ES RH
#> <num> <int> <num> <num> <num> <char> <num> <char> <num> <char> <num> <num> <num> <num> <num> <num> <num> <num> <num> <num>
#> 1: 8.0 16 9.8 NA 25.6 * 16.7 <NA> 2.03 G NA 1 1 0 0 0 0 2.1 2.5 84.0
#> 2: 6.2 16 9.3 NA 25.7 * 17.6 <NA> 0.25 G NA 0 0 0 0 0 0 2.0 2.5 81.0
#> 3: 4.9 16 8.2 NA 25.5 * 17.7 <NA> 19.05 G NA 1 1 0 0 0 0 2.2 2.5 89.5
#> 4: 3.9 16 5.7 NA 25.0 * 18.8 <NA> 0.25 G NA 0 0 0 0 0 0 2.2 2.7 84.2
#> 5: 3.4 16 7.7 NA 28.1 * 19.0 <NA> 0.51 G NA 0 0 0 0 0 0 2.3 2.9 79.3
#> ---
#> 358: 7.0 24 9.8 NA 27.2 * 17.0 * 0.00 I NA 0 0 0 0 0 0 1.8 2.4 76.4
#> 359: 8.2 24 10.8 NA 20.2 * 13.5 * 0.00 I NA 0 0 0 0 0 0 1.5 1.9 79.3
#> 360: 8.7 24 10.8 NA 24.0 * 13.4 <NA> 0.00 I NA 0 0 0 0 0 0 1.6 2.1 75.5
#> 361: 8.4 24 11.8 NA 24.5 * 13.9 <NA> 0.25 G NA 0 1 0 0 0 0 1.5 2.1 73.1
#> 362: 9.2 24 12.3 NA 22.2 * 14.8 <NA> 7.11 G NA 0 1 0 0 0 0 1.9 2.1 91.6
There are several other sources of weather data and ways of retrieving them through R. Several are also rOpenSci projects.
{clifro} from rOpenSci is a web portal to the New Zealand National Climate Database and provides public access (via subscription) to around 6,500 various climate stations (see https://cliflo.niwa.co.nz/ for more information). Collating and manipulating data from CliFlo (hence clifro) and importing into R for further analysis, exploration and visualisation is now straightforward and coherent. The user is required to have an Internet connection, and a current CliFlo subscription (free) if data from stations, other than the public Reefton electronic weather station, is sought.
{GSODTools} by Florian Detsch is an R package that offers similar functionality as {GSODR}, but also has the ability to graph the data and working with data for time series analysis.
{nasapower} from rOpenSci aims to make it quick and easy to automate downloading of the NASA-POWER global meteorology, surface solar energy and climatology data in your R session as a tidy tibble
object for analysis and use in modelling or other purposes.
POWER (Prediction Of Worldwide Energy Resource) data are freely available for download with varying spatial resolutions dependent on the original data and with several temporal resolutions depending on the POWER parameter and community.
{riem} from rOpenSci allows to get weather data from Automated Surface Observing System (ASOS) stations (airports) in the whole world thanks to the Iowa Environment Mesonet website.
{rnoaa}, from rOpenSci offers tools for interacting with and downloading weather data from the United States National Oceanic and Atmospheric Administration but lacks support for GSOD data.
{stationaRy}, from Richard Iannone offers hourly meteorological data from stations located all over the world. There is a wealth of data available, with historic weather data accessible from nearly 30,000 stations.
{weathercan} from rOpenSci makes it easier to search for and download multiple months/years of historical weather data from Environment and Climate Change Canada (ECCC) website.
{weatherOz} aims to facilitate access and download weather and climate data for Australia from Australian data sources. Data are sourced from from the Western Australian Department of Primary Industries and Regional Development (DPIRD) and the Scientific Information for Land Owners (SILO) API endpoints and the Australian Government Bureau of Meteorology’s (BOM) FTP server.
{worldmet} provides an easy way to access data from the NOAA Integrated Surface Database (ISD) (the same database {GSODR} provides access to. The ISD contains detailed surface meteorological data from around the world for over 35,000 locations. However, rather than daily values, the package outputs (typically hourly meteorological data) and works very well with the {openair} package.
Cite as: NOAA National Centers of Environmental Information. 1999. Global Surface Summary of the Day - GSOD. 1.0. [indicate subset used]. NOAA National Centers for Environmental Information. Accessed [date].
Users of these data should take into account the following:
The data summaries provided here are based on data exchanged under the World Meteorological Organization (WMO) World Weather Watch Program according to WMO Resolution 40 (Cg-XII). This allows WMO member countries to place restrictions on the use or re-export of their data for commercial purposes outside of the receiving country. Data for selected countries may, at times, not be available through this system. Those countries' data summaries and products which are available here are intended for free and unrestricted use in research, education, and other non-commercial activities. However, for non-U.S. locations' data, the data or any derived product shall not be provided to other users or be used for the re-export of commercial services.
-
Please report any issues or bugs.
-
License: MIT
-
To cite {GSODR}, please use: Adam H. Sparks, Tomislav Hengl and Andrew Nelson (2017). GSODR: Global Summary Daily Weather Data in R. The Journal of Open Source Software, 2(10). DOI: 10.21105/joss.00177.
Please note that this package is released with a Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms.
Alduchov, O.A. and Eskridge, R.E., 1996. Improved Magnus form approximation of saturation vapor pressure. Journal of Applied Meteorology and Climatology, 35(4), pp. 601-609 DOI: 10.1175/1520-0450(1996)035<0601:IMFAOS>2.0.CO;2.
All contributions to this project are gratefully acknowledged using the allcontributors
package following the all-contributors specification. Contributions of any kind are welcome!
adamhsparks |
cboettig |
karthik |
noamross |
amine67 |
ckumarMT |
GwenGitHub |
thengl |
lukuxus |
rsmiller74 |
fdetsch |