get_GSOD: Download and Return a Tidy Data Frame of GSOD Weather Data

Description Usage Arguments Details Value Note Author(s) References See Also Examples

View source: R/get_GSOD.R


This function automates downloading, cleaning, reformatting of data from the Global Surface Summary of the Day (GSOD) data provided by the US National Centers for Environmental Information (NCEI), Three additional useful elements: saturation vapour pressure (es), actual vapour pressure (ea) and relative humidity (RH) are calculated and returned in the final data frame.


get_GSOD(years = NULL, station = NULL, country = NULL,
  max_missing = NULL, agroclimatology = FALSE)



Year(s) of weather data to download.


Optional. Specify a station or multiple stations for which to retrieve, check and clean weather data using STNID. The NCEI reports years for which the data are available. This function checks against these years. However, not all cases are properly documented and in some cases files may not exist on the FTP server even though it is indicated that data was recorded for the station for a particular year. If a station is specified that does not have an existing file on the server, this function will silently fail and move on to existing files for download and cleaning from the FTP server.


Optional. Specify a country for which to retrieve weather data; full name or ISO codes can be used.


Optional. The maximum number of days allowed to be missing from a station's data before it is excluded from final file output.


Optional. Logical. Only clean data for stations between latitudes 60 and -60 for agroclimatology work, defaults to FALSE. Set to TRUE to include only stations within the confines of these latitudes.


Stations reporting a latitude of < -90 or > 90 or longitude of < -180 or > 180 are removed. Stations may be individually checked for number of missing days to assure data quality and omitting stations with too many missing observations.

All units are converted to International System of Units (SI), e.g. Fahrenheit to Celsius and inches to millimetres.

Alternative elevation measurements are supplied for missing values or values found to be questionable based on the Consultative Group for International Agricultural Research's Consortium for Spatial Information group's (CGIAR-CSI) Shuttle Radar Topography Mission 90 metre (SRTM 90m) digital elevation data based on NASA's original SRTM 90m data. Further information on these data and methods can be found on GSODR's GitHub repository.

Data summarise each year by station, which include vapour pressure and relative humidity elements calculated from existing data in GSOD.

All missing values in resulting files are represented as NA regardless of which field they occur in.

For a complete list of the fields and description of the contents and units, please refer to Appendix 1 in the GSODR vignette, vignette("GSODR", package = "GSODR").

For more information see the description of the data provided by NCEI,


A data frame as a tibble object of weather data.


While GSODR does not distribute GSOD weather data, users of the data should note the conditions that the U.S. NCEI places upon the GSOD data. “The following data and products may have conditions placed on their international commercial use. They can be used within the U.S. or for non-commercial international activities without restriction. The non-U.S. data cannot be redistributed for commercial purposes. Re-distribution of these data by others must provide this same notification.”


Adam H Sparks, [email protected]


Jarvis, A., Reuter, H. I, Nelson, A., Guevara, E. (2008) Hole-filled SRTM for the globe Version 4, available from the CGIAR-CSI SRTM 90m Database

See Also



## Not run: 
# Download weather station for Toowoomba, Queensland for 2010
t <- get_GSOD(years = 2010, station = "955510-99999")

# Download data for Philippines for year 2010 with a maximum of five missing
days per station allowed.

get_GSOD(years = 2010, country = "Philippines", max_missing = 5)

# Download global GSOD data for agroclimatology work for years 2009 and 2010

get_GSOD(years = 2010:2011, agroclimatology = TRUE)

## End(Not run)

GSODR documentation built on June 16, 2018, 1:38 p.m.