#!/bin/sh
set -e
# sum of two input files -- DY, 2019-01-08

if [ $# -ne 4 ] ; then
  echo "Error in $0: invalid number of arguments $#"
  exit 1
fi

pfx=$1
inp1=$2
inp2=$3
out=$4

# Get CDO / TEMPORARY!
export PATH=/fs/ssm/hpco/exp/mib002/anaconda/anaconda-4.4.0/anaconda_4.4.0_ubuntu-14.04-amd64-64/envs/cdo-1.9.0/bin:$PATH

release inp1 inp2

access inp1 ${pfx}_${inp1}.nc
access inp2 ${pfx}_${inp2}.nc

cdo add inp1 inp2 ${pfx}_${out}

release inp1 inp2
