#!/bin/bash ######################################## # Runs SREF Postprocessing up to 87 hours # change log # 6/16/2005, Jun Du: change forecast lead time from # 63hr to 87hr # 12/08/2005, Jun Du: WRF_nmm and WRF_em SREF members are added # 9/20/2009, Julia Zhu Scripts are modified to be sharable # between EMC and NCO # Please note that variable "RUN_ENVIR" is set and used # in the development enviroment only. # 04/02/2015, Jun Du Updated to SREF.v7.0.0 # ######################################## set -xa # #### 08/25/1999 ################### # SET SHELL PROCESSING VARIABLES # ################################### export PS4='$SECONDS + ' date export RUN_ENVIR=${RUN_ENVIR:-nco} ############################### # Specify NET and RUN name ############################## export NET=sref export RUN=sref ##################################################################################### # Run config file to get input parameters # This config file should define the following variables # DATA_IN: Location of working directory, default to ${DATAROOT} # DEV_SMS: If the job is to be running using ecFflow, default to YES # SENDDBN: Set to NO for developers, default to YES # COM_IN: Directory for input files, default to ${COMROOT}/$NET/${envir} # COM_OUT: Directory for output file, default to ${COMROOT}/$NET/${envir} # gespath: Directory for the guess or restart files, default to ${GESROOT}/${envir} ##################################################################################### # # obtain unique process id (pid) and make temp directories # export DATA_IN=${DATA_IN:-${DATAROOT}} export DATA=$DATA_IN/${jobid:?} mkdir $DATA cd $DATA #################################### # File To Log Msgs #################################### export jlogfile=${jlogfile:-$DATA/jlogfile.${job}.$$} #################################### # Determine Job Output Name on System #################################### export pgmout="OUTPUT.$$" export pgmerr=errfile export cycle=t${cyc}z ############################### # Specify NET and RUN name ############################## export NET=sref export RUN=sref export fend=00 export finc=03 export fstart=00 export GRIB= export EXT="" ################################################## # SAVEGES - Copy Files From TMPDIR to $GESdir # SENDECF - Flag Events on ecFflow # SENDCOM - Copy Files From TMPDIR to $COMOUT # SENDDBN - Issue DBNet Client Calls # RERUN - Rerun fcst from beginning (default no) ################################################## export SENDCOM=${SENDCOM:-YES} export SENDECF=${SENDECF:-YES} export SENDDBN=${SENDDBN:-NO} export HOMEsref=${HOMEsref:-${PACKAGEROOT}/${NET}.${sref_ver}} export GEMPAKsref=${GEMPAKsref:-$HOMEsref/gempak} # Run setpdy and initialize PDY variables setpdy.sh . PDY if [ $model = arw ]; then MODEL=ARW export DBN_ALERT_TYPE=`echo ${RUN}_${MODEL}_GEMPAK | tr [a-z] [A-Z]` elif [ $model = nmm -o $model = nmb ]; then MODEL=`echo $model | tr [a-z] [A-Z]` export DBN_ALERT_TYPE=`echo ${RUN}_${MODEL}_GEMPAK | tr [a-z] [A-Z]` else export DBN_ALERT_TYPE=`echo ${RUN}_GEMPAK | tr [a-z] [A-Z]` fi # # Copy special table wmogrib2.tbl, ncepgrib2.tbl # and vcrdgrib1.tbl into $DATA # cp $GEMPAKsref/fix/sref_wmogrib2.tbl wmogrib2.tbl cp $GEMPAKsref/fix/sref_ncepgrib2.tbl ncepgrib2.tbl cp $GEMPAKsref/fix/sref_vcrdgrib1.tbl vcrdgrib1.tbl cp $GEMPAKsref/fix/g2varsncep1.tbl g2varsncep1.tbl cp $GEMPAKsref/fix/g2varswmo2.tbl g2varswmo2.tbl cp $GEMPAKsref/fix/g2vcrdncep1.tbl g2vcrdncep1.tbl cp $GEMPAKsref/fix/g2vcrdwmo2.tbl g2vcrdwmo2.tbl ######################################################## # define COMIN and COMOUT ######################################################## export com=${com:-$(compath.py ${NET}/${sref_ver})} export COM_IN=${COM_IN:-$(compath.py ${NET}/${sref_ver})} #if [ "$model" = "em" -o "$model" = "nmm" -o "$model" = "nmb" ] if [ "$model" = "arw" -o "$model" = "nmb" ] then export COMIN=${COM_IN}/${RUN}.${PDY}/${cyc}/pgrb else export COMIN=${COM_IN}/${RUN}.${PDY}/${cyc}/ensprod fi export COM_AWIPS=${COM_AWIPS:-$(compath.py ${NET}/${sref_ver})/${RUN}.${PDY}} export COMOUT=${COMOUT:-$(compath.py -o ${NET}/${sref_ver})/${RUN}.${PDY}/${cyc}/gempak} if [ ! -f $COMOUT ] ; then mkdir -p -m 775 $COMOUT fi env ens_mem_cnt=`echo $ens_mem |wc -w`; if [ $ens_mem_cnt -eq 1 ]; then ######################################################## # Execute the script. for member in $ens_mem do export member $HOMEsref/scripts/exsref_nawips.sh $member >$DATA/sref_${member}.out.$$ 2>&1 done ######################################################## else ##################################################################### # Execute the exsref_nawips.sh $member echo "#!/bin/ksh" >$DATA/poescript for member in $ens_mem do echo "$HOMEsref/scripts/exsref_nawips.sh $member &> $DATA/sref_${member}.out.$$" >> $DATA/poescript done ###################################################################### cat poescript chmod 775 $DATA/poescript #export MP_PGMMODEL=mpmd export CMDFILE=$DATA/poescript # Execute the script. mpiexec --cpu-bind core --configfile $CMDFILE fi for file in `ls $DATA/sref_${member}.out.*` do echo "=================sref_${member}.out==========" cat $file done ################################ # Remove the Working Directory ################################ cd $DATA_IN if [ ${KEEPDATA:-NO} != YES ]; then rm -rf $DATA; fi date