<div dir="ltr"><div class="gmail_default" style="font-size:small">Ashish,</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">From your script, I'm not sure how you are determining the values are wrong, as I didn't see that you were actually printing any lat/lon values. </div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">Did you try doing any debugging of your code to see where the problem was?</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">It first helps to verify that the min/max lat/lon values you are inputting to getind_latlon2d are close in the range of your 2D lat/lon arrays. </div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">A simple "printMinMax" will give you that information:</div><div class="gmail_default"><br></div><div class="gmail_default"><font face="monospace, monospace">printMinMax(lat2d_narr,0)</font></div><div class="gmail_default"><font face="monospace, monospace">printMinMax(lon2d_narr,0)</font></div><div><font face="monospace, monospace"><br></font></div><div class="gmail_default" style="font-size:small">If this looks good then print "nm" to make sure these values look okay:</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small"><font face="monospace, monospace">print("lat2d_narr dims = " + dimsizes(lat2d_narr))</font></div><div class="gmail_default" style="font-size:small"><font face="monospace, monospace">print("nm = " + nm) ; To make sure nm values are not out-of-range of your 2D lat/lon array</font></div><div class="gmail_default" style="font-size:small"><font face="arial, helvetica, sans-serif"><br></font></div><div class="gmail_default" style="font-size:small"><font face="arial, helvetica, sans-serif">If the above looks okay then try:</font></div><div class="gmail_default" style="font-size:small"><font face="monospace, monospace"><br></font></div><div class="gmail_default" style="font-size:small"><font face="monospace, monospace"><div class="gmail_default"> iStrt = nm(0,0)</div><div class="gmail_default"> jStrt = nm(0,1)</div><div class="gmail_default"> iLast = nm(1,0)</div><div class="gmail_default"> jLast = nm(1,1) </div></font></div><div class="gmail_default" style="font-size:small"><font face="monospace, monospace"> lat_strt = lat2d_narr(iStrt,jStrt)</font></div><div class="gmail_default"><font face="monospace, monospace"> lat_last = lat2d_narr(iLast,jLast)</font></div><div class="gmail_default"><div class="gmail_default"><font face="monospace, monospace"> lon_strt = lon2d_narr(iStrt,jStrt)</font></div><div class="gmail_default"><font face="monospace, monospace"> lon_last = lon2d_narr(iLast,jLast)</font></div><div class="gmail_default"><font face="monospace, monospace"> print("lat/lon start = " + lat_strt + "/" + lon_strt)</font></div></div><div class="gmail_default" style="font-size:small"><div class="gmail_default"><div class="gmail_default"><font face="monospace, monospace"> print("lat/lon last = " + lat_last + "/" + lon_last)</font></div><div><font face="monospace, monospace"><br></font></div></div></div><div class="gmail_default" style="font-size:small">Hopefully the above code will help you locate the source of the error.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">--Mary</div><div class="gmail_default" style="font-size:small"><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Mar 16, 2016 at 1:12 PM, Ashish Sharma <span dir="ltr"><<a href="mailto:asharma7@nd.edu" target="_blank">asharma7@nd.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hello,<div><br></div><div>I am trying to find corresponding ij for lat-lon pair from NARR data using <b>getind_latlon2d</b> command, but the values are wrong. </div><div><br></div><div>Please advise.</div><div><br></div><div>thanks,</div><div>Ashish</div><div><br></div><div><p style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"> minlat = 37.37814</p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"> maxlat = 46.64286</p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"> minlon = -98.91251</p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"> maxlon = -73.89026</p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;min-height:13px"><br></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo">;=================================================;</p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo">f3 = addfile("<a href="http://land.nc" target="_blank">land.nc</a>","r")</p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"> lat2d_narr = f3->lat ; (277,349)</p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"> lon2d_narr = f3->lon</p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;min-height:13px"><br></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"> printMinMax(lat2d_narr, 0)</p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"> printMinMax(lon2d_narr, 0)</p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;min-height:13px"><br></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"> lat = (/ minlat,maxlat /) ; user specified coordinate pairs</p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"> lon = (/minlon,maxlon /)</p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;min-height:13px"><br></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"> nm = <b>getind_latlon2d</b> (lat2d_narr,lon2d_narr, lat, lon)</p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"> print(nm)</p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"> iStrt = nm(0,0)</p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"> jStrt = nm(0,1)</p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"> iLast = nm(1,0)</p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"> jLast = nm(1,1)</p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;min-height:13px"><br></p></div></div>
<br>_______________________________________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu">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>
<br></blockquote></div><br></div>