Description Usage Arguments Value Note Examples
View source: R/aggRasterPoly.R
function to accumulate or calculate average polygon values within a set of upstream catchment polygons.
1 2 3 4 5 6 7 8 9 10 11 12 13 |
shpfile |
The shapefile to be used to intersect with the raster layers (optional) |
rast |
The raster layer(s) to be intersected |
catid_col |
The field in the shapefile with the catchment ID values (e.g. 'site', 'SEGMENTNO') |
nextds_col |
The field in the shapefile indicating the next downstream catchment. Required for identifying catchments to aggregate. |
nextds2_col |
A second field in the shapefile indicating altnerative next downstream catchment for anabranches. Required for identifying catchments to aggregate. |
catarea_col |
The field containing the catchment areas. This is used for calculating the relative contributing area for weighting values when fun #' ='average'. |
reporting_cats |
A vector of 'sites' etc. to calculate values for. Otherwise defaults to all fields in catid_col. See optional start and end for #'alternative subsetting approach. |
start |
the first polygon in the shapefile to be used for intersection Defaults to a value of 1 (the first row). |
end |
The last polygon in the shapfile to be intersected. |
loc_cat_df |
A dataframe containing values for individual subcatchments to aggreagte - produced by running aggRasterPoly. If provided, there is no need to specify the raster layer, although the shapefile is still required to produce the catchment hierarchy. |
fun |
The aggregation function - 'average', 'accumulate', 'area_sum'. The former would typically be used for variables such as rainfall, whereas number of survey sites might be summed ('accumulate'), while runoff might be accumulated as runoff volume (mm/km^2 * catchment area) by taking into account sub-catchment areas using 'area_sum'. |
a dataframe of area-weighted or summed values derived from all sub-catchments contributing to each catchment.
The function can be used to extract values from a raster layer (or stack) or be applied ot existing dataframe of polygon values. For extraction the shapefile and raster stack must be projected in the same projection.
1 | #Need to complete with appropriate shapefile.
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.