On Fri, 28 Oct 2005, Prince K. Xavier wrote:
> Hello all,
>
> I'm a novice to NCL. So I have some elementary questions.
Hi Prince,
I will try to answer your specific questions below. A good starting
place for new users is:
http://www.ncl.ucar.edu/get_started.shtml
>From here, you will see a link to some data processing information:
http://www.ncl.ucar.edu/Applications/list_dataP.shtml
> I am wodering if
> there is a function in NCL that does averaging in a specified dimension.
> For example, I have a variable, say T(0:364,1:17,1:73,1:144).
> Is there a function that can calculate the time average of this
> variable from 1june to 30sep?
To perform averaging in a specific dimension, you want to use the
"dim_avg" function. The dimension you want to average across must be
the rightmost dimension, so you may have to reorder the array first
before you average it. Here's the documentation for "dim_avg":
http://www.ncl.ucar.edu/Document/Functions/Built-in/dim_avg.shtml
I'm not sure how your array is ordered, but it looks like it might be
time x level x latitude x longitude. If so, and assuming your
dimensions have the names "time", "lev", "lat", and "lon", and that
your days are ordered from Jan 1 to Dec 31, you can use something like
this:
;
; First calculate indices that correspond to June 1 and Sept 30 using
; "day_of_year" function. We have to subtract 1 because NCL array
; indexing starts at 0 and not 1.
;
beg_year = 2004 ; Arbitrary year; put whatever year you are using.
end_year = 2004
beg_month = 6 ; June
end_month = 9 ; September
beg_day = 1
end_day = 30
ibeg = day_of_year(begin_year,begin_month,begin_day) - 1
iend = day_of_year(end_year,end_month,end_day) - 1
zNew = z(lev | :, lat | :, lon | :, time | ibeg:iend)
zAvg = dim_avg(zNew) ; ==> zAvg(nlev,nlat,nlon)
If retaining metadata is desired use "dim_avg_Wrap" instead of
"dim_avg":
zAvg = dim_avg_Wrap(zNew) ; ==> zAvg(nlev,nlat,nlon)
> Next requirement is an area weighted average for the global tropics (0 to
> 360, -30 to 30). How can I do this?
You want to use the "wgt_areaave" function. Please see example 2 at:
http://www.ncl.ucar.edu/Applications/ave.shtml
--Mary
> Thanks in advance
>
> Prince
> _______________________________________________
> ncl-talk mailing list
> ncl-talk@ucar.edu
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
_______________________________________________
ncl-talk mailing list
ncl-talk@ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
This archive was generated by hypermail 2b29 : Fri Oct 28 2005 - 03:29:29 MDT