Project

General

Profile

Calculating daily avaerage from 6 hourly data

Added by Dhirendra Kumar over 8 years ago

Dear mates

I am trying to calculate the daily average from 6 hourly climate data (Output of RegCM).
The data is contained in files for individual months, in each file the first time step (i.e. 00:00) is missing and one extra time step from the (00:00) of 1st date of next month is present.
so in that way the file contains 124 (31*4) time steps.
Now in order to calculate the daily average I am using the daily mean function-

cdo daymean 1988.nc daymean_1988.nc

but in the output file I get 32 time steps instead of 31, which is theoretically incorrect I think.

Please guide me how to calculate the daily average from 6 hourly data.
I am attaching the snapshot for the reference.

Any help would be appreciated.

Regards
Dhirendra Kumar


Replies (2)

RE: Calculating daily avaerage from 6 hourly data - Added by Uwe Schulzweida over 8 years ago

Use the operator shifttime to shift the time axis back and forth by 1 second:

cdo shifttime,1sec -daymean -shifttime,-1sec 1988.nc daymean_1988.nc

RE: Calculating daily avaerage from 6 hourly data - Added by François Roberge about 6 years ago

HI Uwe and Dhirendra,

I realize that this can be problematic on older versions of cdo. Since I am using cdo on a distant server, I am forced to use an old cdo version (until it is updated).

I am using cdo 1.6.5.2 and I realized that the daymean operator in cdo versions before 1.7 automatically takes the daily last time step of the infile as the daily timestep of the outfile. Newer versions seems to set the resulting time at around half a day (12:30).

In case this thread is read by someone else using an older version of cdo :

By using exactly the command provided by Uwe on monthly files, this would cause the last timestep of the outfile to be date of the following month first day.

A solution will be to not shift forward 1 sec after using daymean. To have a similar time than in resulting files with newer versions of cdo (I get a resulting time of 12:30 in 1 and 3 hourly input files)

To have a similar results than newer cdo versions I did :

cdo shifttime,-12hour -shifttime,1sec -daymean -shifttime,-1sec ./input ./output
    (1-2/2)