| Type: | Package |
| Title: | Global Surface Summary of the Day ('GSOD') Weather Data Client |
| Version: | 5.0.0 |
| Description: | Provides automated downloading, parsing, cleaning, unit conversion and formatting of Global Surface Summary of the Day ('GSOD') weather data from the from the USA National Centers for Environmental Information ('NCEI'). Units are converted from from United States Customary System ('USCS') units to International System of Units ('SI'). Stations may be individually checked for number of missing days defined by the user, where stations with too many missing observations are omitted. Only stations with valid reported latitude and longitude values are permitted in the final data. Additional useful elements, saturation vapour pressure ('es'), actual vapour pressure ('ea') and relative humidity ('RH') are calculated from the original data using the improved August-Roche-Magnus approximation (Alduchov & Eskridge 1996) and included in the final data set. The resulting metadata include station identification information, country, state, latitude, longitude, elevation, weather observations and associated flags. For information on the 'GSOD' data from 'NCEI', please see the 'GSOD' 'readme.txt' file available from,https://www1.ncdc.noaa.gov/pub/data/gsod/readme.txt. |
| License: | MIT + file LICENSE |
| URL: | https://docs.ropensci.org/GSODR/,https://github.com/ropensci/GSODR |
| BugReports: | https://github.com/ropensci/GSODR/issues |
| Depends: | R (≥ 3.5.0) |
| Imports: | curl, data.table (≥ 1.15.4), lifecycle, R.utils, stats,utils, withr |
| Suggests: | bit64, dplyr, ggplot2, gridExtra, knitr, mapproj, maps,rmarkdown, roxyglobals, spelling, testthat, tidyr |
| VignetteBuilder: | knitr |
| ByteCompile: | TRUE |
| Config/Needs/build: | moodymudskipper/devtag |
| Config/roxyglobals/filename: | globals.R |
| Config/roxyglobals/unique: | FALSE |
| Config/testthat/edition: | 3 |
| Config/testthat/parallel: | true |
| Encoding: | UTF-8 |
| Language: | en-US |
| NeedsCompilation: | no |
| Repository: | CRAN |
| RoxygenNote: | 7.3.3 |
| X-schema.org-applicationCategory: | Tools |
| X-schema.org-isPartOf: | https://ropensci.org |
| X-schema.org-keywords: | US-NCEI, meteorological-data, global-weather,weather, weather-data, meteorology, station-data,surface-weather, data-access, US-NCDC |
| Packaged: | 2025-11-15 12:45:39 UTC; adamsparks |
| Author: | Adam H. Sparks |
| Maintainer: | Adam H. Sparks <adamhsparks@gmail.com> |
| Date/Publication: | 2025-11-15 13:00:02 UTC |
GSODR: Global Surface Summary of the Day ('GSOD') Weather Data Client
Description

Provides automated downloading, parsing, cleaning, unit conversion and formatting of Global Surface Summary of the Day ('GSOD') weather data from the from the USA National Centers for Environmental Information ('NCEI'). Units are converted from from United States Customary System ('USCS') units to International System of Units ('SI'). Stations may be individually checked for number of missing days defined by the user, where stations with too many missing observations are omitted. Only stations with valid reported latitude and longitude values are permitted in the final data. Additional useful elements, saturation vapour pressure ('es'), actual vapour pressure ('ea') and relative humidity ('RH') are calculated from the original data using the improved August-Roche-Magnus approximation (Alduchov & Eskridge 1996) and included in the final data set. The resulting metadata include station identification information, country, state, latitude, longitude, elevation, weather observations and associated flags. For information on the 'GSOD' data from 'NCEI', please see the 'GSOD' 'readme.txt' file available from,https://www1.ncdc.noaa.gov/pub/data/gsod/readme.txt.
Author(s)
Maintainer: Adam H. Sparksadamhsparks@gmail.com (ORCID)
Authors:
Tomislav Hengltom.hengl@isric.org (ORCID)
Andrew Nelsondr.andy.nelson@gmail.com (ORCID)
Other contributors:
Hugh Parsonagehugh.parsonage@gmail.com (ORCID) [copyright holder, contributor]
Taras Kaduktaras.kaduk@gmail.com (Suggestion for handling bulk station downloads moreefficiently) [contributor]
Gwenael Giboiregwenael.giboire@oda-groupe.com (Several bug reports in early versions and testing feedback) [contributor]
Łukasz Pawliklukpawlik@gmail.com (Reported bug in windspeed conversion calculation) [contributor]
Ross DarnellRoss.Darnell@data61.csiro.au (ORCID) (Reported bug in 'Windows OS' versions causing 'GSOD' data untarring tofail) [contributor]
Tyler WiddisonTyler.Widdison@usav.org (Reported bug where'nearest_stations()' did not return stations in order of nearest tofarthest) [contributor]
Wenbo Lvlyu.geosocial@gmail.com (Provided suggestions for improving documentation) [contributor]
Curtin University (ROR) (http://www.curtin.edu.au/) [funder, copyright holder]
Grains Research and Development Corporation (ROR) (GRDC Project CUR2210-005OPX (AAGI-CU)) [funder, copyright holder]
See Also
Useful links:
Report bugs athttps://github.com/ropensci/GSODR/issues
Download and Return a data.table Object of GSOD Weather Data
Description
Automates downloading, cleaning, reformatting of data from the Global SurfaceSummary of the Day (GSOD) data provided by theUS National Centers for Environmental Information (NCEI),Three additional useful elements: saturation vapour pressure (es), actualvapour pressure (ea) and relative humidity (RH) are calculated and returnedin the final data frame using the improved August-Roche-Magnus approximation(Alduchov and Eskridge 1996).
Usage
get_GSOD( years, station = NULL, country = NULL, max_missing = NULL, agroclimatology = FALSE)Arguments
years | Year(s) of weather data to download. |
station | Optional. Specify a station or multiple stations for which toretrieve, check and clean weather data usingSTATION. TheNCEI reports years for which the data are available. This functionchecks against these years. However, not all cases are properly documentedand in some cases files may not exist for download even though it isindicated that data was recorded for the station for a particular year. If astation is specified that does not have an existing file on the server, thisfunction will silently fail and move on to existing files for download andcleaning. |
country | Optional. Specify a country for which to retrieve weatherdata; full name, 2 or 3 letterISO or 2 letterFIPS codescan be used. All stations within the specified country will be returned. |
max_missing | Optional. The maximum number of days allowed to bemissing from a station's data before it is excluded from final file output. |
agroclimatology | Optional. Logical. Only clean data for stationsbetween latitudes 60 and -60 for agroclimatology work, defaults to |
Details
All units are converted to International System of Units (SI),e.g,Fahrenheit to Celsius and inches to millimetres.
Data summarise each year by station, which include vapour pressure andrelative humidity elements calculated from existing data inGSOD.
All missing values in resulting files are represented asNA regardless ofwhich field they occur in.
For a complete list of the fields and description of the contents and units,please refer to Appendix 1 in theGSODR vignette,vignette("GSODR", package = "GSODR").
For more information see the description of the data provided byNCEI,https://www.ncei.noaa.gov/data/global-summary-of-the-day/doc/readme.txt.
Value
Adata.table::data.table() object ofGSOD weather data.
References
Alduchov, O.A. and Eskridge, R.E., 1996. Improved Magnus form approximationof 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.
Note
GSODR attempts to validate year and station combinationrequests, however, in certain cases the start and end date may encompassyears where no data is available. In these cases no data will be returned.It is suggested that the user check the latest data availability for thestation(s) desired usingget_inventory() as this list is frequentlyupdated by theNCEI and is not shipped withGSODR.
WhileGSODR does not distribute GSOD weather data, users ofthe data should note the conditions that the U.S.NCEI places upontheGSOD data.“The following data and products may have conditions placed on theirinternational commercial use. They can be used within the U.S. or for non-commercial international activities without restriction. The non-U.S. datacannot be redistributed for commercial purposes. Re-distribution of thesedata by others must provide this same notification. A log of IP addressesaccessing these data and products will be maintained and may be madeavailable to data providers.”
Author(s)
Adam H. Sparks,adamhsparks@gmail.com
See Also
Examples
# Download weather station data for Toowoomba, Queensland for 2010tbar <- get_GSOD(years = 2010, station = "955510-99999")# Download weather data for the year 1929w_1929 <- get_GSOD(years = 1929)# Download weather data for the year 1929 for Irelandie_1929 <- get_GSOD(years = 1929, country = "Ireland")Download and Return a data.table Object of GSOD Weather Station Data Inventories
Description
This function was deprecated because the handling of country inventories haschanged and I did not want to introduce geospatial package dependencies forthis package.
Usage
get_inventory()Get updates.txt With Information on Updates to the GSOD Data Set
Description
Gets and imports the 'updates.txt' file that has a change log of GSOD data.Changes are shown in order from most recent to oldest changes by the "DATE"field. Column names followGSODR naming conventions.
Usage
get_updates()Value
Adata.table::data.table() object
Examples
get_updates()Find Nearest GSOD Stations to a Specified Latitude and Longitude
Description
Given latitude and longitude values entered as decimal degrees (DD), thisfunction returns a list (as an atomic vector) of station IDvalues, which can be used inget_GSOD() to query for specific stations as anargument in thestation parameter of that function.
Usage
nearest_stations(LAT, LON, distance)Arguments
LAT | Latitude expressed as decimal degrees (DD) (WGS84) |
LON | Longitude expressed as decimal degrees (DD) (WGS84) |
distance | Distance in kilometres from point for which stations are tobe returned. |
Value
Adata.table::data.table() with full station metadata includingthe distance from the user specified coordinates from nearest to farthest.
Note
TheGSOD data, which are downloaded and manipulated byGSODR stipulate that the following notice should be given.“The following data and products may have conditions placed on theirinternational commercial use. They can be used within the U.S. or for non-commercial international activities without restriction. The non-U.S. datacannot be redistributed for commercial purposes. Re-distribution of thesedata by others must provide this same notification.”
Author(s)
Adam H. Sparks,adamhsparks@gmail.com
Examples
# Find stations within a 100km radius of Toowoomba, QLD, AUSn <- nearest_stations(LAT = -27.5598, LON = 151.9507, distance = 100)nTidy and Return a data.table Object of GSOD Data From Local Storage
Description
This function automates cleaning and reformatting ofGSOD stationfiles in
“YEAR.tar.gz”, provided that they have been untarred or“STATION.csv” format that have been downloaded from the United StatesNational Center for Environmental Information's (NCEI)download page. Three additional useful elements: saturation vapour pressure(es), actual vapour pressure (ea) and relative humidity (RH) are calculatedand returned in the final data frame using the improved August-Roche-Magnusapproximation (Alduchov and Eskridge 1996). All units are converted toInternational System of Units (SI),e.g., Fahrenheit to Celsius andinches to millimetres.
Usage
reformat_GSOD(dsn = NULL, file_list = NULL)Arguments
dsn | User supplied full file path to location of data files on localdisk for tidying. |
file_list | User supplied list of file paths to individual files of dataon local disk for tidying. Ignored if |
Details
If multiple stations are given, data are summarised for each year by station,which include vapour pressure and relative humidity elements calculated fromexisting data inGSOD. Else, a single station is tidied and a dataframe is returned.
All missing values in resulting files are represented asNA regardlessof which field they occur in.
Only station files in the original “csv” file format are supported bythis function. If you have downloaded the full annual (“YYYY.tar.gz”)file you will need to extract the individual station files from the tar filefirst to use this function.
Note thatreformat_GSOD() will attempt to reformat any “.csv”files found in thedsn that you provide. If there are non-GSODfiles present this will lead to errors.
For a complete list of the fields and description of the contents and units,please refer to Appendix 1 in theGSODR vignette,vignette("GSODR", package = "GSODR").
Value
A data frame as adata.table::data.table() object ofGSOD data.
References
Alduchov, O.A. and Eskridge, R.E., 1996. Improved Magnus form approximationof saturation vapor pressure. Journal of Applied Meteorology and Climatology,35(4), pp.601-609. DOI:<10.1175%2F1520-0450%281996%29035%3C0601%3AIMFAOS%3E2.0.CO%3B2>.
Note
WhileGSODR does not distributeGSOD weather data,users of the data should note the conditions that the U.S.NCEIplaces upon theGSOD data.“The following data and products may have conditions placed on theirinternational commercial use. They can be used within the U.S. or for non-commercial international activities without restriction. The non-U.S. datacannot be redistributed for commercial purposes. Re-distribution of thesedata by others must provide this same notification. A log of IP addressesaccessing these data and products will be maintained and may be madeavailable to data providers.”
Author(s)
Adam H. Sparks,adamhsparks@gmail.com
See Also
For automated downloading and tidying see theget_GSOD() function, whichprovides expanded functionality for automatically downloading and expandingannualGSOD files and cleaning station files.
Examples
# Download data to 'tempdir()'download.file( url = "https://www.ncei.noaa.gov/data/global-summary-of-the-day/access/2010/95551099999.csv", destfile = file.path(tempdir(), "95551099999.csv"), mode = "wb")# Reformat station data files in R's tempdir() directorytbar <- reformat_GSOD(dsn = tempdir())tbarDownload Latest isd-history.csv File and Update an Internal Database
Description
This function was deprecated because I realised that it broke reproducibilityand the handling of country inventories has changed and I did not want tointroduce geospatial package dependencies for this package.
Usage
update_station_list()