LATLON2XY Converts latitude and longitude into tangent plane 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, see Lilly and Lagerloef (2018). 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. LATLON2XY gives the same distance as SPHEREDIST for points where the great circle distance is less than RADEARTH * pi/2, but returns NaNs for greater distances. The great circle distance returned 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. ___________________________________________________________________ Small angle approximation [X,Y,D]=LATLON2XY(...,'small') returns X, Y, and D based on the small angle approximation, corrected for points differing in longitude by more than ninety degrees. See Lilly and Lagerloef (2018) for details. This is primarily used for testing purposes. ___________________________________________________________________ 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--2018 J.M. Lilly --- type 'help jlab_license' for details