[ncl-talk] Sub: Area average of a specific US state
Mary Haley
haley at ucar.edu
Fri Dec 2 14:26:47 MST 2016
See example shapefile_13.ncl at:
http://www.ncl.ucar.edu/Applications/shapefiles.shtml
You will want to download the USA shapefiles from gadm.org/country, and use
the USA_adm1.shp shapefile, which contains the outlines for each state.
On Thu, Dec 1, 2016 at 1:49 PM, Adv <advita6 at gmail.com> wrote:
> Hi ,
> Could someone help me to compute area average of specific US state. ?
>
> Thank you
> Adv
>
> ymStrt = 196501
> ymLast = 200512
>
> fili = "air.mon.mean.nc"
> f = addfile(diri+fili,"r")
>
> YYYYMM = cd_calendar( f->time, -1)
>
> iStrt = ind(YYYYMM.eq.ymStrt)
> iLast = ind(YYYYMM.eq.ymLast)
> xt = f->air(:,::-1,:)
> printVarSummary(xt) ; [time| 720]x[lat|
> 91]x[lon| 180]
> ; Minnesota., Montana......
> x = xt(iStrt:iLast,{40:49},{104:97})
> x1 = xt(iStrt:iLast,{45:49},{116:104})
> x2 = xt(iStrt:iLast,{43.5:49},{97:93})
> x3 = xt(iStrt:iLast,{43.5:49},{97.5:90})
> delete(xt)
> printVarSummary(x) ; [time| 720]x[lat|
> 91]x[lon| 180]
> ;************************************************
> ; Calculate the Annual Mean (slopes)
> ;************************************************
> rc= dim_avg_n(x,(/1,2/))
> rc1= dim_avg_n(x1,(/1,2/))
> rc2= dim_avg_n(x2,(/1,2/))
> rc3= dim_avg_n(x3,(/1,2/))
>
> printVarSummary(rc)
> t=(rc+rc1+rc2+rc3)/4
> print(t)
> return
>
>
> _______________________________________________
> 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/20161202/ca2e70d5/attachment.html
More information about the ncl-talk
mailing list