Project

General

Profile

averaging every two time steps

Added by ep gupal over 2 years ago

I am having trouble averaging the data by every two time steps. For example, if the data is like the following...

0,1,2,3,4,5, ...

I would like to average the data every two time steps like

(0+1)/2, (1+2)/2. (2+3)/2, (3+4)/2, (4+5)/2, ...

which overlaps the time steps for each averaging time step

For this, I am using timeselmean operator like the following

cdo --timestat_date first timeselmean,2,0,0 in.nc out.nc

which just gives me a result of

(0+1)/2, (2+3)/2. (4+5)/2, (6+7)/2, (8+9)/2, ...

How do I fix this?

Thanks.


Replies (2)

RE: averaging every two time steps - Added by Karin Meier-Fleischer over 2 years ago

Hi Ep,

I think you are looking for the runmean operator https://code.mpimet.mpg.de/projects/cdo/embedded/cdo.pdf#subsection.2.8.14

E.g.

cdo -runmean,2 infile outfile

-Karin

RE: averaging every two time steps - Added by ep gupal over 2 years ago

It works! Thank you!

    (1-2/2)