Project

General

Profile

feature request: monthly correlation

Added by Rob Nicholas over 13 years ago

I know it's possible to do time correlation by month with a bit of shell-script wizardry and the 'selmon', 'timcor', and 'mergetime' operators. However, it would be fantastic if we could have a dedicated 'ymoncor' operator to perform this task in one step. At the same time, a 'yseascor' operator would be great too.

Thanks!
Rob


Replies (2)

RE: feature request: monthly correlation - Added by Ralf Mueller over 13 years ago

Just an idea: What about a shell alias or function?

RE: feature request: monthly correlation - Added by Rob Nicholas over 13 years ago

Sure... maybe something like this:

function cdo_ymoncorr () {
    local INFILE0, INFILE1, OUTFILE, TMPDIR, MON_LIST, MON
    INFILE0="${1}" 
    INFILE1="${2}" 
    OUTFILE="${3}" 
    TMPDIR=`mktemp -d /tmp/cdo_ymoncorr.XXXXXXXXXXXX`
    MON_LIST="01 02 03 04 05 06 07 08 09 10 11 12" 
    for MON in $MON_LIST ; do
        cdo timcor -selmon,$MON "$INFILE0" -selmon,$MON "$INFILE1" $TMPDIR/corr_$MON.nc
    done
    cdo mergetime $TMPDIR/corr_??.nc "$OUTFILE" 
    rm -rf $TMPDIR
}

But you could make the same argument for a lot of existing CDO operators, too. The point of having a built-in function is that it's "just there" and it would almost certainly be more efficient.

    (1-2/2)