I have water velocity data taken in an ENU (East, North, UP) or XYZ coordinate system. The data is contained in 3 columns like this:

E   N   U
1   3   .1
2   5   .2
2   6   .1
-1  4   .1
-2  4   .1

So the first column represents velocity (in m/s) in the East (or X) direction (negative numbers represent velocity in the West (or -X) direction. The second column indicates velocity in the North (or Y) direction. And the 3rd column represents velocity in the Up (or Z direction).

The data is scalar, but I'm assuming I want to end up with speed and directional data. For ease of understanding, if I were to just consider 2 dimensional data (ignore the Z or up data), is it acceptable to add the E and N data to get useful magnitude and directional data?

For example if in the last row East is -2 and North is 4. So I've got 2 m/s West and 4 m/s North. But does the number 2 (-2 + 4) mean anything?

Or do I need to use $a^2 +b^2= c^2 = 4 +16= 20 \rightarrow \sqrt{20}= 4.47$ But If I were to do this, then I loose the - sign (West direction) information, and it would not have mattered if the data was originally West (-2) or East (2).

In the end, I'm looking to get useable data on current speed. But I'm not even sure if the end result of this kind of data should be (A) magnitude + direction (ie 2m/s at 20 degrees) or just (B) a single number that is only a combined magnitude with no reference to direction(ie 2m/s). I know for my calculations I do need an absolute magnitude that would represent current speed (option B) but am not sure how to calculate this.


1 Answer 1


You are using a nice orthogonal coordinate system, so everything is rather straightforward. The magnitude of the vector is $$ r = \sqrt{x^2+y^2+z^2}, $$ where $x$ is the East value, $y$ is the North value, and $z$ is the Up value.

Now the direction of a vector in three-dimensional space needs two components to specify. There are many choices here - I'll illustrate with polar angle $\theta$ and azimuthal angle $\phi$. $\theta$ runs from $-90^\circ$ (pure Down vector) to $+90^\circ$ (pure Up), exactly like latitude on Earth. $\phi$ I'll define to run from $0^\circ$ at pure East, increasing counterclockwise so that North is $\phi = 90^\circ$, West is $180^\circ$, and South is $270^\circ$.1

If you only consider the projection of your vector onto the $z = 0$ plane (just look at East and North components), then clearly $\tan(\phi) = y/x$. However, inverting this function leaves some ambiguity - if both $x$ and $y$ are positive, you know you are somewhere Northeast, but the tangent comes out the same if both of them have their signs reversed, putting you in the Southwest quadrant. The solution to bookkeeping is to use the atan2 function, almost certainly available in some form in whatever language you are dealing with. Then $\phi$ as I've defined it is given by $$ \phi = \mathrm{atan2}(y, x). $$

That settles "longitude." For "latitude," note that the combined NESW-component has magnitude $\sqrt{x^2+y^2}$, while the Up-Down component has magnitude $z$. Thus the angle $\theta$ measured from the NESW plane to your vector is simply $$ \theta = \cos^{-1}\left(\frac{\sqrt{x^2+y^2}}{z}\right). $$ Standard sign conventions should all work out in this equation without any fuss.

In summary, magnitude $r$ is easy. Direction has two components, and some care must be taken in defining your coordinates if you need this information. And a word of advice: always figure out what it is you need before trying to manipulate your data. As often as not, leaving vectors in terms of Cartesian components is the right thing to do.

1 Note that this is the more mathematical convention. For navigational purposes, often North is $0^\circ$, East is $90^\circ$, etc.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.