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

Date: Mon Jan 14 2013 - 12:53:58 MST

Hi Dave,
minind and maxind function pages.

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.
>>
>>
>>
>> _______________________________________________
>> 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

```--
______________________________________________________________