Description Usage Arguments Value Examples
View source: R/aggregateRasterToPolygons.R
Aggregates time-series rasters by polygon primarily through the 'velox' package. Allows the user to take advantage of the 1000x raster extraction speed increases (over 'raster') resulting from the 'velox' package and should be operated in parallels. Accepts any datatype compatible with the 'raster' package. Defaults to a NAD83 projection and transforms as necessary. Datasets are assumed to be in depth per measurement and results are calculated as length = mm.
1 2 3 4 5 6 7 | aggregateRasterToPolygons(dataPath, dataName, dataExtension, dataCategory,
startDate, timeStep, unitDepth = "mm", aggFUN = "mean",
MET.HUC10 = TRUE, polyFname = NULL, polyLayer = NULL, polyIDs = NULL,
maxLayers = 6, cushion = 3, verbose = TRUE, cl = NULL, disag = TRUE,
disagFactor = NULL, cancelReproject = FALSE, recursive = TRUE,
projManual = "+proj=longlat +datum=NAD83 +no_defs +ellps=GRS80 +towgs84=0,0,0",
multiNum = NULL)
|
dataPath |
Character, required; Path to containing folder of gridded datasets. |
dataName |
Character, required; Name of gridded dataset. |
dataExtension |
Character, required; Gridded file extension to import, must be compatible with 'raster' package (tif', 'nc', ect). The .grd format is discouraged due to connection issues that occur during processing. |
dataCategory |
Character, required; Type of dataset ('precip', 'AET', 'SWE', etc). |
startDate |
Character, required; Starting date of rasters in format "YYYY-MM-DD". DD required but irrelevant if not daily rasters. |
timeStep |
Character, required; Time step between layers. Options are 'day', 'week', 'month', 'quarter', and 'year'. |
unitDepth |
Character, required; String providing the unit measurement of depth of dataset. Converts all datasets to mm. Defaults to 'mm'. Supported formats supplied in ?measurements::conv_unit. |
aggFUN |
Character, required; Function to use on cells within each polygon. Options are c('mean', 'sum'). Use 'mean' on rates and 'sum' on volumes. Defaults to 'mean'. |
MET.HUC10 |
Logical, optional; If TRUE, uses the included METsteps simplified HUC-10 shapefile. If FALSE, requires polyFname, polyLayer, and polyIDs arguments. Defaults to FALSE. |
polyFname |
Character, optional; If MET.HUC10 is FALSE, required filename of shapefile to aggregate gridded dataset. Defaults to NULL. |
polyLayer |
Character; If MET.HUC10 is FALSE, required layer of shapefile to aggregate gridded dataset as per rgdal::readOGR() function. Defaults to NULL. |
polyIDs |
Character string/vector; If MET.HUC10 is FALSE, required IDs for polygons to be used as rownames in return matrix. Requires either the identification column (in character string) in the shapefile (to be called by polys@data[[polyIDs]]) OR a character vector equal in length to the number of features. Defaults to NULL. |
maxLayers |
Integer, optional; Maximum number of layers/bands to allocate to each chunk. Defaults to 6. If you are experiencing memory issues (overloading RAM), then drop this number or reduce number of nodes in cl. |
cushion |
Numeric, optional; Number of GB of memory to leave unused during processing. Strongly advised to not decrease lower than 2. Default is 3. |
verbose |
Logical, optional; If FALSE, suppress all text outputs, including the parallel processing progress bar. Defaults to TRUE. |
cl |
Cluster object, optional; If supplied, extraction run in parallels. Suggested max number of cores is 10. |
disag |
Logical; Allow resampling if necessary. Defaults to TRUE. Resampling occurs when (average cell size of dataset) x 4 > average size of polygons in shapefile. |
disagFactor |
Integer; Disaggregation factor (> 1 disaggregates). If NULL, automatically selects factor. Defaults to NULL. |
cancelReproject |
Logical; If FALSE, reprojection is forced if necessary. Set to TRUE to disable raster reprojection. Defaults to FALSE. Suggested for use when WGS84 is projection and extents align with included datasets (polyHUC2 for example). |
recursive |
Logical; Should the listing recurse into directories? Defaults to TRUE. |
projManual |
Character, optional; Projection for datasets to be converted to. Gridded data and shapefile projections will be transformed to projManual as necessary. For CONUS projects, suggested to leave at default. Defaults to NAD83 ('+proj=longlat +datum=NAD83 +no_defs +ellps=GRS80 +towgs84=0,0,0'). |
multiNum |
Numeric, optional; If you would like the results to be multiplied by a certain value, put it in here. Must be numeric. Defaults to NULL. |
Table of mean raster values for each gridded dataset layer. Columns are gridded layers, rows are shapefile features.
1 |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.