comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » What is the problem ?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
What is the problem ? [message #68408] Tue, 27 October 2009 23:28
Ruby is currently offline  Ruby
Messages: 2
Registered: October 2009
Junior Member
I wrote a simple program to caculate the distance between two location
(lon1,lat1), (lon2,lat2)

function earth_dis ,lon1,lon2,lat1,lat2

b1 = !pi*lat1/180.0
b2 = !pi*lat2/180.0
a1 = !pi*lon1/180.0
a2 = !pi*lon2/180.0

dis = 6378.1*acos( cos(b1)*cos(b2)*cos(a1-a2)+sin(b1)*sin(b2))

RETURN,dis
END

But When I tried to test the program, the results turned to be like
IDL> print,earth_dis(4.0,4.0,4.0,4.0)
-NaN
IDL> print,earth_dis(8.0,8.0,8.0,8.0)
2.20215

In both cases, the result should be straightforwardly equal 0. Then
what is the problem with my program or IDL ?
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: MAC running IDL 7.0 from the command line
Next Topic: Re: Problem to read some data.

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 17:39:19 PDT 2025

Total time taken to generate the page: 0.00586 seconds