Re: want to do montly average only the noon time value in each grid

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Mon Jun 11 2012 - 15:53:48 MDT

Something like

    ntim = dimsizes(time)

    nStrt = 5
    nJump = 6
    nSkip = 19

    do n=5,ntim-1,nSkip
       n1 = n
       n2 = n1+nJump
       print("n1="+n1+" n2="+n2)

       x = f->X(n1:n2,:,:)
       xavg = dim_avg_n(x,0)
    end do

On 6/11/12 1:40 PM, mark vogel wrote:
> Hi Dennis
> I read it but I do not get it about the stride syntax.
> I want to average the time in the afternoon for the whole month from 05
> UTC to 11 UTC
> so I start with array 5 to arry 11 (5:11) and then want to skip 19
> values and start again at the array 30 to 36 and then skip 19 values
> again until the end. So I get the values only afternoon out before use
> the dim_avg_n
>
> What syntax I should use?
> Mark
>
> On Mon, Jun 11, 2012 at 3:24 PM, Dennis Shea <shea@ucar.edu
> <mailto:shea@ucar.edu>> wrote:
>
> If you read the documentation for dim_avg,
>
> http://www.ncl.ucar.edu/__Document/Functions/Built-in/__dim_avg.shtml <http://www.ncl.ucar.edu/Document/Functions/Built-in/dim_avg.shtml>
>
> you will see that it performs the average of the *rightmost* dimension.
>
> (Time, south_north, west_east) ; rightmost is 'west_east'
>
> It is suggested that you read and use
>
> http://www.ncl.ucar.edu/__Document/Functions/Built-in/__dim_avg_n.shtml
> <http://www.ncl.ucar.edu/Document/Functions/Built-in/dim_avg_n.shtml>
>
> qavg = dim_avg_n(q, 0)
> printVarSummary(qavg)
>
> or with meta data
>
>
> http://www.ncl.ucar.edu/__Document/Functions/__Contributed/dim_avg_n_Wrap.__shtml
> <http://www.ncl.ucar.edu/Document/Functions/Contributed/dim_avg_n_Wrap.shtml>
>
> qavg = dim_avg_n_Wrap(q, 0)
> printVarSummary(qavg)
>
> --
> Also, this does not look correct
>
>
> f = addfiles(filesn, "r") ; change to filesn1 if 2006 )
> x = f[:]->HFX(:,:,:) ;
> (Time, south_north, west_east)
> x1 = x(5:10:19,:,:)
>
> The 5:10:19 makes no sense. It 'say' to use index values 5 thru 10
> in strides of 19.
>
> Please read about subscripting at:
>
>
> http://www.ncl.ucar.edu/__Document/Manuals/Ref_Manual/__NclVariables.shtml#Subscripts
> <http://www.ncl.ucar.edu/Document/Manuals/Ref_Manual/NclVariables.shtml#Subscripts>
>
>
>
>
>
> On 6/11/12 1:02 PM, mark vogel wrote:
>
> Hi all
> I used dim avg to do the average for the afternoon time for each
> lat lon.
> But I am not sure dim-avg is average for each grid.
> It look like it averaged from west to east domain.
> What should I used to average the time in each grid point?
> Anyone answer me please
> Mark
> ---------- Forwarded message ----------
> From: *mark vogel* <mdvogelii@gmail.com
> <mailto:mdvogelii@gmail.com> <mailto:mdvogelii@gmail.com
> <mailto:mdvogelii@gmail.com>>>
> Date: Mon, Jun 11, 2012 at 1:43 PM
> Subject: plot dim_avg
> To: NCL USERS <ncl-talk@ucar.edu <mailto:ncl-talk@ucar.edu>
> <mailto:ncl-talk@ucar.edu <mailto:ncl-talk@ucar.edu>>>
>
>
> Dear all
> I try to average data only for daytime and plot it out.
> After I used dim_avg, then dimesion changed from 3 to 2
> dimension and
> when I used
> gsm_contour_map to plot it out.
>
> Please help
> Mark
>
>
>
> filesn1 = systemfunc("ls " + dirs + "2006*LDASOUT*.nc")
> f = addfiles(filesn, "r") ; change to filesn1 if 2006 )
> x = f[:]->HFX(:,:,:)
> ; (Time,
> south_north, west_east)
> x1 = x(5:10:19,:,:)
> x1@units = " (a) (Default)"
> ; print(x)
> dirk =
> "/usr/rmt_share/tgdata/hrldas/__workspace/jam2/india_gemout/"
> filesk = systemfunc("ls " + dirk + "200511*LDASOUT*.nc")
> filesk1 = systemfunc("ls " + dirs + "2006*LDASOUT*.nc")
>
> g = addfiles(filesk, "r")
> y = g[:]->HFX(:,:,:)
> y1 = y(5:10:19,:,:)
>
> y1@units = " (b) (GEM)"
> xavg = dim_avg_Wrap(x1)
> yavg = dim_avg_Wrap(y1)
> ; print(x1)
> print(yavg)
> x@lat2d = lat2d
> x@lon2d = lon2d
> y@lat2d = lat2d
> y@lon2d = lon2d
>
>
> res@mpFillOn = False ; turn off map fill
> res@mpOutlineDrawOrder = "PostDraw" ; draw continental
> outline last
> res@mpOutlineBoundarySets = "National" ; state boundaries
>
> res@tfDoNDCOverlay = False ; True for
> 'native' grid
> res@gsnAddCyclic = False ; data are not
> cyclic
> ; res@lbOrientation = "vertical"
>
> ;*****************************__*******************
> ; allocate array for 3 plots
> ;*****************************__*******************
> plts = new (2,"graphic")
>
> ;*****************************__*******************
> ; Tell NCL not to draw or advance frame for individual plots
> ;*****************************__*******************
> res@gsnDraw = False ; (a) do not draw
> res@gsnFrame = False ; (b) do not
> advance 'frame'
>
> plts(0) =
> gsn_csm_contour_map(wks,xavg(:__,:),res)
> plts(1) =
> gsn_csm_contour_map(wks,yavg(:__,:),res)
> ;*****************************__*******************
>
>
>
>
>
> _________________________________________________
> ncl-talk mailing list
> 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
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Mon Jun 11 15:53:59 2012

This archive was generated by hypermail 2.1.8 : Tue Jun 12 2012 - 13:58:38 MDT