[ncl-talk] reshape function and averaging

Mary Haley haley at ucar.edu
Mon Aug 15 02:29:06 MDT 2016


Dear Ramchandra,

I assume that you meant ndays was equal to ntime/24 and not ntime/2.

You want the "24" part of the array to be the second one from the left, if
your time array is consecutive in time. That is, it is arranged by hour 0,
hour 1, ..., hour 23 for the first day, and then hour 0, hour 1, ... hour
23 for the second day, and so on.

So what you had was correct:

Re3d    = reshape(T, (/ndays,24, nlat, nlon/))

Regarding the average, if you want to average all the hour 0s as one
quantity, and the hour 1s as one quantity, up to hour 23, then:

Re3d_avg = dim_avg_n(Re3d,0)

which will give you a Re3d_avg that is dimensioned 24 x nlat x nlon.

 --Mary



On Thu, Aug 11, 2016 at 12:41 PM, Ramchandra Karki <rammetro at hotmail.com>
wrote:

>
> Dear NCL users,
> I am bit confused with reshape function in NCL.
>
>    - I have an hourly wrf output for 30days with 720 time stamp. and I
>    want to get hourly average of 30 days 2m Temperature data as each 0, 1, 2,
>    .....................23 hour average values. (or 24 values in total)
>    -  I have array as (ntime, nlat, nlon) number of time, latitude and
>    longitude points for variable T
>    - then i defined ndays = ntime/2
>    - and reshape as
>    - Re3d    = reshape(T, (/ndays,24, nlat, nlon/))  ; i am confused with
>    putting 24 at first array or second
>    - then averaged as
>    - Re3d_avg = dim_avg_n_Wrap(Re3d,0)
>    -
>    - would it correctly produce the hourly average for each hour or i am
>    doing it in wrong way. I would be grateful if somebody could kindly suggest
>    me the right way.
>
>
>
> *RegardsRamchandra Karki*
>
>
> _______________________________________________
> 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/20160815/21cb86b0/attachment.html 


More information about the ncl-talk mailing list