applyMagneticDeclination-adp-method: Alter an adp Object to Account for Magnetic Declination

applyMagneticDeclination,adp-methodR Documentation

Alter an adp Object to Account for Magnetic Declination

Description

Acoustic-Doppler profiling instruments that infer direction using magnetic compasses to determine current direction need to have a correction applied for magnetic declination, if the goal is to infer currents with x and y oriented eastward and northward, respectively. This is what the present function does (see “Details”).

Usage

## S4 method for signature 'adp'
applyMagneticDeclination(
  object = "oce",
  declination = 0,
  debug = getOption("oceDebug")
)

Arguments

object

an adp object.

declination

numeric value holding magnetic declination in degrees, positive for clockwise from north.

debug

an integer specifying whether debugging information is to be printed during the processing. This is a general parameter that is used by many oce functions. Generally, setting debug=0 turns off the printing, while higher values suggest that more information be printed. If one function calls another, it usually reduces the value of debug first, so that a user can often obtain deeper debugging by specifying higher debug values.

Details

The returned value is a copy of object that has been modified in 4 ways. (1) the horizontal components of velocity are rotated clockwise by declination degrees. (2) If the object holds heading values, then declination is added to them. (3) The north item in the metadata slot is set to "geographic", and a warning is issued if this was also the value in object. (4) The declination item in the metadata slot is set to the value supplied to this function.

Value

An adp object, modified as outlined in “Description”.

Author(s)

Dan Kelley, aided by Clark Richards and Jaimie Harbin.

See Also

Use magneticField() to determine the declination, inclination and intensity at a given spot on the world, at a given time.

Other things related to magnetism: applyMagneticDeclination(), applyMagneticDeclination,adv-method, applyMagneticDeclination,cm-method, applyMagneticDeclination,oce-method, magneticField()

Other things related to adp data: [[,adp-method, [[<-,adp-method, ad2cpCodeToName(), ad2cpHeaderValue(), adp, adp-class, adpAd2cpFileTrim(), adpConvertRawToNumeric(), adpEnsembleAverage(), adpFlagPastBoundary(), adpRdiFileTrim(), adp_rdi.000, as.adp(), beamName(), beamToXyz(), beamToXyzAdp(), beamToXyzAdpAD2CP(), beamToXyzAdv(), beamUnspreadAdp(), binmapAdp(), enuToOther(), enuToOtherAdp(), handleFlags,adp-method, is.ad2cp(), plot,adp-method, read.adp(), read.adp.ad2cp(), read.adp.nortek(), read.adp.rdi(), read.adp.sontek(), read.adp.sontek.serial(), read.aquadopp(), read.aquadoppHR(), read.aquadoppProfiler(), rotateAboutZ(), setFlags,adp-method, subset,adp-method, subtractBottomVelocity(), summary,adp-method, toEnu(), toEnuAdp(), velocityStatistics(), xyzToEnu(), xyzToEnuAdp(), xyzToEnuAdpAD2CP()

Examples

# Transform beam coordinate to xyx, then to enu with respect to
# magnetic north, and then to geographic north.
library(oce)
file <- system.file("extdata", "adp_rdi.000", package = "oce")
lon <- -69.73433
lat <- 47.88126
beam <- read.oce(file, from = 1, to = 4, longitude = lon, latitude = lat)
dec <- magneticField(lon, lat, beam[["time"]][1])$declination
xyz <- beamToXyzAdp(beam)
# Here, we tell xyzToEnuAdp() not to set a declination,
# so enuMag has metadata$north equal to "magnetic".  We could
# also skip the use of applyMagneticDeclination() by supplying
# the known declination to xyzToEnuAdp().
enuMag <- xyzToEnuAdp(xyz, declination = NULL)
enuGeo <- applyMagneticDeclination(enuMag, declination = dec)


oce documentation built on Sept. 11, 2024, 7:09 p.m.