#!/bin/ksh
#
#---------------------------------------
# ksh job run in Hexagon
#---------------------------------------
#
#PBS -A nn9039k
#PBS -W group_list=noresm
#PBS -N timeseries
#PBS -l select=1:ncpus=32
#PBS -l walltime=20:00:00
#PBS -j oe
#PBS -S /bin/ksh
#
set -xe
#
typeset -Z2 monat    
# what does this typeset?
# loading modules in NorStore for ksh
. /opt/modules/default/init/ksh
module load cdo

iyr=2009
eyr=1948	

i=$iyr
while [ ${i} -ge $eyr ] ; do
echo $i

#
# Select the variables one by one and creating one file per variable and year
cdo shifttime,-365day giss.lwdn.T62.${i}_daymean.nc giss.lwdn.T62.$(($i - 1))_daymean.nc
# Advancing to the next timestep (year)
i=`expr ${i} - 1`
done
rm   giss.lwdn.T62.1947_daymean.nc
