#!/bin/bash
echo ' '
echo %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
echo %% Try to translate contours into gridded  format %%% >> ./output/diva.log
echo %% Try to translate contours into gridded  format %%%
echo %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
cp ./output/ghertonetcdf/GridInfo.dat ./divawork/fort.13
cp ./input/iceedge.dat ./divawork/fort.10
cp ./output/fieldgher.anl ./divawork/fort.98
cd ./divawork
../../bin/cont2grid.a >> ../output/diva.log
if [ $? -ne 0 ];then
echo ' '
echo --------------------------------------------
echo A problem was encountered during execution !
echo       dvicemask:   cont2grid.a
echo Check execution track
echo --------------------------------------------
echo ' ' >> ../output/diva.log
echo -------------------------------------------- >> ../output/diva.log
echo A problem was encountered during execution ! >> ../output/diva.log
echo       dvicemask:   cont2grid.a  >> ../output/diva.log
echo Check execution track >> ../output/diva.log
echo -------------------------------------------- >> ../output/diva.log
fi
../../bin/ghermask.a >> ../output/diva.log
if [ $? -ne 0 ];then
echo ' '
echo --------------------------------------------
echo A problem was encountered during execution !
echo       dvicemask:  ghermask.a
echo Check execution track
echo --------------------------------------------
echo ' ' >> ../output/diva.log
echo -------------------------------------------- >> ../output/diva.log
echo A problem was encountered during execution ! >> ../output/diva.log
echo       dvicemask:   ghermask.a  >> ../output/diva.log
echo Check execution track >> ../output/diva.log
echo -------------------------------------------- >> ../output/diva.log
fi
cd ..
rm -f ./output/fieldgher.anl 
cp -v ./divawork/fort.97 ./output/fieldgher.anl