LATLON2UV Converts latitude and longitude to horizontal velocity. CV=LATLON2UV(NUM,LAT,LON) where NUM is the data in DATENUM format and LAT and LON are the latitude and longitude in degrees, outputs the complex-valued velocity CV=U+SQRT(-1)*V in cm/s, computed using the first central difference. NUM is a column vector or a matrix of the same size as LAT and LON. LAT and LON are matices having SIZE(NUM,1) rows. CV is the same size as LAT and LON. NANs in LAT or LON become NAN+SQRT(-1)*NAN. LATLON2UV computes the velocity components from the distance travelled across the surface of the sphere and the heading, taking account of the sphericity of the earth. The first and last points must be treated differently, as the central difference is not defined there. At the first and last point we use, respectively, the first forward and first backward difference. The radius of the earth is given by the function RADEARTH. [CV,CA]=LATLON2UV(...,'acceleration') also returns CA, a measure of the complex-valued acceleration based on the difference between the first forward difference velocity and the first backward difference velocity. The units of acceleration are centimeters per inverse second squared. ___________________________________________________________________ Cell array input / output LATLON2UV returns cell array output given cell array input. That is, if NUM, LAT, and LON, are all cell arrays of length K, containing K different numerical arrays, then the output will also be cell arrays of length K. ___________________________________________________________________ Difference algorithm By default, LATLON2UV uses a first central difference algorithm which is defined to be the average of a forward and a backward difference. CV=LATLON2UV(...,'forward') instead uses a first forward difference. Velocity is computed based on the great circle distance and bearing from each point to the next point. CV=LATLON2UV(...,'backward') instead uses a first backward difference. Velocity is computed based on the great circle distance and bearing from each point to the previous point. This is equivalent to the first forward difference computed backward in time. The first forward and first backward difference can be thought of as giving the Cartesian velocities of a departing and arriving particle, respectively. Note that acceleration is not output when the 'forward' or 'backward' algorithms are specified, as acceleration is computed as a part of the first central difference operation. ___________________________________________________________________ Parallelization LATLON2UV(...,'parallel') with cell array input parallelizes the computation using a PARFOR loop. This requires that Matlab's Parallel Computing Toolbox be installed, and is useful for very large datasets. __________________________________________________________________ See also XY2LATLON, LATLON2XY, UV2LATLON. Usage: cv=latlon2uv(num,lat,lon); [cv,ca]=latlon2uv(num,lat,lon); 'latlon2uv --t' runs a test. _________________________________________________________________ This is part of JLAB --- type 'help jlab' for more information (C) 2004--2015 J.M. Lilly --- type 'help jlab_license' for details