#!/bin/csh -fx
# Script to run mtxcalc to determine conversion from BELD5 1km landuse to a coarser resolution with different projections
#
#
limit stacksize unlimited
limit memoryuse unlimited
#
setenv SMK_BIN /my_software/SMOKE-4.8.1/subsys/smoke/Linux2_x86_64gfortran_gcc_nomp
#
setenv ASSESSMENT_BASE /run/media/root/DISK1_4TB/ADMF/2022_assessment
#
setenv GRIDDESC $ASSESSMENT_BASE/GRIDDESC_CONVERT_ADMF
setenv MATRIX $ASSESSMENT_BASE/LAM12_to_ADMF36.ncf
setenv MATTXT $ASSESSMENT_BASE/LAM12_to_ADMF36.txt
#
unsetenv LOGFILE
set UI=$ASSESSMENT_BASE/MTXCALC.$$ 
echo "Yes, continue with program" > ${UI}
echo "LAM_DOMAIN"          >> ${UI}
echo "ADMF_DOMAIN"         >> ${UI}
echo "MATTXT"              >> ${UI}
echo '------------------------------------------------------------------'
env
echo '------------------------------------------------------------------'
echo "UI command-line input"
cat ${UI}
echo '------------------------------------------------------------------'
#
${SMK_BIN}/mtxcalc < ${UI}
set errornum=${status}
echo '------------------------------------------------------------------'
rm ${UI}
if ( ${errornum} != 0 ) echo "ERROR ${errornum} on program "
exit ( ${errornum} ) 
exit
