# [ncl-talk] pick up a point data based on coordinates

Mary Haley haley at ucar.edu
Wed Nov 11 09:30:01 MST 2015

```Mark,

Just FYI: your message ended up in my spam box, and I imagine it might have
ended up in other people's spam box as well. I've noticed that yahoo.com
addresses frequently get marked as "spam" by gmail.

Anyway, there's not really enough information here to answer your
question.  I'm not sure what you mean by "standard" netcdf data.  Is this
data rectilinear (1D lat/lon coordinate variables) or curvilinear (2D
lat/lon) arrays or unstructured (1D data/lat/lon or something like a
triangular mesh)?

If the data is rectilinear, then you can grab the points you want using the
special { and } syntax:

;---Open data file with coordinate arrays "lat" and "lon"
lon_points = (/-25,10,0,-100,50/)
lat_points = (/-70,0,70/)
lon_subset = f->lon({lon_points})
lat_subset = f->lat({lat_points})

print("requested lat value  = " + lat_points + \
",  closest lat value = " + lat_subset)
print("requested lon value  = " + lon_points + \
",  closest lon value = " + lon_subset)

Note that the values returned are the closest values that are *less than*
(not interpolated values) to the points you specified.

If you have 2D lat/lon arrays, then you can use the getind_latlon2d
function:

http://www.ncl.ucar.edu/Document/Functions/Contributed/getind_latlon2d.shtml

There's a good example on that page of how to use this function.

--Mary

> Thanks very much in advance!
> Mark
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20151111/0ab4d42b/attachment.html
```