#!/bin/sh ###################################### # SMS start command (only for NCO) ##################################### $SMSBIN/smsinit $LOADL_STEP_ID set -xa # #### 05/04/99 ##################### # SET WAVE SHELL PROCESSING VARIABLES # ################################### export PS4='$SECONDS + ' date set +x echo cyc is ${cyc:?} # ensure cyc defined. echo envir is ${envir:?} # ensure envir defined. echo model_ver is ${model_ver:?} # ensure model_ver defined. echo code_ver is ${code_ver:?} # ensure code_ver defined. set -x export CLEANUP=${CLEANUP:-NO} # option to remove DATA dir at end of script. default to no in case sharing with forecast job # # obtain unique process id (pid) and make temp directory # export pid=$$ # # Switch to indicate if the script is to run in parallel with the # exwave_${modID}_fcst.sh.sms script (INDRUN='no') or to be run independantly # after the forecast script has finished (INDRUN='yes') # export INDRUN=${INDRUN:-no} # defaults to 'no'. can set to 'yes' externally. # PATH for working directory # working dir might be shared with forecast job, so using "wave_multi_1" rather than $job and $pid if [ "$envir" = 'prod' ] || [ "$envir" = 'para' ] || [ "$envir" = 'test' ] || [ "$envir" = 'dev' ] then # NCO export DATA=/tmpnwprd/wave_multi_1_${cyc}_${envir} [[ $INDRUN = yes ]] && rm -rf $DATA else # DEV TMPhome=/stmp/wavepa export DATA=$TMPhome/wave_multi_1_${cyc}_${envir}.${model_ver} fi if [ $INDRUN = yes ]; then mkdir -p $DATA else sleep 30 # This script runs side by side with the forecast # script. The 30 sec sleep provides enough time for # the work directory to be created in forecast script fi export cycle=t${cyc}z #################################### # File To Log Msgs #################################### if [ "$envir" = 'prod' ] || [ "$envir" = 'para' ] || [ "$envir" = 'test' ] || [ "$envir" = 'dev' ] then # NCO if [ $envir = "prod" ] then export jlogfile=/com/logs/jlogfile else export jlogfile=/com/logs/${envir}/jlogfile fi else # DEV export jlogfile=/dev/null fi #################################### # Determine Job Output Name on System #################################### export outid="LL$job" export jobid="${outid}.o${pid}" export pgmout="OUTPUT.${pid}" export MP_PULSE=0 export SENDCOM=YES if [ $envir = "prod" ] then export SENDDBN=YES export SENDDBN_NTC=YES else if [ $envir = "para" ]; then export SENDDBN=YES export SENDDBN_NTC=NO else export SENDDBN=NO export SENDDBN_NTC=NO fi fi export SENDSMS=YES export modID=multi_1 export sigMODE=grib2 export NET=wave export RUN=wave #################################### # Path to HOME Directory #################################### if [ "$envir" = 'prod' ] || [ "$envir" = 'para' ] || [ "$envir" = 'test' ] || [ "$envir" = 'dev' ] then # NCO export HOMEwave=/nw${envir}/${RUN}_${modID}.${model_ver} export CODEwave=/nw${envir}/${RUN}_code.${code_ver} else # DEV export HOMEwave=/marine/save/wavepa/ops/${RUN}_$modID.${model_ver} export CODEwave=/marine/save/wavepa/ops/${RUN}_code.${code_ver} fi export EXECwave=$HOMEwave/exec export FIXwave=$HOMEwave/fix export PARMwave=$HOMEwave/parm export USHwave=$HOMEwave/ush export EXECcode=$CODEwave/exec ################################### # Set up the UTILITIES ################################### export utilscript=/nwprod/util/ush export utilexec=/nwprod/util/exec # Run setup to initialize working directory and utility scripts if [ "$INDRUN" = 'yes' ] then cd $DATA sh $utilscript/setup.sh fi # Set PDY sh $utilscript/setpdy.sh . PDY ################################## # Check for correct date ################################## # This portion is called only when the grib2 generation is # run side by side with the forecast script. It looks for # the correct date in a file created by the forecast script # before moving into the temporary directory to start # creating the grib2 files. The file is removed once the ex # script starts so as to allow a rerun (if need be) if [ "$INDRUN" = 'no' ] then run_status=no while [ "$run_status" = 'no' ] do if [ -f ${DATA}/run.date ] then PDY_curr=`cat ${DATA}/run.date` if [ "$PDY" = "$PDY_curr" ] then run_status='yes' rm -f ${DATA}/run.date fi fi sleep 10 done cd $DATA fi ################################### # Set COM Paths ################################### if [ "$envir" = 'prod' ] || [ "$envir" = 'para' ] || [ "$envir" = 'test' ] || [ "$envir" = 'dev' ] then # NCO export comdirIn=/com/${NET}/${envir} export comdirOut=/com/${NET}/${envir} export COMIN=/com/${NET}/${envir}/${RUN}.${PDY} export COMOUT=/com/${NET}/${envir}/${RUN}.${PDY} if [ $envir = "prod" ] then export PCOM=/pcom/wave else export PCOM=/pcom/${envir}/wave fi else # DEV export comdirIn=/marine/noscrub/wavepa/COM_DEV export comdirOut=/marine/noscrub/wavepa/COM_DEV export COMIN=${comdirIn}/${RUN}.${PDY} export COMOUT=${comdirOut}/${RUN}.${PDY} export PCOM=/marine/noscrub/wavepa/PCOM_DEV fi mkdir -p $COMOUT $PCOM export wavelog=${comdirOut}/wave.log env ################################### # Execute the Script ################################### $HOMEwave/scripts/exwave_multi_1_grib2.sh.sms export err=$? $DATA/err_chk ################################### # Remove temp directories ################################### if [ ${INDRUN} = yes -a ${CLEANUP} = YES ]; then cd `dirname $DATA` rm -rf $DATA fi date ###################################### # SMS end command (only for NCO) ##################################### $SMSBIN/smscomplete