Re: find grid position [lat,lon] for specfic value

From: Adam Phillips <asphilli_at_nyahnyahspammersnyahnyah>
Date: Mon Jan 14 2013 - 12:53:58 MST

Hi Dave,
At your great suggestion, I added your coding below as an example on the
minind and maxind function pages.
Thanks! Adam

On 01/09/2013 04:30 PM, Dave Allured - NOAA Affiliate wrote:
> Use the maxind function, not dim_max_n. Suppose X(lat,lon) is a 2-D
> variable with coordinate variables lat and lon. The lat and lon
> coordinate variables are required for this to work:
>
> dims = dimsizes (X)
> x1d = ndtooned (X)
> inds = ind_resolve (maxind (x1d), dims)
> ilat = inds(0,0)
> ilon = inds(0,1)
> lat_max = X&lat(ilat)
> lon_max = X&lon(ilon)
> print (lat_max + ", " + lon_max)
>
> Example 3 on the page for the ind_resolve function is a more general
> example of finding the real coordinates of grid points meeting certain
> conditions. Note that extracting the real lat and lon coordinates is
> just the final step, the grid indices ilat and ilon are the primary
> result. HTH.
>
> Suggestion for NCL documentation: Please add the above example to the
> doc pages for minind and maxind. I think this is a common user
> question.
>
> --Dave
>
> On Wed, Jan 9, 2013 at 4:19 AM, Ahmad Farsyud <a.farsyud@gmail.com> wrote:
>> Dear NCL,
>>
>> How could I obtain the location [grid] for a specific value in my dataset,
>> for instance i want to find grid position [lat,lon] where X(variable) equal
>> to max value.
>> I did try to use dim_max_n , but it gives me some indices instead of real
>> grid position.
>>
>> Thanks for any hints.
>>
>> Ahmad F.
>>
>>
>> _______________________________________________
>> ncl-talk mailing list
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

-- 
______________________________________________________________
Adam Phillips                                asphilli@ucar.edu
NCAR/Climate and Global Dynamics Division       (303) 497-1726
P.O. Box 3000				
Boulder, CO 80307-3000    http://www.cgd.ucar.edu/cas/asphilli
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Mon Jan 14 12:54:06 2013

This archive was generated by hypermail 2.1.8 : Mon Jan 14 2013 - 14:31:37 MST