[ncl-talk] Find nearest grid with non-missing value
Adam Phillips
asphilli at ucar.edu
Wed Dec 3 10:52:59 MST 2014
Hi Xin,
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:
lat = 20.5
lon = 150.
arr_pt = arr(:,{lat},{lon}) ; use coordinate subscripting to grab
timeseries
if (all(ismissing(arr_pt))) then ; use the all and ismissing functions
to identify whether
; arr_pt is completely
missing.
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?
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.
If you have any further questions on this matter please respond to the
ncl-talk email list.
Adam
On Mon, Dec 1, 2014 at 4:10 PM, Xin Xi <xin.xi30 at gmail.com> wrote:
> 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)?
> Thanks!
> Xin
>
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
--
Adam Phillips
Associate Scientist, Climate and Global Dynamics Division, NCAR
www.cgd.ucar.edu/staff/asphilli/ 303-497-1726
<http://www.cgd.ucar.edu/staff/asphilli>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20141203/a82ff28e/attachment.html
More information about the ncl-talk
mailing list