#!/bin/ksh set -xa date ###. /usrx/local/Modules/default/init/ksh ###module load mpiserial #################################### # Specify NET and RUN Name and model #################################### export NET=cfs export RUN=cdas export RUN1=cdas1 export host=${host:-`hostname | cut -c1`} ############################################### # SETUP CDAS POST PROCESSING VARIABLES ############################################### export PS4='$SECONDS + ' date ########################################################## export DATA=${DATA:-${DATAROOT:?}/${jobid:?}} mkdir -p $DATA cd $DATA #################################### # Determine Job Output Name on System #################################### export pgmout="OUTPUT.$$" export pgmerr=errfile export cycle=t${cyc}z ############################## # Set up the UTILITIES ############################## export REDOUT='1>>' export REDERR='2>' ############################## # Run setpdy and initialize PDY variables ############################## sh setpdy.sh . ./PDY ########################################################## # define cfs directories/scripts/executables ########################################################## export EXECcfs=$HOMEcfs/exec export PARMcfs=$HOMEcfs/parm export USHcfs=$HOMEcfs/ush export FIXcfs=$HOMEcfs/fix ############################################## # Define COM directories ############################################## export COMROT=$(compath.py -o ${NET}/${cfs_ver}) export COMIN=$(compath.py -o ${NET}/${cfs_ver}/${RUN}.${PDY}) MM_P1=`echo $PDY |cut -c5-6` YYYY_P1=`echo $PDY |cut -c1-4` MM=`expr $MM_P1 - 1` if [ $MM -eq 0 ] then MM=12 YYYY=`expr $YYYY_P1 - 1` else YYYY=$YYYY_P1 fi if [ $MM -lt 10 ]; then MM=0$MM; fi export cmonth=${cmonth:-$YYYY$MM} export COMOUT=$COMROT/monthly/cdas.$cmonth export MONTHDIR=${MONTHDIR:-$COMOUT/monthly} export TIMEDIR=${TIMEDIR:-$COMOUT/time} mkdir -p $COMOUT export CNVGRIBFIX=${CNVGRIBFIX:-$USHcfs/cfs_cnvgrib_bigfix.sh} # special grib converter ################################################## # Define the functions of this job ################################################## export makelinks=${makelinks:-YES} # Create links to analysis files for tser and means scripts export makemean=${makemean:-NO} # Create the monthly means export makemeanpke=${makemeanpke:-NO} # Create the monthly pke energetics means export dogrib2means=${dogrib2means:-NO} # Convert means to grib2 export dohpssmeans=${dohpssmeans:-YES} # Archive the monthly means export maketime=${maketime:-NO} # Create the timeseries export dogrib2time=${dogrib2time:-NO} # Convert timeseries to grib2 export dohpsstime=${dohpsstime:-YES} # Archive the timeseries env ############################### # Execute the Script ############################### if [ -s $COMOUT/${cmonth}_archive.stamp ] then status=`cat $COMOUT/${cmonth}_archive.stamp |awk -F" " '{print $1}'` if [ $status = "done" ]; then echo "Monthly mean and time series archive is done already" echo "No more processing is needed, exiting..." RUN_MONTHLY=NO else echo "The stamp file for $cmonth is present but the previous calcuation was not successful" echo "Need to continure to run this job to archive files to hpss" RUN_MONTHLY=YES fi else echo "The stamp file for $cmonth is not there" echo "This might be the first day of the month" RUN_MONTHLY=YES fi if [ $RUN_MONTHLY = YES ] then ${MONTHLYMEANSH:-$HOMEcfs/scripts/excfs_cdas_monthly.sh} $cmonth export err=$?; err_chk if [ $err -eq 0 ]; then echo "done $cmonth" >$COMOUT/${cmonth}_archive.stamp fi cat $pgmout fi msg="ENDED NORMALLY." postmsg "$msg" ######################################## # Remove the Temporary working directory ######################################## cd $DATAROOT if [ ${KEEPDATA:-NO} = NO ] ; then rm -rf $DATA ; fi date