<div dir="ltr"><div><div><div><div><div><div><div><div><div>Hi Xin,<br></div>It can be done, but the complexity of the coding depends on exactly what you'd like to do if the selected timeseries is all missing. A function does not exist to do this. The start of the coding could look like this, and could easily be put into a loop:<br><br></div>lat = 20.5<br>lon = 150.<br></div>arr_pt = arr(:,{lat},{lon}) ; use coordinate subscripting to grab timeseries<br><br></div>if (all(ismissing(arr_pt))) then ; use the all and ismissing functions to identify whether<br></div> ; arr_pt is completely missing.<br><br></div>Now from here, it depends on exactly how you'd like to go about finding the closest gridpoint. You can calculate the distance between the targeted grid point and the closest say, 4 grid points. But what if two grid points are exactly the same distance away from the targeted grid point? More importantly, what if the closest grid point is also missing?<br><br></div>So, this is all possible, but you will have to do the coding by hand, answering the questions above along with others I haven't thought of.<br><br></div>If you have any further questions on this matter please respond to the ncl-talk email list.<br></div>Adam <br><div><div><div><div><div><br><div><div><div> <br><div><div><div><br></div></div></div></div></div></div></div></div></div></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Dec 1, 2014 at 4:10 PM, Xin Xi <span dir="ltr"><<a href="mailto:xin.xi30@gmail.com" target="_blank">xin.xi30@gmail.com</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"><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;color:rgb(0,0,0)">Hi, I have a dataset with dimensions time x lat x lon. I need to find the 1-D time series from a location using the corresponds lat/lon index. In some cases, the dataset has missing values for the location, in which case I want to use the nearest grid instead. Can this be done in NCL (with a function in place)?<br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;color:rgb(0,0,0)">Thanks!<span class="HOEnZb"><font color="#888888"><br></font></span></div><span class="HOEnZb"><font color="#888888"><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;color:rgb(0,0,0)">Xin<br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;color:rgb(0,0,0)"><br></div></font></span></div>
<br>_______________________________________________<br>
ncl-talk mailing list<br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br>
<br></blockquote></div><br><br clear="all"><br>-- <br><div class="gmail_signature"><div dir="ltr"><div><div><div><span><font color="#888888">Adam Phillips <br></font></span></div><span><font color="#888888">Associate Scientist, </font></span><span><font color="#888888">Climate and Global Dynamics Division, NCAR<br></font></span></div></div><div><span><font color="#888888"><a href="http://www.cgd.ucar.edu/staff/asphilli/" target="_blank">www.cgd.ucar.edu/staff/asphilli/</a> </font></span><span><font color="#888888">303-497-1726 </font></span></div><span><font color="#888888"></font></span><div><div><span><font color="#888888"><br></font></span><div><span><font color="#888888"><a href="http://www.cgd.ucar.edu/staff/asphilli" target="_blank"></a></font></span></div></div></div></div></div>
</div>