How calculaled percent of variance by EOF of CDO?
Added by Trịnh Hoàng Dương Hoàng over 7 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: hoangduongktnn@gmail.com
________________________________
Replies (3)
RE: How calculaled percent of variance by EOF of CDO? - Added by Uwe Schulzweida over 7 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=offin 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" doneCheers,
Uwe
RE: How calculaled percent of variance by EOF of CDO? - Added by Trịnh Hoàng Dương Hoàng almost 7 years ago
Thank you very much, Cheers, Uwe
RE: How calculaled percent of variance by EOF of CDO? - Added by Christ Reflin over 3 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