-
Notifications
You must be signed in to change notification settings - Fork 0
/
Calc_direction.f90
29 lines (29 loc) · 964 Bytes
/
Calc_direction.f90
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
!
! Calc_direction.f90 (c) Gottfried Harasek '04 - '17 13.04.2005
! This file is part of HCM.
!
! Calc_direction.f90 is free software: you can redistribute it and/or modify
! it as long as this copyright notice is kept intact, the sourcecode is
! distributed with the final distributed product, mentioning the copyright.
!
! Calc_direction.f90 is distributed in the hope that it will be useful,
! but WITHOUT ANY WARRANTY; without even the implied warranty of
! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
!
!
! Subroutine to calculate (horizontal) direction.
!
SUBROUTINE Calc_direction (LonA, LatA, LonB, LatB, Azi)
!
IMPLICIT NONE
!
! lon, lat, azi in degrees
DOUBLE PRECISION LonA, LatA, LonB, LatB, Azi
!
Azi = DATAN2D(DSIND(LonB-LonA) * DCOSD(LatB), &
DCOSD(LatA) * DSIND(LatB) - DSIND(LatA) * DCOSD(LatB) * DCOSD(LonB - LonA))
IF (Azi .LT. 0D0) Azi = Azi + 360D0
RETURN
!
END SUBROUTINE Calc_direction
!