View source: R/extract.SNODAS.subset.R
extract.SNODAS.subset | R Documentation |
Extracts spatial and temporal subsets of SNODAS data and returns them as multiband rasters (one layer per date, one raster per dataset)
extract.SNODAS.subset( dates, values_wanted = c("SWE", "Depth", "Runoff", "Sublim_Pack", "Sublim_Blow", "P_Solid", "P_Liquid", "T_Mean"), extent, masked = TRUE, read_path = "./SNODAS/", compressed = FALSE, nodata_handling = "NA", write_file = TRUE, write_path = "./SNODAS/extracted", filename_prefix = "", write_extension = ".img" )
dates |
Either a vector of date objects or a character vector that can be interpreted by lubridate::ymd(), specifying the dates wanted |
values_wanted |
A vector of character strings giving the names of the datasets to create subsets of. Possible values are: 'SWE','Depth','Runoff','Sublim_Pack', 'Sublim_Blow', 'P_Solid', 'P_Liquid', 'T_Mean'. The default is to return all. |
extent |
a 2x2 matrix of the extent desired, following the format format of input to extent(), or an Extent object. Must be latlong (negative degrees E, degrees N) with WGS84 datum. No modular arithmetic will be performed on the coordinates. |
masked |
Logical. Are the source files masked to CONUS or unmasked? |
read_path |
A character string specifying the source directory of SNODAS data, with a trailing slash (e.g. './SNODAS/') |
compressed |
Logical. Are the datasets compressed? If so, they will be uncompressed before data extraction, then deleted. This will save a LOT of storage space but will blow up processing times approximately 10-fold. |
nodata_handling |
A character string. If data does not exist, do you want NAs ('NA'), an error ('error') or just no band in the returned rasters ('skip') for that day? |
write_file |
Logical. Should the extracted data be written to storage or returned in memory. If returned in memory, the function will return a list of rasters with one object for each values_wanted. |
write_path |
A character string specifying the path to write data, if write_file=TRUE. With trailing slash (e.g. './SNODAS/') |
filename_prefix |
A character string that will be prepended to the files written to storage. Helpful for including a unique identifier (e.g. Site ID) in the file names. |
write_extension |
#A character string. File extension to save outputted data. Will be parsed by raster::writeRaster do determine appropriate format (see ?writeRaster for possible formats). Including leading period (e.g. '.img') |
NULL if write_file=TRUE, otherwise a list of the desired multiband rasters.
download.SNODAS(dates=c('2010-02-20', '2015-02-10'), path='./SNODAStest/')
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.