# [ncl-talk] getting max/min value from domain limited by resource

Guido Cioni guidocioni at gmail.com
Wed May 24 01:01:38 MDT 2017

```Hi,
you can use the resources to constraint the area where you are searching the minimum. You have to first find the indices of the cells included in your domain:

ind_cells=ind(lon.ge.mpres at mpMinLonF .and. lon.le.mpres at mpMaxLonF .and. lat.ge.mpres at mpMinLatF .and.  lat.le.mpres at mpMaxLatF)

Then you can look for the minimum (assuming that there is only once cell that satisfies this, otherwise you have to write a few lines more):

min_precipitation=dim_min_n_Wrap(precipitation(:,ind_cells), 1)

Be careful that, once subsetted the data, you can not print the lat-lon values of the minimum as the indices will be different from the original ones. But something like that should work

do i=0,dimsizes(time)-1
ind_min:=ind(precipitation(i,:).eq.min_precipitation(i))
lon_min(i)=lon(ind_min)
lat_min(i)=lat(ind_min)
end do

Note that here I’m looping over time because the ind function accepts only 1-D arrays.

Hope that helps.

> Il giorno 24 mag 2017, alle ore 07:53, Gaeun Kim <gaeun.kim0921 at gmail.com> ha scritto:
>
> Dear users
>
> I want to get max/min value from the domain limited by setting resource.
> The data I used is global(mother domain), Asia(child domain) and etc. but I want to look into a specific region like below.
>
> > /> mpres at mpLimitMode = "LatLon" /
> > /> mpres at mpMinLatF = 33. /
> > /> mpres at mpMaxLatF = 36./
> > /> mpres at mpMinLonF = 126. /
> > /> mpres at mpMaxLonF = 130./
>
> Please refer to the attached images, you can guess what I want to find.
> The data(let's say precipitation for example) is 2d(time,ncells) and triangular grid.
> Can anyone give an advise with this?
> Thanks a lot
>
> Regards,
> Gaeun
>
> <domain 4.png><domain1.png>_______________________________________________
> 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/20170524/a20be862/attachment.html
```