Skip to content

Commit 2a5ce4a

Browse files
committed
Switched off Akima to check sensitivity
1 parent 9eb4185 commit 2a5ce4a

File tree

5 files changed

+288
-152
lines changed

5 files changed

+288
-152
lines changed

haversine.f90

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,10 @@ module haversine
3131
!
3232
!===========================================================================
3333
implicit none
34-
real(kind=8), parameter :: erad = 6371315.0
35-
real(kind=8), parameter :: d2r = 0.017453292519943295 ! == pi / 180.
34+
! http://www.fortran90.org/src/best-practices.html#floating-point-numbers
35+
integer, parameter :: dp = kind(0.d0)
36+
real(kind=dp), parameter :: erad = 6371315.0_dp
37+
real(kind=dp), parameter :: d2r = 0.017453292519943295_dp ! == pi / 180.
3638

3739
contains
3840

@@ -42,13 +44,12 @@ subroutine distance_matrix(xa, xb, dist)
4244
!------------------------------------------------------------------------------
4345

4446
real(kind=8), dimension(:,:), intent(in) :: xa, xb
45-
integer(kind=8) :: i, j, m, n
46-
real(kind=8) :: thedist
47+
integer(kind=dp) :: i, j, m, n
48+
real(kind=dp) :: thedist
4749
real(kind=8), dimension(:,:), intent(inout) :: dist
4850

4951
m = size(xa, 1)
5052
n = size(xb, 1)
51-
! write (*,*) 'm,n', m, n
5253

5354
! Loop over empty dist matrix and fill
5455
do j = 1, m
@@ -68,8 +69,8 @@ subroutine distance_vector(lon1, lat1, lon2, lat2, dist)
6869
!------------------------------------------------------------------------------
6970

7071
real(kind=8), dimension(:), intent(in) :: lon1, lat1, lon2, lat2
71-
integer(kind=8) :: i, m
72-
real(kind=8) :: thedist
72+
integer(kind=dp) :: i, m
73+
real(kind=dp) :: thedist
7374
real(kind=8), dimension(:), intent(inout) :: dist
7475

7576
m = size(lon1)
@@ -102,8 +103,7 @@ subroutine get_haversine(lon1, lat1, lon2, lat2, thedist)
102103
!------------------------------------------------------------------------------
103104
!
104105
real(kind=8), intent(in) :: lon1, lat1, lon2, lat2
105-
real(kind=8) :: lt1, lt2, dlat, dlon
106-
real(kind=8) :: a
106+
real(kind=dp) :: lt1, lt2, dlat, dlon, a
107107
real(kind=8), intent(out) :: thedist
108108
!
109109
dlat = d2r * (lat2 - lat1)
@@ -124,7 +124,7 @@ subroutine waypoint_vector(lonin, latin, anglein, distin, lon, lat)
124124
!------------------------------------------------------------------------------
125125

126126
real(kind=8), dimension(:), intent(in) :: lonin, latin, anglein, distin
127-
integer(kind=8) :: i, m
127+
integer(kind=dp) :: i, m
128128
real(kind=8) :: thelon, thelat
129129
real(kind=8), dimension(:), intent(inout) :: lon, lat
130130
! external :: waypoint
@@ -145,9 +145,8 @@ end subroutine waypoint_vector
145145
subroutine get_waypoint(lonin, latin, anglein, distin, thelon, thelat)
146146
!------------------------------------------------------------------------------
147147
!
148-
implicit none
149148
real(kind=8), intent(in) :: lonin, latin, anglein, distin
150-
real(kind=8) :: ln1, lt1, angle, dr
149+
real(kind=dp) :: ln1, lt1, angle, dr
151150
real(kind=8), intent(out) :: thelon, thelat
152151
!
153152
dr = distin / erad ! angular distance

0 commit comments

Comments
 (0)