#!/bin/bash

[ $IRSPP_HOME ] || { echo "Please define environment variable IRSPP_HOME"; exit 1; }

[ -f $IRSPP_HOME/bin/irspp_env.sh ] || { echo "Error: cannot find $IRSPP_HOME/bin/irspp_env.sh"; exit 1; }

. $IRSPP_HOME/bin/irspp_env.sh

TOPDIR=$(cd ..; pwd)

#input and output files

mkdir -p $TOPDIR/output
infile_sss=$TOPDIR/input/W_XX-EUMETSAT-Darmstadt,SND+SAT,MTS1+IRS-1B-SSS--Q4--CHK-BODY--DIS-NC4E_C_EUMT_20200604143703_IDPFS_DEV_20160315125300_20160315125310_N__C_0052_0049.nc
namelistfile=irs_covariance.nl
outfile=$TOPDIR/output/irs_covariance.nc

#Run the executable

irs_covariance.exe -i $infile_sss -n $namelistfile -o $outfile
status=$?

[ $status = 0 ] && echo "$0 finished" || echo "irs_covariance.exe failed with status $status"
