hydroweight_attributes: Generate inverse distance-weighted attributes

View source: R/hydroweight_attributes.R

hydroweight_attributesR Documentation

Generate inverse distance-weighted attributes

Description

hydroweight::hydroweight_attributes() calculates distance-weighted attributes using distance-weighted rasters generated in hydroweight::hydroweight(), an attribute layer (loi, e.g., land use polygon/raster), and a region of interest (roi, e.g., a catchment polygon). The function outputs an attribute summary table or a list that includes the summary table and layers used for calculation. Summary statistics are calculated as in Peterson et al. 2011 https://doi:10.1111/j.1365-2427.2010.02507.x). IMPORTANTLY, this function only produces one instance of the loi x distance_weights summary statistics (i.e., one loi, one roi, and one set of distance_weights). See https://github.com/bkielstr/hydroweight for workflows.

Usage

hydroweight_attributes(
  loi = NULL,
  loi_attr_col = NULL,
  loi_columns = NULL,
  loi_numeric = NULL,
  loi_numeric_stats = NULL,
  roi = NULL,
  roi_uid = NULL,
  roi_uid_col = NULL,
  distance_weights = NULL,
  remove_region = NULL,
  return_products = TRUE
)

Arguments

loi

sf or RasterLayer. Layer of interest (e.g., land use layer).

loi_attr_col

character. A name that will precede the calculated attributes (e.g., loi_mean, loi_median etc.)

loi_columns

character. The column names over which to summarize the attributes.

loi_numeric

logical. If TRUE, the loi_columns being summarized are numeric. If FALSE, the loi_columns being summarized are categorical.

loi_numeric_stats

character. One or more of c("distwtd_mean", "distwtd_sd", "mean", "sd", "median", "min", "max", "sum", "cell_count"). Those without distwtd_ are simple "lumped" statistics.

roi

sf or RasterLayer. Region of interest (e.g., catchment boundary). Everything within this region will be used to calculate attributes.

roi_uid

character. Unique identifier value for the roi.

roi_uid_col

character. Column name that will be assigned to the roi_uid.

distance_weights

list. The distance-weighted rasters output from hydroweight.

remove_region

sf or RasterLayer. Regions to remove when summarizing the attributes (e.g., remove lake from catchment)

return_products

logical. If TRUE, a list containing attribute summary table, the roi- and remove_region-masked layer (i.e., all cells contributing to attribute calculation), and distance_weights raster. If FALSE, attribute summary table only.

Details

Spatial layers are aligned to distance_weights (i.e., identical coordinate reference systems - CRS).

Value

If return_products = TRUE, a list containing 1) attribute summary table, and 2) a list of return_products of length(distance_weights) where each list element contains a list of 2 sub-elements: 1) roi- and remove_region-masked loi (i.e., all cells contributing to attribute calculation), and 2) the roi- and remove_region-masked distance_weights raster. If return_products = FALSE, attribute summary table only.


bkielstr/hydroweight documentation built on April 14, 2025, 6:03 p.m.