LATLON2XY Converts latitude and longitude into local Cartesian coordinates. [X,Y]=LATLON2XY(LAT,LON,LATO,LONO) converts (LAT,LON) with units of degrees into displacements (X,Y) in a plane tangent to the earth at the point (LATO, LONO). X and Y have units of kilometers. CX=LATLON2XY(LAT,LON,LATO,LONO) with one output argument returns the location as a complex-valued quantity X+SQRT(-1)*Y. NANs in LAT or LON become NAN+SQRT(-1)*NAN. LAT and LON are arrays of the same size. LATO and LONO are either also arrays of this size, or else scalars. X and Y have the same size as the input arrays. X and Y are computed by projecting the tangent plane onto the sphere using full spherical geometry. The radius of the earth is given by the function RADEARTH. Note that X and Y are set to NANs for points on the opposite side of the earth from the tangent plane, that is, where the great circle distance would exceed RADEARTH * pi/2. ___________________________________________________________________ Great circle distance [X,Y,D]=LATLON2XY(...) also returns the great circle distance D between the two sets of points. For points on the same side on the earth from the tangent plane, i.e. where the great circle distance is less than RADEARTH * pi/2, LATLON2XY gives the same distance as SPHEREDIST. However, for points on the opposite side of the earth, LATLON2XY returns NANs whereas SPHEREDIST returns the correct distance. The great circle distance computed here is useful because it is a fast computation if X and Y are already known. ___________________________________________________________________ Cell array input / output LATLON2XY returns cell array output given cell array input. That is, if LAT, LON, LATO, and LONO are all cell arrays of length K, containing K different numerical arrays, then the output will also be cell arrays of length K. This also works if LAT and LON are cell arrays but LATO and LONO are scalars. ___________________________________________________________________ LATLON2XY is inverted by XY2LATLON. See also XY2LATLON, LATLON2UV, SPHEREDIST. 'latlon2xy --t' runs some tests. Usage: [x,y]=latlon2xy(lat,lon,lato,lono); [x,y,d]=latlon2xy(lat,lon,lato,lono); cx=latlon2xy(lat,lon,lato,lono); _________________________________________________________________ This is part of JLAB --- type 'help jlab' for more information (C) 2000--2014 J.M. Lilly --- type 'help jlab_license' for details