make_GSOD_set: Make a data set of GSOD data suitable for interpolation

View source: R/make_gsod_set.R

make_GSOD_setR Documentation

Make a data set of GSOD data suitable for interpolation

Description

This function can be wrapped in an base::lapply() function to retrieve and save multiple years of GSOD data for interpolation, though it may be used to retrieve GSOD data and interpolate files on-the-fly. See utils::vignette("glint") for more details and examples.

Usage

make_GSOD_set(years, dsn = NULL)

Arguments

years

A numeric vector of years of GSOD data to get for interpolation. Defaults to current year.

dsn

Optional. A file path where resulting fst files are to be saved on local disk. If unspecified a tidy data frame is returned in the R session.

Details

This function will get GSOD data using GSODR::get_GSOD() and save a CSV file containing only the following fields to use in interpolating a global surface between 60 and -60 degrees latitude.

STNID

A unique station id number that can be used to identify the station and link with GSODR data for station metadata.

LONGITUDE

Longitude in decimal degrees.

LATITUDE

Latitude in decimal degrees.

ELEVATION

Elevation in metres.

YEAR

The year (YYYY).

YDAY

Sequential day of year.

TEMP

Mean daily temperature in degrees C to tenths. Missing = NA.

MAX

Maximum temperature reported during the day in Celsius to tenths. Missing = NA;

MIN

Minimum temperature reported during the day in Celsius to tenths. Missing = NA;

RH

Mean daily relative humidity. Missing = NA.

Value

A base::list() of base::data.frame objects containing GSOD data suitable for interpolation using interpolate_gsod() and optionally data files written to disk in fst::fst() format.

Author(s)

Adam H. Sparks, adamhsparks@gmail.com

Examples


# Get one year of GSOD data
#gsod_1998 <- make_GSOD_set(years = 1998)



# Get multiple years of GSOD data and save to disk
#years <- as.list(seq(from = 1983, to = 2017, by = 1))
#lapply(X = years, FUN = make_GSOD_set, dsn = "~/Data/GSOD")


adamhsparks/GRID documentation built on Jan. 27, 2023, 5:48 a.m.