From 6977ecbbdfd31e8798573dcf0ee97ea380e32131 Mon Sep 17 00:00:00 2001 From: Joe Taylor Date: Sat, 10 Dec 2016 18:12:45 +0000 Subject: [PATCH] Protect against locator at antipodes causing undefined azimuth. git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@7376 ab8295b8-cf94-4d9e-aec4-7959e3be5d79 --- lib/azdist.f90 | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/lib/azdist.f90 b/lib/azdist.f90 index 2e21b5172..d7eb90630 100644 --- a/lib/azdist.f90 +++ b/lib/azdist.f90 @@ -49,23 +49,27 @@ subroutine azdist(grid1,grid2,utch,nAz,nEl,nDmiles,nDkm,nHotAz,nHotABetter) HotABetter=.true. go to 900 endif - call grid2deg(MyGrid,dlong1,dlat1) call grid2deg(HisGrid,dlong2,dlat2) eps=1.e-6 - if(abs(dlat1-dlat2).lt.eps .and. abs(dlong1-dlong2).lt.eps) then - Az=0. - Dmiles=0. - Dkm=0.0 - El=0. - HotA=0. - HotB=0. - HotABetter=.true. + Az=0. + Dmiles=0. + Dkm=0.0 + El=0. + HotA=0. + HotB=0. + HotABetter=.true. + if(abs(dlat1-dlat2).lt.eps .and. abs(dlong1-dlong2).lt.eps) go to 900 + + difflong=mod(dlong1-dlong2+720.0,360.0) + if(abs(dlat1+dlat2).lt.eps .and. abs(difflong-180.0).lt.eps) then +! Antipodes + Dkm=20400 go to 900 - else - call geodist(dlat1,dlong1,dlat2,dlong2,Az,Baz,Dkm) endif + call geodist(dlat1,dlong1,dlat2,dlong2,Az,Baz,Dkm) + ndkm=Dkm/100 j=ndkm-4 if(j.lt.1) j=1