subroutine distk(rlon1, rlat1, rlon2, rlat2, dx, dy, rad) ! This routine calculates the distance in km (rad) between the ! points (rlon1,rlat1) and (rlon2,rlat2) using an approximate ! formula. The lon and lat are in deg E and N. The east and ! north components of the distance (dx,dy) are also calculated. ! Modifications: ! 4/26/21 (J. Dostalek) Started this Fortran 90 version !------------------------------------------------------------------------------- implicit none real, intent(in) :: rlon1 real, intent(in) :: rlat1 real, intent(in) :: rlon2 real, intent(in) :: rlat2 real, intent(out) :: dx real, intent(out) :: dy real, intent(out) :: rad real, parameter :: dtk = 111.1 real, parameter :: dtr = 0.0174533 real :: cfac cfac = cos(0.5*dtr*(rlat1 + rlat2)) dx = dtk*(rlon2 - rlon1)*cfac dy = dtk*(rlat2 - rlat1) rad = sqrt(dx*dx + dy*dy) return end subroutine distk