seasonder_extrapolateAPM {SeaSondeR} | R Documentation |
Extrapolate SeaSondeR APM Matrix
Description
This function performs linear extrapolation on the SeaSondeR APM measurement matrix.
It adds n
extrapolated columns to both the left and right sides of the matrix.
Usage
seasonder_extrapolateAPM(seasonder_apm_object, n = 1)
Arguments
seasonder_apm_object |
A matrix containing SeaSondeR APM measurements. Its attributes include "BEAR" (numeric vector of bearings) and "BearingResolution" (numeric resolution). |
n |
An integer specifying how many extrapolated columns to add on each side (default is 1). |
Details
The function retrieves the original bearing vector from the APM object using
seasonder_getSeaSondeRAPM_BEAR
and obtains the bearing resolution (attribute
"BearingResolution"). If n == 0
, the original matrix is returned unchanged.
For n > 0
, new bearings are generated for both sides using the resolution. The
left side is extrapolated using the slope computed from the first two columns of the matrix,
and the right side is extrapolated using the slope from the last two columns. The new columns
are then combined with the original matrix, and the column names and the "BEAR" attribute
are updated to reflect the complete set of bearings.
Value
A modified matrix with n
extrapolated columns added to both sides. The column names
and the "BEAR" attribute are updated with the new bearings, while the "BearingResolution"
attribute remains unchanged.
Examples
# Extrapolate loops for a test SeaSondeRAPM object
apm_file <- system.file("css_data/MeasPattern.txt", package = "SeaSondeR")
obj <- seasonder_readSeaSondeRAPMFile(apm_file)
result <- seasonder_extrapolateAPM(obj, n = 1)