[gradsusr] Calculate distance between latitude-longitude in GrADS

PHILBERT LUHUNGA philuhunga at yahoo.com
Mon Feb 16 14:48:58 EST 2015

Dear Davide, I wrote my script like 'sdfopen 1tasmin_AFR-44_ICHEC-EC-EARTH_historical_r3i1p1_DMI-HIRHAM5_v2_day_19710101-19751231.nc'*Distance between two points on the earth surface'lat1=-10.5''lon1=30'
*'dlon=lon1-lon2''dlat=lat1-lat2''r=6.371229*pow(10,6)''pi=3.14159''d2r=pi/180''define theta1=lon1*d2r''define phi1=(90-lat1)*d2r'
'define p1=sin(Phi1)*cos(Theta1)''define l1=sin(Phi1)*sin(Theta1)''define m1=cos(Phi1)'
'define theta2=lon2*d2r''define phi2=(90-lat2)*d2r'
'define p2=sin(Phi2)*cos(Theta2)''define l2=sin(Phi1)*sin(Theta2)''define m2=cos(Phi2)'

'Alpha=acos(cos(Phi1)*cos(Phi2) + cos(Theta1-Theta2)*sin(Phi1)*sin(Phi2))''d1=r*Alpha' I am getting 1097610.00 m=1098kmI compared with the online calculator at NOAA, they are getting 1097 km

|  |


Philbert Modest Luhunga
University of Pretoria 
Department of Geography,Geoinformatics and Meteorology
Private Bag X20 Hatfield 0028 South Africa
Tel +27 (0) 12 420 5164
Fax +27 (0) 12 420 6385
Mobile:+ 27826228060
Email address: philuhunga at yahoo.co
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gradsusr.org/pipermail/gradsusr/attachments/20150216/3fb8de65/attachment.html 

More information about the gradsusr mailing list