View source: R/interpolate_gsod.R
interpolate_GSOD | R Documentation |
This function is designed to be wrapped in an base::lapply()
function to process multiple years of GSOD data for interpolation,
though a single year may be used. Output is written to a fst::fst
file.
interpolate_GSOD(x, dem, dsn = NULL, fname, vars = NULL, dates = NULL)
x |
A |
dem |
Digital elevation model that has been fetched and processed using
|
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. |
fname |
Optional. A file name for the data to be saved as a |
vars |
Weather variables to interpolate. Possible values are
|
dates |
Optional. A vector of dates to optionally filter and
interpolate. If left |
A terra::SpatRaster()
of daily interpolated weather variables and
optionally writes values to a fst::fst()
compressed file.
# Get and aggregate the raster digital elevation model dem <- make_DEM() # Create a list of GSOD files files <- list.files("~/Data/GSOD", full.names = TRUE) # Run the function for MAX and MIN temperature using parallel processing future::plan("multisession") GRID <- lapply(X = files, FUN = interpolate_GSOD, dem = dem, dsn = "~/Cache/GTiff", vars = c("MAX", "MIN")) # Run the function for MAX and MIN temperature using a single core future::plan("sequential") GRID <- lapply(X = files, FUN = interpolate_GSOD, dem = dem, vars = "MAX")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.