Project

General

Profile

Calculating hourly mean using CDO for multiple years

Added by Shafiqah M about 6 years ago

I need some help in calculating the hourly mean for the netcdf data from a model output using CDO command. Each of the files contains hourly time steps for 23 years. I had already use yhourmean for calculating hourly data in 23 years and it show 8784 time steps but i want the output file just show 24 time steps which are stand for 24 hour. Attached are the example i want my data o be display :) Thanks in advance


Replies (1)

RE: Calculating hourly mean using CDO for multiple years - Added by Ralf Mueller about 6 years ago

Hi!

There is not such operator in CDO since and hourly climatology is pretty unusual IMO. But I can offer you a workaround:

Lets say <ifile> holds your hourly data of several years, then you can select each our, do a timmean on it and cat all files together afterwards:

for hour in $(seq 1 24); 
  do cdo -timmean -select,hour=${hour} ifile ${hour}_ifile;
done;
cdo cat *_ifile hourlyClimatology_ifile.nc

depending on the speed of your IO, you might run the for loop in a parallel mode.

hth
ralf

    (1-1/1)