calculating exponentially weighted moving average ewma
Added by Polina Franke about 3 years ago
Hi there!
I need to calculate the exponentially weighted running mean based on the following equation:
I looked through the CDO manual and experimented with runmean and ydrunmean, but these operators don't really get me the results I need.
Is there any other way I could do this with CDO?? I think some combination of expr and operators might work, but I just can't wrap my head around it.
I am using CORDEX data in 3-hourly resolution and attached a sample of my data.
Thanks in advance for any help!
eq1_ewma.png (28.7 KB) eq1_ewma.png | |||
tas_EUR_19700101 (3.37 MB) tas_EUR_19700101 |
Replies (2)
RE: calculating exponentially weighted moving average ewma - Added by Polina Franke about 3 years ago
Addendum: I forgot to add, that for where there is no value of a running mean (Trm-1) the following equation is to be used:
So I guess for the first few days this equation is used as a proxy for the Trm and these days are then discarded as kind of a spin up.
eq2_tm.png (3.42 KB) eq2_tm.png |
RE: calculating exponentially weighted moving average ewma - Added by Ralf Mueller about 3 years ago
hi Polina!
in you initial definition of T_{rm} you use its value of the timestep before, which makes your formula recursive. IMO this is not possible in CDO at an operator level.
cheers
ralf