# [ncl-talk] reshape function and averaging

Ramchandra Karki rammetro at hotmail.com
Mon Aug 15 04:57:10 MDT 2016

```Dear Mary,Thank you very much. Now i am assured with my output maps. It was typo error in  2 and 24 from me.

Regards
Ramchandra KarkiFrom: haley at ucar.edu
Date: Mon, 15 Aug 2016 10:29:06 +0200
Subject: Re: [ncl-talk] reshape function and averaging
To: rammetro at hotmail.com
CC: ncl-talk at ucar.edu

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 Tthen i defined ndays = ntime/2and reshape as Re3d    = reshape(T, (/ndays,24, nlat, nlon/))  ; i am confused with putting 24 at first array or second then averaged asRe3d_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.
Regards
Ramchandra 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/a8740820/attachment.html
```