process.secondary: process.secondary

Description Usage Arguments Details Value See Also Examples

View source: R/process.secondary.R

Description

Summarizes ADCP cell data exported from SonTek RiverSurveyor, calculates primary and secondary velocities, and conducts spatial averaging.

Usage

1
2
3
4
5
process.secondary(data, transectNames, depthReference = "unit",
  project = TRUE, FUN = "mean", binWidth, binHeight, rotation = c("xSec"),
  xWindow = NULL, yWindow, spatialCoords = c("tDist", "cellDepth"),
  groups = "transectName", na.ignore = FALSE, spatialAvg = "TRUE",
  spatialStdDev = "FALSE")

Arguments

data

A list of MATLAB files exported from RiverSurveyor to be compiled

transectNames

A list of transect names corresponding to the transects represented by the MATLAB files. See 'details' for additional information.

depthReference

Defines the depth measurements to be used. The default ("unit") uses the method defined in RiverSurveyor, but depthReference can be set to use measurements from the vertical beam ("VB"), bottom-track beams ("BT"), or both ("composite").

project

Logical. If TRUE (default), transect replicates are projected to a mean transect line using an orthogonal projection of the x and y coordinates. If FALSE transects are not projected to a mean transect line.

FUN

function used to summarize ADCP data, default is mean

binWidth

Width used to bin data along a transect, for summarization. Default is the mean distance between samples.

binHeight

Depth interval used to bin data within an ensemble, for summarization. If missing, cell depth is used group cells for summarization.

rotation

Character string indicating which rotation method is used to calculate secondary velocities. Can be no rotation ("xSec", the default), Rozovskii rotation ("rozovskii"), and/or zero secondary discharge rotation ("zeroSecQ"). If multiple rotations are used, use c to combine multiple character strings.

xWindow

Number of neighbors to include in the x orientation of the moving window, including the observation the window centers on. If NULL (the default), spatial averaging is not conducted.

yWindow

Optional. Number of neighbors to include in the y orientation of the moving window, including the observation the window centers on.

spatialCoords

A vector of column name(s) containing spatial coordinates within the dataset. The x coordinates must be designated first, followed by the y coordinates. If yWindow is not provided, the y coordinates can be omitted, otherwise they will be ignored. If spatialCoords is omitted, a moving window will be used, but data will not be spatially referenced prior to calculations.

groups

Optional. Names of column(s) containing information used to subset the data into separate groups for processing. Useful if dataset contains multiple discrete study areas.

na.ignore

Logical. If FALSE (default) NA values are assumed to be the average of non-NA values within the moving window, if TRUE NA values remain NA.

spatialAvg

Logical. If TRUE (default) and xWindow is not NULL, spatial averaging is conducted, else if FALSE no spatial averaging is conducted.

spatialStdDev

Logical. If TRUE and xWindow is not NULL, spatial standard deviation is calculated, else if FALSE (default) no spatial standard deviation is calculated.

Details

When assigning transectNames, order matters, the transect names must be in the same order of the MATLAB files assigned to the data argument. Ex., if the first two files in the list are Transect1a and Transect1b, which are replicates of Transect1, t first two files in the name list are "Transect1" and "Transect1". The processing functions will spatially average and compile all data from the same transects, this tells the processing functions to average and compile these two files. Listing the names as "Transect1a" and "Transect1b" results in the transects being processed separately. transectNames will only expect characters and names must be enclosed in "".

Value

A data.table with cell depth, distance from the right bank (tDist), transect name, cell id, depth averaged velocity to the east (Mean.Vel.E), depth averaged velocity to the north (Mean.Vel.N), depth, cell velocity to the east (Vel.E), cell velocity to the north (Vel.N), cell vertical velocity (Vel.up), cell error velocity (Vel.error), blanking distance or depth where measurements first begin (StartDepth), cell height, cell number within an ensemble (cell one is closest to the surface; cellNumber), UTM x coordinates (UTM_X), UTM y coordinates (UTM_Y), longitude, latitude, cell altitude, heading of transect (assumes transect starts at river right), cellWidth, speed within a cell (speed), flow heading within a cell (velHeading), and output from rotation method(s) used. If project = TRUE, orthogonally projected longitude, latitude, and UTM coordinates (Longitude_Proj, Latitude_Proj, UTM_X_Proj, UTM_Y_Proj) are also returned.

See Also

average.secondary, xSec, rozovskii, zeroSecQ, spatialAverage and spatialSD.

Examples

1
2
3
4
5
6
data(mNine)
#mNine is a list of MATLAB files
names(mNine)
#Drop the last letter (l or r) from the MATLAB file names
tNames <- substr(names(mNine), 0, nchar(names(mNine))-1)
adcp.secondary <- process.secondary(mNine, tNames, rotation = c("xSec", "rozovskii", "zeroSecQ"), xWindow = 21, yWindow = 5)

jasonfischer/rivSurveyR documentation built on May 18, 2019, 5:54 p.m.