#!/bin/bash

## Just run code in recipes, use it carefully
## example: use cdo to make cache file. Since cdo is quicker than ncl.
#;DIAG_NORCPM; RUNTHESECODES: echo '    no codes run here.'

infiles=""
for infile in $infiles ; do
    outputfile="$(echo $infile | sed -e's/.nc/_DJF.nc/')"
    season='DJF'
    test -f $infile || (echo 'ERROR, infile not present: '$infile ; exit 1)
    test -z $outputfile && (echo 'ERROR, outputfile not specific '$outputfile ; exit 1) || true
    test -z $season && (echo 'ERROR, season not specific: '$season ; exit 1) || true

    shifttime=''
    if [ "$season" == "DJF" ] ;then
        shifttime='-shifttime,-2mo'
    fi
    cdo  -yearmean $shifttime -selseason,$season  $infile $outputfile
done


