<div dir="ltr"><div dir="ltr"><div dir="ltr"><div>I guess I do not understand:</div><div><br></div><div> latz = (/23.285/)<br> lonz = (/77.276/)<br><br> nlat = 2<br> mlon = 3<br> lat2d = <b>random_uniform</b>( 15, 30, (/nlat,mlon/))<br> lon2d = <b>random_uniform</b>( 50, 90, (/nlat,mlon/))<br><br> print(lat2d)<br> print("====")<br> print(lon2d)<br> print("====")<br><br>;; abs(iu) = 1 ; return the distance in radians<br>;; = 2 ; return the distance in degrees<br>;; = 3 ; return the distance in meters<br>;; = 4 ; return the distance in kilometers<br> iu = 2<br> npts = 2 ; beginning and end<br> gcdist= <b>gc_latlon</b>(latz,lonz, lat2d,lon2d, npts,iu)<br> print(gcdist)<br> print("====")<br> ; For 'fun' ; Pythagorean theorem</div><div> ; Not for sphere but ... crude approx for small distances<br></div><div> dlat = <b>abs</b>(lat2d - latz)<br> dlon = <b>abs</b>(lon2d - lonz)<br> dist = <b>sqrt</b>(dlat^2 + dlon^2)<br><br> print(latz+" "+lonz+" "+lat2d+" "+lon2d+" : "+<span style="color:rgb(0,0,255)"><b>gcdist</b></span>+" : "+dist)</div><div><br></div><div>=======</div><div>[snip]</div><div><br></div><div><b>Variable: gcdist<br>Type: float<br>Total Size: 24 bytes<br> 6 values<br>Number of Dimensions: 2<br>Dimensions and sizes: [2] x [3]<br>Coordinates: <br>Number Of Attributes: 4<br> units : degrees<br> gclon : <ARRAY of 12 elements><br> gclat : <ARRAY of 12 elements><br> spacing : ( 5.50189, 6.191937, 13.16254, 13.33037, 8.464802, 14.25519 )<br>(0,0) 5.50189<br>(0,1) 6.191937<br>(0,2) 13.16254<br>(1,0) 13.33037<br>(1,1) 8.464802<br>(1,2) 14.25519<br>(0) ====<br>(0,0) 23.285 77.276 19.8557 72.6484 : <span style="color:rgb(0,0,255)">5.50189 </span>: 5.75974<br>(0,1) 23.285 77.276 19.8659 82.8288 : <span style="color:rgb(0,0,255)">6.19194</span> : 6.52104<br>(0,2) 23.285 77.276 22.4008 63.0198 : <span style="color:rgb(0,0,255)">13.1625</span> : 14.2836<br>(1,0) 23.285 77.276 19.3309 63.6032 : <span style="color:rgb(0,0,255)">13.3304</span> : 14.2331<br>(1,1) 23.285 77.276 20.2951 85.8071 : <span style="color:rgb(0,0,255)">8.4648</span> : 9.03983<br>(1,2) 23.285 77.276 17.3094 63.464 : <span style="color:rgb(0,0,255)">14.2552</span> : 15.0492<br></b><br></div></div></div></div><br><div class="gmail_quote"><div dir="ltr">On Mon, Oct 15, 2018 at 3:34 AM Kunal Bali <<a href="mailto:kunal.bali9@gmail.com">kunal.bali9@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div>Dear Dennis Sir,</div><div>Thanks for the information. I have some query regarding the gc_latlon function/</div><div><br></div><div>This functions says "<span style="color:rgb(51,51,51);font-family:verdana,sans-serif;font-size:13.333333015441895px"><i>Finds the great circle distance (true surface distance) between two points on the globe and interpolates points along the great circle</i></span>"</div><div><br></div><div>But my CoD output was in a rectangular box. So will this function be useful for my rectangular box. and also I don't want to interpolate the points along the rectangular box. I want to calculate the distance of the given actual points/coordinates. </div><div> </div><div>However, I am not getting the desired output from here, </div><div>I used </div><div><br></div><div><div> dist = gc_latlon(latz,lonz,latv,lonv,2,4)</div><div> print(dist)</div></div><div><br></div><div>But it's not giving the value at every dimension size </div><div>e.g. <span style="color:rgb(0,0,0);font-family:Menlo;font-size:16px">Dimensions and sizes:</span><span class="m_5287655644943272449gmail-Apple-tab-span" style="color:rgb(0,0,0);font-family:Menlo;font-size:16px;white-space:pre-wrap"> </span><span style="color:rgb(0,0,0);font-family:Menlo;font-size:16px">[641] x [641]</span></div><div>So I need the distance at this dimension size as well. </div><div><br></div><div>ALSO used,</div><div><br></div><div> gcdist = gc_latlon(latz,lonz, latv,lonv, npts,2)</div><div><br></div><div> print (gcdist)</div><div> print (gcdist@gclat+" "+gcdist@gclon ) ; print the lats/lons</div><div><br></div><div><br></div><div><br></div><div><div dir="ltr" class="m_5287655644943272449gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div>---<br></div><div><font size="2"><span>Kunal Bali<br></span></font></div><div><b><br></b></div><div><br></div><div><p style="margin:0px;border-collapse:collapse;font-family:Tahoma,Verdana;font-size:12px"><font color="#1F497D"><br></font></p><p style="margin:0px;border-collapse:collapse;font-family:Tahoma,Verdana;font-size:12px"><font color="#1F497D"><br></font></p></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div><br></div></div></div></div></div></div><br><div class="gmail_quote"><div dir="ltr">On Mon, Oct 15, 2018 at 5:06 AM Dennis Shea <<a href="mailto:shea@ucar.edu" target="_blank">shea@ucar.edu</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div dir="ltr">Distance: <a href="http://www.ncl.ucar.edu/Document/Functions/Built-in/gc_latlon.shtml" target="_blank"><b>http://www.ncl.ucar.edu/Document/Functions/Built-in/gc_latlon.shtml</b></a><br></div></div><br><div class="gmail_quote"><div dir="ltr">On Sat, Oct 13, 2018 at 1:19 AM Kunal Bali <<a href="mailto:kunal.bali9@gmail.com" target="_blank">kunal.bali9@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr" class="m_5287655644943272449m_-843734811775281205m_861851138785188342gmail_signature"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr">Dear NCL users,</div><div dir="ltr"><br></div><div dir="ltr">I need to calculate the inverse weighted distance according to the attached figure</div><div dir="ltr"><br></div><div dir="ltr">The formula is </div><div dir="ltr"><b>xAvg = SUM[<font color="#ff0000">X</font>/<font color="#0000ff">w</font>]/SUM[1/<font color="#0000ff">w</font>]</b>. equation (1)</div><div dir="ltr"><div dir="ltr"><br></div><div dir="ltr">So first I need to calculate the distance from surrounding grid cells to the receptor cell </div><div dir="ltr"><br></div><div dir="ltr">receptor cell coordinates</div><div dir="ltr"> latz = (/23.285/)</div><div dir="ltr"> lonz = (/77.276/)</div></div><div dir="ltr"><br></div><div dir="ltr">I don't know how to calculate this distance from single receptor site to its surroundings grid cells. Surrounding grid cells spread ~500 km. <br></div><div dir="ltr"><div dir="ltr"><br></div></div><div dir="ltr"><br></div><div dir="ltr">I have calculated the <b><font color="#ff0000">X</font></b> here (which is a coefficient of divergence)</div><div dir="ltr"><br></div><div dir="ltr">and the coefficient of divergence is calculated as </div><div dir="ltr"> ;-----calculation of the coefficient of divergence</div><div dir="ltr"> DATA_SINGLE_3D = conform(data_subset, data_single, 0) </div><div dir="ltr"> x1 = (DATA_SINGLE_3D - data_subset)</div><div dir="ltr"> x2 = (DATA_SINGLE_3D + data_subset)</div><div dir="ltr"> CoD1 = (x1/where(x2.ne.0,x2,x2@_FillValue))^2 </div><div dir="ltr"><br></div><div dir="ltr"> CoD2 = dim_avg_n_Wrap(CoD1, 0) ; (nlat,mlon)</div><div dir="ltr"> CoD_final = sqrt(CoD2)</div><div dir="ltr"><br></div><div dir="ltr"><br></div><div dir="ltr"><br></div><div dir="ltr"><br></div><div dir="ltr">So please provide some information on that. I have attached the script here.</div><div dir="ltr"><br></div><div dir="ltr">regards</div><div dir="ltr">---</div><div dir="ltr">Kunal Bali</div><div dir="ltr"><br></div><div dir="ltr"><br></div><div dir="ltr"><br></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div>
_______________________________________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br>
</blockquote></div>
</blockquote></div>
_______________________________________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br>
</blockquote></div>