SPHEREDIST Computes great circle distances on a sphere. D=SPHEREDIST(LAT1,LON1,LAT2,LON2) computes arc length in kilometers along a great circle on the earth from the point with latitude and longitude coordinates LAT1 and LON1 to the point LAT2 and LON2. All input arguments should be arrays of the same size, or else either LAT1,LON1 or LAT2,LON2 should be scalars. __________________________________________________________________ Cumulative distance With two input arguments, SPHEREDIST instead returns the cumulative distance from the first point in each column. D=SPHEREDIST(LAT,LON) where LAT and LON are 2D arrays of the same size, computes the cumulative great circle distance along each row. The great circle distance between adjacent LAT/LON points are cumputed, and these are then cumsummed to generate the cumulative distance D. In this case, SPHEREDIST can accommodate NaNs at the top of each row, and will begin with the first non-NaN value. Any interior NaNs however will cause all subsequent output values in that row to also be NaNs. __________________________________________________________________ The Earth is approximated as a sphere of radius RADEARTH. D=SPHEREDIST(...,R) instead uses a sphere of radius R, in kilometers. 'spheredist --t' runs a test. Usage: d=spheredist(lat,lon,lato,lono); d=spheredist(lat,lon); __________________________________________________________________ This is part of JLAB --- type 'help jlab' for more information (C) 2006--2015 J.M. Lilly --- type 'help jlab_license' for details