#!/bin/ksh set -xa #################################### # 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 #################################### # RERUN - Rerun posts from beginning (default no) # VERBOSE - Specify Verbose Output in global_postgp.sh #################################### export RERUN=${RERUN:-NO} export VERBOSE=${VERBOSE:-YES} 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 ############################################## 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 COMROT=$(compath.py -o ${NET}/${cfs_ver}) export COMIN=$(compath.py -o ${NET}/${cfs_ver}/${RUN}.${PDY}) export COMOUT=$(compath.py -o ${NET}/${cfs_ver})/monthly/cdas.$cmonth mkdir -m775 -p $COMOUT export TIMEDIR=${TIMEDIR:-$COMOUT/time} export MONTHDIR=${MONTHDIR:-$COMOUT/monthly} mkdir -m 775 -p $COMOUT $TIMEDIR ################################################## # 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:-NO} # Archive the monthly means export maketime=${maketime:-YES} # Create the timeseries export dogrib2time=${dogrib2time:-YES} # Convert timeseries to grib2 export dohpsstime=${dohpsstime:-NO} # Archive the timeseries env ############################### # Execute the Script ############################### if [ -s $TIMEDIR/${cmonth}_time.stamp ] then status=`cat $TIMEDIR/${cmonth}_time.stamp |awk -F" " '{print $1}'` if [ $status = "done" ]; then echo "Monthly Time Series calculation for $cmonth 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 generate the monthly time series files" 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" >$TIMEDIR/${cmonth}_time.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