Re: look for the nearest pixel

From: Dave Allured <dave.allured_at_nyahnyahspammersnyahnyah>
Date: Sun Oct 25 2009 - 12:54:06 MDT

Lei,

Let xlat, xlon be the coordinates that you want to find.
Let var be the array or subarray from the Netcdf file, with
one-dimensional coordinate variables lat and lon.

   ilat = minind (abs (xlat - var&lat))
   ilon = minind (abs (xlon - var&lon))

Related:
http://www.ncl.ucar.edu/Document/Functions/Contributed/closest_val.shtml
http://www.ncl.ucar.edu/Support/talk_archives/2007/0357.html

Dave Allured
CU/CIRES Climate Diagnostics Center (CDC)
http://cires.colorado.edu/science/centers/cdc/
NOAA/ESRL/PSD, Climate Analysis Branch (CAB)
*** http://www.esrl.noaa.gov/psd/psd1/ ***
NOTICE: NEW PSD1/CAB WEBSITE ADDRESS AS OF 2009-OCT-14
PRODUCT AND DATA CONSUMERS PLEASE TAKE NOTE

lei.zhao@yale.edu wrote:
> Hi all,
>
> If I know the exact latitude and longitude of a place, is there any function in
> NCL to help find the nearest pixel in the .nc file data matrix?
>
> Thank you very much for your help!
>
> Best,
> Lei
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Sun Oct 25 12:53:58 2009

This archive was generated by hypermail 2.1.8 : Mon Oct 26 2009 - 15:01:33 MDT