Project

General

Profile

Computing Variance and Average in one go

Added by Antonio Rodriges about 7 years ago

Hi,

The docs state that I can compute variance as

cdo timvar in.nc out.nc

The questions are:
- can I compute both variance and average with a single command in one pass (do not iterate several times for computing variance and than for average) and store them as two separate variables in the same file?

- probably I can solve the above question with using "expr"? If yes, is cdo optimized to perform computations in one go (I mean compute both "avg" and "var" during the same iteration, not "avg" first and iterate over the file again to get "var" after that)?

- how is variance computation implemented? Is it a single pass like in online algorithm
https://en.wikipedia.org/wiki/Algorithms_for_calculating_variance#Online_algorithm
or two passes (one to compute average, other to compute variance)?

Thanks