# How is a coordinate transformation done?

FollowRaw velocity measurements are given in beam coordinates, which is a vector in the direction along each of the beams. Depending on the objective of the measurements, coordinate transformation may be beneficial. Beam coordinates can be converted to a Cartesian coordinate system (XYZ) or Earth normal coordinates (ENU: East, North and Up). The orientation of the beams/transducers, which is defined in the instrument specific transformation matrix, is used to convert from beam coordinates to XYZ. By additionally knowing the orientation in space, such as tilt and compass heading, ENU coordinates can be determined.

During transformation to ENU only the slanted beams are used in the transformation. The data represented in ENU originates only from these beams, and the centre beam (if collecting current data) is given individually and always in beam coordinates.

If the instrument is configured to measure data in XYZ or ENU, this coordinate transformation is automatically performed by the firmware and the output data will be in the selected coordinate system. The transformation can also be done in post-processing software. If the data is collected in beam coordinates, the transformation can also be carried out manually if desired. How the manual transformation from beam coordinates through XYZ to ENU is done is described below.

The starting point is a binary-to-ASCII conversion of the raw data file so that you have access to the three velocity files, .v1, .v2 and .v3, the transformation matrix in the .hdr file, and the .sen file. Heading, pitch and roll are presented in the .sen file (ref. the .hdr file), and these angles are output in degrees. The figure below indicates the three coordinate systems that the velocity data in .v1, .v2 and .v3 are measured in: Beam, XYZ or ENU. The coordinate system selected during the deployment planning is indicated in the .hdr file.

The three relevant coordinate systems. The figure shows an AWAC, but this applies to the other instruments as well.

Each instrument has its own unique transformation matrix, based on the transducer geometry. This matrix can be found, as previously mentioned, in the .hdr file generated when performing a binary data conversion in the software. Each row of the matrix represents a component in the instrument’s XYZ coordinate system, starting with X at the top row. Each column represents a beam. The third and fourth rows of the Vectrino or Signature transformation matrix represent the two estimates of vertical velocity (Z1 and Z2) produced by the instrument. XYZ coordinates are defined relative to the instrument, so they do not take into account heading, pitch and roll. ENU utilizes the attitude measurements to provide an Earth-relative coordinate system.

** **

**Beam to XYZ:**

The transformation between beam and XYZ coordinates is done using the original T matrix listed in the header file. In matrix form (using MATLAB notation, so [ X; Y; Z ] is a column vector), the math is:

T * [ B1; B2; B3 ] = [ X; Y; Z ]

Taking the matrix inverse of T will get you back to Beam coordinates:

inv( T ) * [ X; Y; Z ] = [ B1; B2; B3 ]

For the Vectrino Profiler: The transformation matrix for the Vectrino Profiler range cells is stored in Config.ProbeCalibration_calibrationMatrix, with one row per cell. To get the calibration matrix in a more usable form for transforms, this can be used:

T = reshape( Config.ProbeCalibration_calibrationMatrix( cell, : ), 4, 4 )'

(NB: Note the transpose of the matrix.)

And to convert from XYZ to Beam:

inv( T ) * [ X; Y; Z1; Z2 ]

**Beam or XYZ to ENU:**

The transformation matrix must be recalculated every time the heading, pitch or roll changes, when selecting ENU coordinates.

The procedure is as follows:

- Find the transformation matrix in the .hdr file
- Scale the transformation matrix to floating point numbers if it has not been scaled already (i.e. has a value of several thousand). The scaling parameter is 4096.
- Check the orientation of the instrument (.sen file, status bit, bit 0; 0 = up-looking, 1 = down-looking). If the instrument is pointing down, rows 2 and 3 of the matrix must change sign.
- Make a heading matrix.
- Make a tilt matrix.
- Make a new transformation matrix (R), including the instrument transformation matrix, heading and tilt matrix (refer to the attached MATLAB script for details)
- Then:

[ E; N; U ] = R * [ B1; B2; B3 ]

[ B1; B2; B3 ] = inv(R) * [ E; N; U ]

[ E; N; U ] = R * inv(T) * [ X; Y; Z ]

[ X; Y; Z ] = T * inv(R) * [ E; N; U ]

Here is a MATLAB script describing how to do the transformation: MATLAB script

**4-beam ADCP velocities into ENU:**

The MATLAB script above can be used for 4-beam systems also, and a specific 4-beam Signature script is linked below. As seen from the script, the transform has two steps – one from beam to XYZ and the second from XYZ to ENU coordinates.

The first step is a little different for 4-beam systems:

Vx= (V1 – V3)/2*sin(25 deg)

Vy= (V2 – V4)/2*sin(25 deg)

Vz1= (V1+V3)/2*cos(25 deg)

Vz2= (V2+V4)/2*cos(25 deg)

(This is for a 4-beam system with 25-degree beams, where the beams are numbered clockwise from Beam 1).

The next step from XYZ to ENU is shown in the attached scrips.

## Comments

0 comments

Please sign in to leave a comment.