#!/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=2013
eyr=1949	

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   FAMIPCN_climSST.u_10.T62.${i}.nc     FAMIPCN_climSST.u_10.T62.$(($i - 1)).nc
cdo shifttime,-365day   FAMIPCN_climSST.v_10.T62.${i}.nc     FAMIPCN_climSST.v_10.T62.$(($i - 1)).nc
# Advancing to the next timestep (year)
i=`expr ${i} - 1`
done
