;far is a function which calculates the distance between two global ;locations. ;Use of far is as follows: ; ; d=far(lat1,lon1,lat2,lon2) ; Where ; lat1 = latitude of location 1 in deg ; lon1 = longitude of location 1 in deg ; ; lat2 = latitude of location 2 in deg ; lon2 = longitude of location 2 in deg ; ; d = distance in kilometers between location 1 & 2 ;BWB 1/16/92 ; ;Converted to an idl code 5/5/00 function far,lat1,lon1,lat2,lon2 r=double(3959.)*double(1.609) pi=2.*asin(double(1)) lat1=lat1*pi/180. lon1=lon1*pi/180. lat2=lat2*pi/180. lon2=lon2*pi/180. r1x=cos(lon1)*cos(lat1)*r r1y=sin(lon1)*cos(lat1)*r r1z=sin(lat1)*r r2x=cos(lon2)*cos(lat2)*r r2y=sin(lon2)*cos(lat2)*r r2z=sin(lat2)*r d=acos((r1x*r2x+r1y*r2y+r1z*r2z)/r^2)*r return,d end