xyzToEnuAdp: Convert adp Object From XYZ to ENU Coordinates

View source: R/adp.R

xyzToEnuAdpR Documentation

Convert adp Object From XYZ to ENU Coordinates

Description

Convert ADP velocity components from a xyz-based coordinate system to an enu-based coordinate system, by using the instrument's recording of information relating to heading, pitch, and roll. The action is based on what is stored in the data, and so it depends greatly on instrument type and the style of original data format. This function handles data from RDI Teledyne, Sontek, and some Nortek instruments directly.

Usage

xyzToEnuAdp(x, declination = 0, debug = getOption("oceDebug"))

Arguments

x

an adp object.

declination

magnetic declination to be added to the heading after "righting" (see below), to get ENU with N as "true" north. If this is set to NULL, then the returned object is set up without adjusting the compass for declination. That means that north in its metadata slot will be set to "magnetic", and also that there will be no item named declination in that slot. Note that applyMagneticDeclination() can be used later, to set a declination.

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 first step is to convert the (x,y,z) velocity components (stored in the three columns of x[["v"]][,,1:3]) into what RDI (reference 1, pages 11 and 12) calls "ship" (or "righted") components. For example, the z coordinate, which may point upwards or downwards depending on instrument orientation, is mapped onto a "mast" coordinate that points more nearly upwards than downward. The other ship coordinates are called "starboard" and "forward", the meanings of which will be clear to mariners. Once the (x,y,z) velocities are converted to ship velocities, the orientation of the instrument is extracted from heading, pitch, and roll vectors stored in the object. These angles are defined differently for RDI and Sontek profilers.

The code handles every case individually, based on the table given below. The table comes from Clark Richards, a former PhD student at Dalhousie University (reference 2), who developed it based on instrument documentation, discussion on user groups, and analysis of measurements acquired with RDI and Sontek acoustic current profilers in the SLEIWEX experiment. In the table, (X, Y, Z) denote instrument-coordinate velocities, (S, F, M) denote ship-coordinate velocities, and (H, P, R) denote heading, pitch, and roll.

Case Mfr. Instr. Orient. H P R S F M
1 RDI ADCP up H arctan(tan(P)*cos(R)) R -X Y -Z
2 RDI ADCP down H arctan(tan(P)*cos(R)) -R X Y Z
3 Nortek ADP up H-90 R -P X Y Z
4 Nortek ADP down H-90 R -P X -Y -Z
5 Sontek ADP up H-90 -P -R X Y Z
6 Sontek ADP down H-90 -P -R X Y Z
7 Sontek PCADP up H-90 R -P X Y Z
8 Sontek PCADP down H-90 R -P X Y Z

Finally, a standardized rotation matrix is used to convert from ship coordinates to earth coordinates. As described in the RDI coordinate transformation manual (reference 1, pages 13 and 14), this matrix is based on sines and cosines of heading, pitch, and roll If CH and SH denote cosine and sine of heading (after adjusting for declination), with similar terms for pitch and roll using second letters P and R, the rotation matrix is

 rbind(c( CH*CR + SH*SP*SR, SH*CP, CH*SR - SH*SP*CR), c(-SH*CR
+ CH*SP*SR, CH*CP, -SH*SR - CH*SP*CR), c( -CP*SR, SP, CP*CR)) 

This matrix is left-multiplied by a matrix with three rows, the top a vector of "starboard" values, the middle a vector of "forward" values, and the bottom a vector of "mast" values. Finally, the columns of data$v[,,1:3] are filled in with the result of the matrix multiplication.

Value

An object with data$v[,,1:3] altered appropriately, and x[["oceCoordinate"]] changed from xyz to enu.

Author(s)

Dan Kelley and Clark Richards

References

  1. Teledyne RD Instruments. “ADCP Coordinate Transformation: Formulas and Calculations,” January 2010. P/N 951-6079-00.

  2. Clark Richards, 2012, PhD Dalhousie University Department of Oceanography.

See Also

Other things related to adp data: [[,adp-method, [[<-,adp-method, ad2cpCodeToName(), ad2cpHeaderValue(), adp, adp-class, adpAd2cpFileTrim(), adpConvertRawToNumeric(), adpEnsembleAverage(), adpFlagPastBoundary(), adpRdiFileTrim(), adp_rdi.000, applyMagneticDeclination,adp-method, 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(), xyzToEnuAdpAD2CP()


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