applyMagneticDeclination-oce-method: Alter an object to account for magnetic declination

applyMagneticDeclination,oce-methodR Documentation

Alter an object to account for magnetic declination


Current-measuring instruments that infer flow direction using magnetic compasses require a correction for magnetic declination, in order to infer currents with x and y oriented eastward and northward, respectively. applyMagneticDeclination() is a generic function that handles this task by altering velocity components (and heading values, if they exist). It works for objects of the cm, adp and adv and cm classes by calling applyMagneticDeclination,adp-method(), applyMagneticDeclination,adv-method(), or applyMagneticDeclination,cm-method(), respectively.


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



an object of cm, adp, or adv class.


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


a debugging flag, set to a positive value to get debugging.


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.


an object of the same class as object, modified as outlined in “Details”.


Dan Kelley, aided, for the adp and adv variants, 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,adp-method, applyMagneticDeclination,adv-method, applyMagneticDeclination,cm-method, applyMagneticDeclination(), magneticField()

oce documentation built on July 9, 2023, 5:18 p.m.