Subversion Repositories lagranto.um

Rev

Rev 15 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 15 Rev 16
Line 1066... Line 1066...
1066
c     Calculates spherical distance (in km) between two points given
1066
c     Calculates spherical distance (in km) between two points given
1067
c     by their spherical coordinates (xp,yp) and (xq,yq), respectively.
1067
c     by their spherical coordinates (xp,yp) and (xq,yq), respectively.
1068
 
1068
 
1069
      real         re
1069
      real         re
1070
      parameter    (re=6370.)
1070
      parameter    (re=6370.)
-
 
1071
      real         pi180
-
 
1072
      parameter    (pi180=3.14159/180.)
-
 
1073
      
1071
      real         xp,yp,xq,yq,arg
1074
      real         xp,yp,xq,yq,arg
1072
      character*80 unit
1075
      character*80 unit
1073
      real         dlon
1076
      real         dlon
1074
 
1077
      
1075
      if ( unit.eq.'km' ) then
1078
      if ( unit.eq.'km' ) then
1076
 
1079
 
-
 
1080
         arg=sin(pi180*yp)*sin(pi180*yq)+
1077
         arg=sind(yp)*sind(yq)+cosd(yp)*cosd(yq)*cosd(xp-xq)
1081
     >            cos(pi180*yp)*cos(pi180*yq)*cos(pi180*(xp-xq))
1078
         if (arg.lt.-1.) arg=-1.
1082
         if (arg.lt.-1.) arg=-1.
1079
         if (arg.gt.1.) arg=1.
1083
         if (arg.gt.1.) arg=1.
1080
         sdis=re*acos(arg)
1084
         sdis=re*acos(arg)
1081
         
1085
         
1082
      elseif ( unit.eq.'deg' ) then
1086
      elseif ( unit.eq.'deg' ) then