#!/bin/csh -x
#----------------------------------------------------------------------
#
#       comprs.com
#
#       Script to compress an output FITS file using UNIX compress.
#
#--------------------------------------------------------------------
#                          REVISION HISTORY
#--------------------------------------------------------------------
#  MOD             PR
# LEVEL   DATE   NUMBER  User    Description
# ----- -------- ------  ------  -------------------------------------
#  001  08/05/97 33432   MSwam   created
#  002  08/29/97 35137   Rose    removed .cshrc loggin
#  003  02/20/98 35847   WMiller Set redirections for noclobber
#  004  12/17/02 46765   Sontag  Use gzip not compress on Linux.
#
#----------------------------------------------------------------------
#
echo " "
echo "`date`"
echo "---------------- Starting COMPRS ----------------------------" >>! $TRLDIR/$OSF_DATASET.trx
echo "`date`" >>! $TRLDIR/$OSF_DATASET.trx

# compress the output FITS file in place
if (`uname` == 'Linux') then
gzip $INPATH/$OSF_DATASET.fits >>&! $TRLDIR/$OSF_DATASET.trx
else
compress $INPATH/$OSF_DATASET.fits >>&! $TRLDIR/$OSF_DATASET.trx
endif
set savestat = $status
if ( $savestat == 1 ) then
    echo "ERROR: unable to compress $INPATH/$OSF_DATASET.fits" >>! $TRLDIR/$OSF_DATASET.trx
else
    echo "SUCCESS applying file compression to $INPATH/$OSF_DATASET.fits" >>! $TRLDIR/$OSF_DATASET.trx
endif
echo "---------------- Ending COMPRS ------------------------------" >>! $TRLDIR/$OSF_DATASET.trx
echo " "
exit $savestat
