#!/bin/sh ######################################## # WRF-SREF Preliminary data setup step # change log: # 09/xx/2005, Jun Du - initial implementation # 04/04/2006, Jun Du - change the directory name $COMENS from # /com/mrf/prod/ to /com/gens/prod to match the new # global ensemble data outout # 07/18/2008, Jun Du - upgrade to WRFv2.2 # # !!!!!This Job needs to be lunched 21 times with specific MODEL and # MEMBER names, i.e., MODEL(MEMBER....) = NMB(ctl,p01,n01,p02,n02,p03,n03) # NMM(ctl,p01,n01,p02,n02,p03,n03) and ARW(ctl,p01,n01,p02,n02,p03,n03) # simutaneously!!!!! # 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. # 4/15/2010, Jun Du Generalized the script to run NEMS-NMMB # ensemble (MODEL=NMB) ######################################## set -xa export MP_IOAGENT_CNT=all export MP_IO_BUFFER_SIZE=8M # # Specify whether the run is production or development # export RUN_ENVIR=${RUN_ENVIR:-prod} ##################################################################################### # Run config file to get input parameters # This config file should define the following variables # DATA_IN: Location of working directory, default to /tmpnwprd # DEV_SMS: If the job is to be running using SMS, default to YES # SENDDBN: Set to NO for developers, default to YES # COM_IN: Directory for input files, default to /com/$NET/${envir} # COM_OUT: Directory for output file, default to /com/$NET/${envir} # gespath: Directory for the guess or restart files, default to /nwges/${envir} ##################################################################################### if [ "$RUN_ENVIR" != prod ] ### For Developers, "group_name" is passed from the SMS script then CONFIG_FILE=${CONFIG_FILE:-/meso/save/${LOGNAME}/sref/nwprod/parm/sref_para_config} . $CONFIG_FILE export userid=$LOGNAME export DATA_IN=${DATA_IN:-/ptmp/$userid} fi ############################################################### # This block can be modified for different test environment ############################################################### if [ $RUN_ENVIR = prod -a $envir != prod ]; then export DBNROOT=/nwprod/spa_util/fakedbn export jlogfile=${jlogfile:-/com/logs/${envir}/jlogfile} fi if [[ $RUN_ENVIR = prod || ${SENDSMS:-YES} = YES ]] ; then $SMSBIN/smsinit $LOADL_STEP_ID fi echo `date` $0 `date -u` begin export PS4='$SECONDS + ' export CYC=${CYC:-${cyc}} export MEMBER=${MEMBER:-ctl} export MODEL=${MODEL:-ARW} export RES=${RES:-16km} ########################################################### # obtain unique process id (pid) and make temp directories # Note: ctl member needs to be run only once and can be used # for both NMM and ARW cores! ########################################################### export pid=$$ export DATA_IN=${DATA_IN:-/tmpnwprd} export DATA=$DATA_IN/sref_${MODEL}_wps_${CYC}_${envir} WORK_DIR=$DATA/wps.$MEMBER # Remove old directory if it exists rm -rf $WORK_DIR mkdir -p $WORK_DIR while [ ! -d $WORK_DIR ] do mkdir -p $WORK_DIR done cd $WORK_DIR #################################### # File To Log Msgs #################################### export jlogfile=${jlogfile:-/com/logs/jlogfile} #################################### # Determine Job Output Name on System #################################### export outid="LL$job" export jobid="${outid}.o${pid}" 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 # SENDSMS - Flag Events on SMS # SENDCOM - Copy Files From TMPDIR to $COMOUT # SENDDBN - Issue DBNet Client Calls # RERUN - Rerun fcst from beginning (default no) ################################################## export SENDCOM=${SENDCOM:-YES} export SENDSMS=${SENDSMS:-YES} export SENDDBN=${SENDDBN:-NO} export HOMEsref=${HOMEsref:-/nw${envir}/${NET}.${model_ver}} export EXECsref=${EXECsref:-$HOMEsref/exec} export FIXsref=${FIXsref:-$HOMEsref/fix} export PARMsref=${PARMsref:-$HOMEsref/parm} export USHsref=${USHsref:-$HOMEsref/ush} ################################### # Set up the UTILITIES ################################### export utilscript=/nwprod/util/ush export utilexec=/nwprod/util/exec # Run setup to initialize working directory and utility scripts sh $utilscript/setup.sh # Run setpdy and initialize PDY variables sh $utilscript/setpdy.sh . PDY ############################################# # COMIN and COMOUT ############################################# export COM_IN=${COM_IN:-/com/${NET}/${envir}} export COM_OUT=${COM_OUT:-/com/${NET}/${envir}} export gespath=${gespath:-/nwges/${envir}} export COMIN=$COM_IN/${RUN}.${PDY} export COMOUT=$COM_OUT/${RUN}.${PDY}/${cyc} export GESDIR=$gespath/${NET}.${PDY} export COMGFS=${COMGFS:-/com/gfs/prod} export COMENS=${COMENS:-/com/gens/prod} export COMNAM=${COMNAM:-/com/nam/prod} export COMRAP=${COMRAP:-/com/rap/prod} mkdir -p -m 775 $COMOUT $GESDIR env export FLENGTH=${FLENGTH:-87} if [ $MEMBER = ctl ];then export GLBMEM=00;fi if [ $MEMBER = p01 ];then export GLBMEM=p01;fi if [ $MEMBER = n01 ];then export GLBMEM=p02;fi if [ $MEMBER = p02 ];then export GLBMEM=p03;fi if [ $MEMBER = n02 ];then export GLBMEM=p04;fi if [ $MEMBER = p03 ];then export GLBMEM=p05;fi if [ $MEMBER = n03 ];then export GLBMEM=p06;fi ######################################################## # Execute the script. if [ $MEMBER = ctl ];then $HOMEsref/scripts/exsref_wrfprep.sh.sms $MEMBER $GLBMEM export WORK_DIR=$DATA/wps.c00 rm -rf $WORK_DIR mkdir -p $WORK_DIR cd $WORK_DIR $HOMEsref/scripts/exsref_wrfprep.sh.sms c00 c00 else $HOMEsref/scripts/exsref_wrfprep.sh.sms $MEMBER $GLBMEM fi ######################################################## file_number=`ls met_* |wc -l` if [ $file_number -ne 30 ]; then echo "SOMETHING WRONG WHEN DOING PREP, PROGRAM STOPPED!" echo "CHECK IF ALL GFS AND GEFS FILES ARE AVAILABLE!" export err=911 err_chk fi cat ${WORK_DIR}/$pgmout msg="JOB COMPLETED NORMALLY" postmsg "$jlogfile" "$msg" ################################ # Remove the Working Directory ################################ cd $DATA_IN if [ ${RM_TMPDIR:-NO} = YES ] ; then rm -rf $DATA ; fi date if [ $SENDSMS = YES ]; then $SMSBIN/smscomplete fi