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

Mark Chan cym263 at yahoo.com
Thu Nov 12 12:50:47 MST 2015

```Dear Mary,
With my best regards,Mark

On Wednesday, November 11, 2015 5:30 PM, Mary Haley <haley at ucar.edu> wrote:

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"f = addfile("\$NCARG_ROOT/lib/ncarg/data/cdf/uv300.nc","r")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/20151112/9cbf5e99/attachment.html
```