#!/bin/bash set -xa date -u ################################################################### # Set DEBUG LEVEL - modifies info in execution trace prompt string ################################################################### export DEBUG_LEVEL=${DEBUG_LEVEL=1} case $DEBUG_LEVEL in 1) export PS4='+ ${SECONDS}s + ' ;; # add seconds (this is typical case) 0) export PS4='+ ';; # don't include seconds (useful if # want to diff output from 2 runs) 2) export PS4='+ ${SECONDS}s:L$LINENO + ';; # add script line # 3) export PS4='+ ${SECONDS}s:${0##*/}:L$LINENO + ';;# add script name & line # 4) export PS4='+ ${0##*/}:L$LINENO + ';; # script name & line (no seconds) *) echo "Unrecognized DEBUG_LEVEL. Stay with current PS4 setting";; esac ######################################## # Check that required variables are set ######################################## set +x echo echo cyc is ${cyc:?"###FATAL ERROR \"cyc\" is not set"} echo envir is ${envir:?"###FATAL ERROR \"envir\" is not set"} echo job is ${job:?"###FATAL ERROR \"job\" is not set"} echo DATAROOT is ${DATAROOT:?"###FATAL ERROR \"DATAROOT\" is not set"} echo set -x ################################ # Print out version information ################################ set +x echo echo "####################################################################" echo echo "OBSPROC version is ${obsproc_ver:-not set}" echo echo "####################################################################" echo set -x ##################################################################### # List modules loaded for this job ##################################################################### set +x echo echo "####################################################################" echo module list echo echo "####################################################################" echo set -x ################################## # Specify NET and RUN ################################## export obsNET=${obsNET:-obsproc} export NET=${NET:-cdas} export RUN=${RUN:-cdas} set +x echo echo obsNET is ${obsNET:?"###FATAL ERROR \"obsNET\" is not set"} echo NET is ${NET:?"###FATAL ERROR \"NET\" is not set"} echo RUN is ${RUN:?"###FATAL ERROR \"RUN\" is not set"} echo set -x ############################## # Specify cycle and time-mark ############################## export cycle=t${cyc}z export tmmark=tm00 ############################### # Create new working directory ############################### jobid=${jobid:-${job}.$(hostname -s).$$} export DATA=${DATA:-$DATAROOT/${jobid}} rm -rf $DATA mkdir -p $DATA cd $DATA export pgmout=OUTPUT.$$ ###################################### # Set job log file for postmsg output ###################################### jlogfile=${jlogfile:-${DATA}/jlogfile} ################################################# # SENDCOM - Copy files to $COMOUT directory # SENDECF - Flag Events on ECFLOW # SENDDBN - Alert output file to TOC ################################################# export SENDCOM=${SENDCOM:-YES} export SENDECF=${SENDECF:-YES} export SENDDBN=${SENDDBN:-YES} ########################## # Specify Execution Areas ########################## # ------------------------------- # Paths for obsproc_network items # ------------------------------- export HOMEobsproc=${HOMEobsproc:\ -${PACKAGEROOT:?}/obsproc/${obsproc_ver:?\ "###FATAL ERROR \"obsproc_ver\" is not set"}} export SCRIPTSobsproc=${SCRIPTSobsproc:-$HOMEobsproc/scripts} export FIXprepobs=${FIXprepobs:-$HOMEprepobs/fix} export USHprepobs=${USHprepobs:-$HOMEprepobs/ush} # directory path to data prep script executed in model script # ----------------------------------------------------------- export ushscript_prep=${ushscript_prep:-$USHprepobs} # directory paths to overall PREP processing executed in # prepobs_makeprepbufr.sh and its various child scripts # (other than prepobs_syndata.sh, see below) # ------------------------------------------------------- export EXECPREP=${EXECPREP:-${HOMEprepobs}/exec} export FIXPREP=${FIXPREP:-${HOMEprepobs}/fix} export PARMPREP=${PARMPREP:-${HOMEobsproc}/parm} # directory paths to SYNDATA processing executed in prepobs_syndata.sh # -------------------------------------------------------------------- export EXECSYND=${EXECSYND:-${HOMEprepobs}/exec} export FIXSYND=${FIXSYND:-${HOMEprepobs}/fix} export PARMSYND=${PARMSYND:-${HOMEobsproc}/parm} # --------------------------- # Paths for non-obsproc items # --------------------------- # DICTPREP is directory path to metar.tbl dictionary used in # prepobs_prepacqc.sh if PREPOBS_PREPACPF is executed # ---------------------------------------------------------- export DICTPREP=${DICTPREP:-${OPSROOT}/decoders/decod_shared/dictionaries_${dictionaries_ver}} ############################################## # Add some prod utilities to working directory ############################################## echo "step ############# break ##############################" > ./break cp $UTILROOT/ush/err_chk .; chmod +x err_chk cp $UTILROOT/ush/err_exit .; chmod +x err_exit cp $UTILROOT/ush/prep_step .; chmod +x prep_step cp $UTILROOT/ush/postmsg .; chmod +x postmsg cp $UTILROOT/ush/setpdy.sh .; chmod +x setpdy.sh ########################################## # Run setpdy and initialize PDY variables ########################################## set +x; echo -e "\n---> path to setpdy.sh below is: `which setpdy.sh`"; set -x if [ -z "$PDY" ]; then if test "$cyc" = "06" then # With a very late cutoff, it is possible for the 06Z cycle # to move into the next day if production is running late - # to ensure that the YYYYMMDD are correct, use the /com/date/t12z # file for our PDY export cycle=t12z setpdy.sh . $DATA/PDY export cycle=t06z setpdy.sh . $DATA/PDY elif test "$cyc" = "18" then # With a very late cutoff, it is possible for the 18Z cycle # to move into the next day if production is running late - # to ensure that the YYYYMMDD are correct, use the /com/date/t00z # file to make PDY then backdate this PDY by 24-hours to get our PDY export cycle=t00z setpdy.sh . $DATA/PDY PDY=$PDYm1 setpdy.sh . $DATA/PDY export cycle=t18z setpdy.sh . $DATA/PDY else # At 00 and 12Z, there should never be a problem setpdy.sh . $DATA/PDY fi else # If PDY was previously specified (checkout only) fall through to here setpdy.sh . $DATA/PDY fi # Finally, backdate our PDY by 24-hours since model runs 1-day behind PDY=$PDYm1 setpdy.sh . $DATA/PDY ######################### # Define COM directories ######################### export COMIN_ROOT=${COMIN_ROOT:-${COMROOT:-""}} if [[ "$RUN_ENVIR" == nco ]]; then # ... COM_IN is path to files possibly read by prepobs_cqcbufr export COM_IN=$(compath.py ${envir}/${obsNET}/${obsproc_ver}) export COMIN=${COMIN:-$(compath.py ${envir}/${obsNET}/${obsproc_ver}/${RUN}.${PDY})} export COMOUT=${COMOUT:-$(compath.py -o ${obsNET}/${obsproc_ver}/${RUN}.${PDY})} mkdir -m 775 -p $COMOUT else # ... COM_IN is path to files possibly read by prepobs_cqcbufr export COM_IN=$(compath.py ${envir}/${obsNET}/${obsproc_ver}) export COMIN=${COMIN:-${COMIN_ROOT:?}/${obsNET}/${obsproc_ver}/${RUN}.${PDY}} # COMOUT_ROOT for developers defaults to unique $DATA/com directory as root to # prevent job from writing into a non-unique directory that might already have # output in it from a previous checkout run for the same cycle # ----------------------------------------------------------------------------- export COMOUT_ROOT=${COMOUT_ROOT:-${DATA}/com} export COMOUT=${COMOUT:-${COMOUT_ROOT}/${obsNET}/${obsproc_ver}/${RUN}.${PDY}} mkdir -m 755 -p $COMOUT fi export COMINcdas=${COMINcdas:-$(compath.py ${envir_getges}/cdas/${cdas_ver})} ################################################# # SETUP CDAS PREPBUFR PREP2 PROCESSING VARIABLES ################################################# ######################################################### # Specify variables specific to this execution of script ######################################################### export JOB_NUMBER=2 # VARIABLES THAT CONTROL PROCESSING OF INDIVIDUAL PROGRAMS # -------------------------------------------------------- export PREPDATA=NO # DO NOT # execute programs PREPOBS_MPCOPYBUFR, PREPOBS_PREPDATA, # PREPOBS_LISTHEADERS and PREPOBS_MONOPREPBUFR # (instead, feed the file below into the Q.C. codes) export PREPBUFR_IN=${PREPBUFR_IN:-$COMIN/${RUN}.${cycle}.prepbufr_pre-qc} export GETGUESS=${GETGUESS:-YES} # Encode first guess (background) values interpolated to # observation locations in the PREPBUFR file for use by # the q.c. programs. This guess is always from a global # sigma guess file valid at the center PREPBUFR # processing date/time. export network_getges=${network_getges:-cdas} # getges processes only CDAS files # -- These can individually be switched to NO without affecting the # success of other programs and the success of the complete job # (if job fails in one of these programs, set offending program # to NO and resubmit to "work-around" problem) export SYNDATA=NO # NEVER execute program SYNDAT_SYNDATA export PREVENTS=${PREVENTS:-YES} # Execute program PREPOBS_PREVENTS if YES export PREPACQC=${PREPACQC:-YES} # Execute PREPACQC script processing if YES export PROCESS_ACQC=${PROCESS_ACQC:-YES} # Execute program PREPOBS_PREPACQC # if YES export PROCESS_ACPF=${PROCESS_ACPF:-NO} # Execute program PREPOBS_PREPACPF # if YES export PROFCQC=${PROFCQC:-NO} # Execute program PREPOBS_PROFCQC if YES # SHOULD ALWAYS BE SET TO "NO" export CQCVAD=${CQCVAD:-NO} # Execute program PREPOBS_CQCVAD if YES # SHOULD ALWAYS BE SET TO "NO" export CQCBUFR=${CQCBUFR:-YES} # Execute program PREPOBS_CQCBUFR if YES export CQCC=${CQCC:-$PARMPREP/prepobs_cqcbufr.${NET}.parm} # Must export CQCBUFR parm card path export OIQCBUFR=${OIQCBUFR:-YES} # Execute program PREPOBS_OIQCBUFR if YES export DO_QC=${DO_QC:-YES} # IF NO, programs PREPOBS_PREVENTS, PREPOBS_PREPACQC, # PREPOBS_PREPACPF, PREPOBS_PROFCQC, PREPOBS_CQCVAD, # PREPOBS_CQCBUFR and PREPOBS_OIQCBUFR will NEVER execute # regardless of switches above export COPY_TO_ARKV=${COPY_TO_ARKV:-YES} if [ $COPY_TO_ARKV == YES ]; then if [[ "$RUN_ENVIR" == nco ]]; then export COMARC=$(compath.py ${envir}/${obsNET}/${obsproc_ver}/${RUN}.`echo $PDY | cut -c1-6`) mkdir -m 775 -p $COMARC else export COMARC=${COMARC:-${COMOUT_ROOT:?}/${obsNET}/${obsproc_ver}/${RUN}.`echo $PDY | cut -c1-6`} mkdir -m 755 -p $COMARC fi fi env ##################### # Execute the script ##################### $SCRIPTSobsproc/excdas_makeprepbufr.sh eval err_${RUN}_prep2=$? eval [[ \$err_${RUN}_prep2 -ne 0 ]] && $DATA/err_exit echo "$SITE `hostname` -- `date -u`" > $COMOUT/where_${cycle}_${RUN}_prep2_ran > $COMOUT/obsproc_version_for_${cycle}_${RUN}_prep2_run [ -n "$obsproc_ver" ] && \ echo "OBSPROC version is $obsproc_ver" >> \ $COMOUT/obsproc_version_for_${cycle}_${RUN}_prep2_run if [ "$KEEPDATA" != YES ]; then cd $DATAROOT rm -rf $DATA fi date -u exit