Description Usage Arguments Details Examples
View source: R/calculateSlopeBearing.R
Functions for calculating slope and bearing metrics from NRSA protocol channel geometry data. The metrics calculated are: xbearing, sinu, xslope, vslope, nslope.
1 2 3 4 5 | calculateAngleMetrics(uid, azimuth, distance)
calculateSlopeMetrics(uid, transect, slope, proportion)
calculateTransectSpacing(uid, transpc)
|
uid |
a vector of site identifiers |
azimuth |
a vector of bearings; more properly azimuths |
distance |
a vector of distances |
transect |
a vector of transect identifiers |
transpc |
a vector of transect spacing values |
The general strategy for calculationg slope and bearing metrics using these functions is:
Calculate transect spacing for wadeable as: increment * nWadeableStationsPerTransect
Calculate wadeable distance for each slope/bearing as transp * proportion
Calculate boatable transect spacing as sum(distance)
and proportion as distance / sum(distance)
Calculate grade (as percent) from boatable elevation change measurements in centimeters, if applicable.
Calculate angle metrics using calculateAngleMetrics
Calculate slope metrics using calculateSlopeMetrics
The overall working of calculateAngleMetrics
differs somewhat than the
EPA code. EPA calculated total distances East and North at each transect,
then summed to get the total distance East and North for the site. calculateAngleMetrics
treats the channel geometry as a single line string and calculates the length
of the line string and the distance from the first to last point. It calculates
xbearing as the azimuth between the first and last points.
Function calculateTransectSpacing calculates the transect spacing. These should be the same for every transect. But for some sites, it's possible to get discrepancies between transects because of numerical issues. In that case the transect spacing won't be exactly the same at every transect. For that reason, we take the mean of the the transect spacing values for the site.
1 2 3 4 5 | d <- data.frame(uid = c(1,1), azimuth = c(180,90), distance = c(1,1))
calculateAngleMetrics(d$uid, d$azimuth, d$distance)
d <- data.frame(uid = rep(1,6), transect = rep(1:2,each = 3),
slope = rep(c(10, 20, 30), 2), proportion = rep(1,6) / 3)
with(d, calculateSlopeMetrics(uid, transect, slope, proportion))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.