#!/bin/bash ## JMAG_PROCESSOR ##################################### # Runs the processing scripts to generate GIF images # for the MAG web site ####################################################### date export PS4='+ $SECONDS + ' set -x ####################################################### # The following variables could be defined in the # submission script (the ecf script), if # not they will take the default values which is set # for the NCO running enviroment ####################################################### export job=${job:-jmag.${MODEL:?}} export SENDECF=${SENDECF:-"YES"} ####################################################### # Create temporary working directory ####################################################### export DATA=${DATAROOT:?}/${jobid:?} mkdir -p $DATA cd $DATA ##################################################### # Cycle is needed for the setPDY to make date # values available in the working directory # $cyc not used in MAG, default to previous hour. ##################################################### # Change to allow SPA to run a single case (date/time) # on ecFlow if needed ############################## if [ $PDY ] || [ $cyc ]; then # If PDY and/or cyc has been defined, # pass -x -y flag to exmag_processor.pl. export rerun=YES else export rerun=NO fi export cyc=${cyc:-`date -u +%H -d "1 hour ago"`} export cycle=t${cyc}z ############################################################## # Set up the UTILITIES # Add path to utility scripts. # Run setpdy and initialize PDY variables ############################################################### setpdy.sh . ./PDY ############################################################### # Define COM directories # Changes to conform to wcoss2 standards ############################################################### magName=`echo ${NET}_ver` NET_ver=${!magName} verName=`echo ${RUN}_ver` RUN_ver=${!verName} verName3=`echo ${RUN3}_ver` RUN3_ver=${!verName3} export COMIN=${COMIN:-$(compath.py ${RUN:?}/${RUN_ver})} export DCOMINnhc=${DCOMINnhc:-${DCOMROOT}/nhc} if [ -n "$RUN3" ]; then export COMIN3=${COMIN3:-$(compath.py ${RUN3:?}/${RUN3_ver})} fi ########################################################################################## # SET THE OUTPUT DIRECTORIEiS # Changes to be made by SPA # MAG team does not have permission to write compath ########################################################################################## export COMOUT=${COMOUT:-$(compath.py -o ${NET}/${NET_ver})/gifs} export COMOUTstatus=${COMOUTstatus:-$(compath.py -o ${NET}/${NET_ver})/status} mkdir -m 755 -p $COMOUT $COMOUTstatus #################################### # Specify Execution Areas #################################### export HOMEmag=${HOMEmag:-${PACKAGEROOT:?}/mag.${mag_ver:?}} export EXECmag=${EXECmag:-$HOMEmag/exec} export USHmag=${USHmag:-$HOMEmag/ush} export SCRIPTSmag=${SCRIPTSmag:-$HOMEmag/scripts} export FIXmag=${FIXmag:-$HOMEmag/fix} export PARMmag=${PARMmag:-$HOMEmag/parm} #################### # Execute the script #################### export MAGPROCPL_FLAGS="-m ${MODEL}" if hash cfp 2>/dev/null; then export USE_CFP=YES fi if [ "$hurr_model" == "yes" ]; then mag_script=exmag_processor_hurr.pl else mag_script=exmag_processor.pl if [ $rerun == "YES" ]; then MAGPROCPL_FLAGS+=" -x ${PDY} -y ${cyc}" # MAGPROCPL_FLAGS+=" -x ${PDYm1} -y ${cyc}" fi fi env ${SCRIPTSmag}/${mag_script} ${MAGPROCPL_FLAGS} export err=$?; err_chk postmsg "$0 completed normally" ############################## # Remove the Temporary working directory ############################## if [ "${KEEPDATA^^}" != 'YES' ]; then rm -rf ${DATA:?} fi date