#!/bin/ksh ############################################ ############################################################### # Set up environment for ensemble clustering, ranking and related # product etc. jobs # # initial program, Jun Du, 2011 # change log: # 11/14/2011, Jun Du: initial implementation # 03/18/2019, Jun Du: Converted to Dell machine # ############################################################### set -xa export OMP_NUM_THREADS=1 export MP_EUIDEVICE=sn_all export MP_EUILIB=us export MP_MPILIB=mpich2 export MP_TASK_AFFINITY=core:1 # # Specify whether the run is production or development # export RUN_ENVIR=${RUN_ENVIR:-nco} ##################################################################################### # 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 ecFlow, 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} ##################################################################################### if [ "$RUN_ENVIR" != nco ] ### For Developers, "group_name" is passed from the ecFlow script then CONFIG_FILE=${CONFIG_FILE:-/lfs/h2/emc/lam/noscrub/${LOGNAME}/sref.v7_dell/parm/sref_para_config_cray} . $CONFIG_FILE export userid=$LOGNAME export DATA_IN=${DATA_IN:-/lfs/h2/emc/ptmp/$userid} fi echo `date` $0 `date -u` begin export PS4='$SECONDS + ' ########################################################### # obtain unique process id (pid) and make temp directories ########################################################### export DATA_IN=${DATA_IN:-${DATAROOT}} if [ ${RUN_ENVIR} != nco ] ; then export DATA=$DATA_IN/sref_cluster_${cyc} else export DATA=$DATA_IN/${jobid:?} fi rm -rf $DATA mkdir -p $DATA cd $DATA #################################### # File To Log Msgs #################################### export jlogfile=${jlogfile:-$DATA/jlogfile.${job}.$$} #################################### # Determine Job Output Name on System #################################### export pgmout="OUTPUT.${pid}" export cycle=t${cyc}z ############################### # Specify NET and RUN name ############################## export NET=sref export RUN=sref ################################################## # SAVEGES - Copy Files From TMPDIR to $GESdir # SENDECF - Flag Events on ecFlow # 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:-YES} export SENDDBN_GB2=${SENDDBN_GB2:-YES} export DBN_ALERT_TYPE=${DBN_ALERT_TYPE:-SREF_CLUSTER} export HOMEsref=${HOMEsref:-${PACKAGEROOT}/${NET}.${sref_ver}} export EXECsref=${EXECsref:-$HOMEsref/exec} export FIXsref=${FIXsref:-$HOMEsref/fix} export PARMsref=${PARMsref:-$HOMEsref/parm} export USHsref=${USHsref:-$HOMEsref/ush} # Since the grib_util cnvgrib tool at wcoss2 version doesn't work, # it needs this temporary one here: export CNVGRIB=$HOMEsref/util/cnvgrib # Run setpdy and initialize PDY variables setpdy.sh . ./PDY ############################################# # COMIN and COMOUT ############################################# export COM_IN=${COM_IN:-$(compath.py ${NET}/${sref_ver})} export COM_OUT=${COM_OUT:-$(compath.py ${NET}/${sref_ver})} export COMIN=${COMIN:-$COM_IN/${RUN}.${PDY}/${cyc}/pgrb} export COMOUT=${COMOUT:-$COM_OUT/${RUN}.${PDY}/${cyc}/ensprod} export COMOUT_BC=${COMOUT_BC:-$COM_OUT/${RUN}.${PDY}/${cyc}/ensprod_biasc} mkdir -p -m 775 $COMOUT $COMOUT_BC env ####################################################### # Pass information which is needed to run the Script ####################################################### export ENDHOUR=87 export INCHOUR=3 ################################################### # Execute the ensemble member ranking Script ################################################### mkdir -p $DATA/ranking cd $DATA/ranking $HOMEsref/scripts/exsref_memberranking.sh raw > $DATA/ranking.out ################################################### # Execute the ensemble clustering Script ################################################### mkdir -p $DATA/cluster_NCEP cd $DATA/cluster_NCEP $HOMEsref/scripts/exsref_enscluster.sh 1 1 NCEP > $DATA/cluster_NCEP.out mkdir -p $DATA/cluster_OU cd $DATA/cluster_OU $HOMEsref/scripts/exsref_enscluster.sh 1 1 OU > $DATA/cluster_OU.out ################################################### # Execute the ensemble product generator for each cluster ################################################### mkdir -p $DATA/cluster_NCEP_product cd $DATA/cluster_NCEP_product $HOMEsref/scripts/exsref_enspost4cluster.sh 3hrly NCEP 111 > $DATA/product_NCEP.out mkdir -p $DATA/cluster_OU_product cd $DATA/cluster_OU_product $HOMEsref/scripts/exsref_enspost4cluster.sh 3hrly OU 111 > $DATA/product_OU.out ######################################################## cat $pgmout msg="JOB COMPLETED NORMALLY" postmsg $jlogfile "$msg" ################################ # Remove the Working Directory ################################ cd $DATA_IN if [ ${KEEPDATA:-NO} != YES ] ; then rm -rf $DATA ; fi date