# UV2LATLON is the jOceans module of jLab.

``` UV2LATLON  Integrates horizontal velocity to give latitude and longitude.

[LAT,LON]=UV2LATLON(NUM,U,V,LATO,LONO) where NUM is the data in DATENUM
format, integates velocities U and V from intial location (LATO,LONO)
to form a trajectory on the earth described by LAT and LON.

LATO and LONO are an initial latitude and longitude in degrees,
and U and V are eastward and northward velocity components in cm/s.

NUM, U, and V may be column vectors, in which case LATO and LONO are
both scalars.  Alternatively U and V may be matrices with time oriented
in rows.  NUM is then either an array of length SIZE(U,1), or a matrix
of the same size as U and V, while LATO and LONO are either scalars or
arrays of length SIZE(U,2).

[LAT,LON]=UV2LATLON(NUM,CV,LATO,LONO), where CV is the complex-valued
velocity CV=U+SQRT(-1)*V, also works.

UV2LATLON is inverted by LATLON2UV.
___________________________________________________________________

Cell array input / output

UV2LATLON returns cell array output given cell array input.

That is, if NUM, U, and V, are all cell arrays of length K, containing
K different numerical arrays, then the output will also be cell arrays
of length K.

In this case LATO and LONO are either scalars, or arrays of length K.
___________________________________________________________________

Algorithm

UV2LATLON works by converting the velocity at the current point into
a vector in 3D Cartesian coordinates, using SPHERE2UVW, finding the new
location in 3D space, and then converting this back into latitude
and longitude using XYZ2LATLON, and then interating for the next point.

By default, UV2LATLON uses a forward integration from an initial point.
This inverts LATLON2UV(...,'forward') to a high degree of precision for
typical drifter and float velocity values and sampling intervals.

integration, and LATF and LONF are now the *final* points rather than
the initial points.  This inverts LATLON2UV(...,'backward').
___________________________________________________________________