Project

General

Profile

How calculaled percent of variance by EOF of CDO?

Added by Trịnh Hoàng Dương Hoàng over 6 years ago

Dear everyone,
I used CDO to calculate eof:
cdo -s -ymonsub prec.djf.1979.2009.nc -ymonmean prec.djf.1979.2009.nc (31 years) anom.djf.nc
cdo -s eof,10 anom.djf.nc eigenvals.nc (have 31 eigenvalue) eofs.nc
cdo -s eofcoeff eofs.nc anom.djf.nc pc
I want to determine the percent variance for EOF1, EOF2,....,EOF10 (example: file attach "red circle").
I have to do to determine percent of explained variance for EOF1, EOF2,....
I Hope this helps! Thanks so much!
best regards,
Trinh Hoang Duong
Email:
________________________________

EOF.jpg (142 KB) EOF.jpg

Replies (3)

RE: How calculaled percent of variance by EOF of CDO? - Added by Uwe Schulzweida over 6 years ago

The percent variance is the quotient of the eigenvalue and the total variance of the input data.
The total variance of the input data can be calculated with 'cdo fldsum -timvar infile'.

You need to set the environment variable

CDO_WEIGHT_MODE=off
in order to get correct results. Here is an example script:
#!/bin/ksh
export CDO_WEIGHT_MODE=off
NEOF=10
cdo eof,$NEOF anom_file eval_file eof_file
#
cdo fldsum -timvar anom_file totvar1
#
for ((i=1; i<=$NEOF-1; ++i)) ; do
  cdo -seltimestep,${i} eval_file totvar2
  MODE=`cdo output -mulc,100 -div totvar2 totvar1 | sed  "s- --g"`
  echo "EOF MODE ${i}: $MODE" 
done
Cheers,
Uwe

RE: How calculaled percent of variance by EOF of CDO? - Added by Christ Reflin over 2 years ago

Dear Sir and Mam,

How do we determine the percentage of variance when CDO_WEIGHT_MODE=on ?

I run the thread below from [https://code.mpimet.mpg.de/boards/53/topics/5741]

cdo -div eigval.nc -timsum eigval.nc explvar.nc

comparing with aforementioned script by Uwe, they produced different result when CDO_WEIGHT_MODE was on.

Looking forward for your direction

Thank you
Reflin

    (1-3/3)