# [ncl-talk] Average values over a specified region

Guido Cioni guidocioni at gmail.com
Tue Jan 26 07:13:08 MST 2016

```Shouldn’t the coordinate subscripting do the same thing?
Like say {lat13-2:lat13+2,  lon80-2:lon80+2}

Guido Cioni
http://guidocioni.altervista.org <http://guidocioni.altervista.org/>

> On 26 Jan 2016, at 15:04, Karin Meier-Fleischer <meier-fleischer at dkrz.de> wrote:
>
> Hi Krishna,
>
> you can use the function closest_val to retrieve an index of an value.
>
>   lat13  =  closest_val(13,lat)
>   lon80  =  closest_val(80,lon)
>
>   print("Index: "+lat13+" -  "+lat(lat13))
>   print("Index: "+lon80+" -  "+lon(lon80))
>
> To plot 2 more grid boxes of lat/lon than you can use e.g.
>
>   plot = gsn_csm_contour_map(wks, var(lat13-2:lat13+2,lon80-2:lon80+2),res)
>
>
> Bye,
> Karin
>
> Am 26.01.16 um 14:13 schrieb Krishna C:
>> Hi
>>
>>
>> Let us say i need a 2 by 2 box around 13 degree lat and 80 degree lon . How do i know the respective indices.
>> Please correct if i am wrong.
>>
>> Regards
>> -Krishna-
>>
>> On Tue, Jan 26, 2016 at 5:14 PM, Guido Cioni <guidocioni at gmail.com <mailto:guidocioni at gmail.com>> wrote:
>> Yes there is, but you should have a look at the documentation on the page ;-)
>> The function that you need is dim_avg_n, then you just need to restrict the latitude and longitude with brackets {43:45}. Again, just go on ncl documentation and you'll definitely find a way
>>
>> Il 26 gen 2016 11:52 AM, "Krishna C" <chandrakrishna.90 at gmail.com <mailto:chandrakrishna.90 at gmail.com>> ha scritto:
>> Hi,
>>
>>
>> I am trying to extract precipitation values from WRF output, over a small 2 by 2 lat  lon box and average it. Is there any explicit way of doing it in ncl
>>
>> With warm regards
>>
>>
>> -Krishna-
>>
>> _______________________________________________
>> ncl-talk mailing list
>> ncl-talk at ucar.edu <mailto:ncl-talk at ucar.edu>
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk <http://mailman.ucar.edu/mailman/listinfo/ncl-talk>
>>
>>
>>
>>
>> _______________________________________________
>> ncl-talk mailing list
>> ncl-talk at ucar.edu <mailto:ncl-talk at ucar.edu>
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk <http://mailman.ucar.edu/mailman/listinfo/ncl-talk>
>
> _______________________________________________
> 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/20160126/c20ee663/attachment.html
```