[gradsusr] Calculate distance between latitude-longitude in GrADS

PHILBERT LUHUNGA philuhunga at yahoo.com
Mon Feb 16 04:34:29 EST 2015


Dear David, thank you. Let me try to learn the script, but it seems to be complexthank you again, if you can simplify it will appreciate.  AS EVER
LUHUNGA

--------------------
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.com
      From: Davide Sacchetti <davide.sacchetti at arpal.gov.it>
 To: PHILBERT LUHUNGA <philuhunga at yahoo.com>; GrADS Users Forum <gradsusr at gradsusr.org> 
 Sent: Monday, February 16, 2015 10:42 AM
 Subject: Re: [gradsusr] Calculate distance between latitude-longitude in GrADS
   
  function dist(lon1,lat1,lon2,lat2)
* Distance between two points on the Earth surface
    _At=6371229
    _PI=3.141592654
    _D2R=_PI/180
    _R2D=180/_PI
    Theta1=lon1*_D2R;Phi1=(90-lat1)*_D2R
    'd sin('Phi1')*cos('Theta1')'
    x1=subwrd(result,4)
    'd sin('Phi1')*sin('Theta1')'
    y1=subwrd(result,4)
    'd cos('Phi1')'
    z1=subwrd(result,4)
    Theta2=lon2*_D2R;Phi2=(90-lat2)*_D2R
    'd sin('Phi2')*cos('Theta2')'
    x2=subwrd(result,4)
    'd sin('Phi2')*sin('Theta2')'
    y2=subwrd(result,4)
    'd cos('Phi2')'
    z2=subwrd(result,4)
*    x=y1*z2-y2*z1
*    y=x2*z1-x1*z2
*    z=x1*y2-x2*y1
*    d2=x*x+y*y+z*z
    Alpha='acos( cos('Phi1')*cos('Phi2') +
cos('Theta1'-'Theta2')*sin('Phi1')*sin('Phi2'))'
*    'd asin(sqrt('d2'))'
*    'd acos('Alpha')'
    'd 'Alpha
*say 'T,P: 'Theta1' 'Phi1
*say 'T,P: 'Theta2' 'Phi2
*say 'A,cA: 'Alpha' 'subwrd(result,4)
  return (subwrd(result,4)*_At)    





On Mon, 2015-02-16 at 07:45 +0000, PHILBERT LUHUNGA wrote:
> Hi does any one knows how to compute distance between two latitude and
> longitude points in GrADs. I have two points
> lon1=30
> lat1=-6
> lon2=30.6
> lat2=-6.4
> 
> 
> please help
>  
> AS EVER 
> LUHUNGA 
> 
> -------------------- 
> 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.com
> _______________________________________________
> gradsusr mailing list
> gradsusr at gradsusr.org
> http://gradsusr.org/mailman/listinfo/gradsusr

-- 
Davide Sacchetti
Centro Funzionale Meteo Idrologico di Protezione Civile della Regione Liguria
ARPAL Unità Tecnica Complessa di livello Regionale
V.le Brigare Partigiane 2 16121 Genova (I)
tel: +39 010 6437535                    fax: +39 010 6437520


mail: davide.sacchetti at arpal.gov.it    web: www.meteoliguria.it




  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gradsusr.org/pipermail/gradsusr/attachments/20150216/e848364d/attachment-0001.html 


More information about the gradsusr mailing list