#! /bin/sh set -xa # # <<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>> # <<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>> # << FSL_poes.run >> # << >> # <<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>> # <<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>><<>> # # It is called with Arguments: # Arg 1: the run directory # Arg 2: the output directory for main source of bufr obs # Arg 3: the time in YYJJJHHMM format (eg 930691200) # (The last 2 digits will be replaced with 00) # Arg 4: the output directory for second source of bufr obs # # Imported variables # CDY - Current day (like PDY but not based on com/date) # HHMM - Current time # ############################################################################### # ASSIGN THE ARGUMENTS ############################################################################### RUNDIR=${DATA} RAWDIR=$2 RAWDIR2=$4 YYJJJHHMM=$3 ############################################################################### # Processing Location ############################################################################### mkdir ${RUNDIR}/poes cd ${RUNDIR}/poes ############################################################################### # We collect POES data from mulitple sources, do each source ############################################################################### RAWSOURCES="1 2" for rawsrc in $RAWSOURCES do if [ $rawsrc -eq 2 ] then # On Dell-p3, TANK in this block defaulted to dev, but was overridden by the setting of # TANK in the job script. As a result, the same data was dumped fource source 1 and 2. # We don't want to dump data in a production job, so the dev option was removed here. # The following line allows for a separate input source for test runs (passed in via # TANK2) but TANK will default to prod data. This second dump of prod data is kept # going during the transition period for conistency with output from Dell-p3. export TANK=${TANK2:-${DCOMROOT}} rawpoes=$RAWDIR2 else export TANK=${TANK:-${DCOMROOT}} rawpoes=$RAWDIR fi echo "$rawpoes -- $TANK" ############################################################################### # Run dumpjb for late last 4 hours. Save BUFR files taht change size for # furthere data processing. ############################################################################### # Data file have to end with ".block" EXT=block # Top of the hour +- 36 minutes RAD=0.6 # atovs group DGRP=atovs # Default output file from dumpjb FILE=atovs.ibm # Because we are +- the top of the hour, we are trying to minimize duplicate data # processing, but get the data the soonest possible. To do this we use fetch +- # 36 minute for the hour starting with the hour 30 minute ahead. We will look # back 4 hours to get late arriving data. # Get hour for Current + 30, then get the prior 3 hours HRPDS="0 1 2 3 4" for tmpd in $HRPDS do export tmpd # HOUR=${HOUR:-`perl -e '($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$rest) = gmtime(time+1800-($ENV{"tmpd"}*3600));print sprintf("%4.4d%2.2d%2.2d%2.2d",$year+1900,$mon+1,$mday,$hour)'`} HH=${HHMM:0:2} MIN=${HHMM:2:2} HOUR=$(date -d "$CDY $HH:$MIN:00 UTC +30 minutes -${tmpd} hour" +%Y%m%d%H) echo "dumpjb $HOUR $RAD $DGRP" ${DUMPJB:?} $HOUR $RAD $DGRP export err=$? if [[ $err -ne 11 && $err -ne 0 && $err -ne 22 ]] then err_chk fi cp ${RUNDIR}/${FILE} . FILEPREV=${rawpoes}/atovs.ibm.${HOUR}.prev # Check for changes in data file rm -rf dir.1 dir.2 if [ -r ${FILEPREV} ] then ls -l ${FILE} | awk '{print $5}' > dir.1 ls -l ${FILEPREV} | awk '{print $5}' > dir.2 x=`diff dir.1 dir.2 | wc -l` else # First time here. Make sure we have a prev file for next time. x=1 cp $FILE ${FILEPREV} fi if [ $x -gt 0 ] then cp $FILE ${FILEPREV} # move files to processing area mv atovs.ibm ${rawpoes}/atovs.ibm.${HOUR}.$EXT export err=$?;err_chk if [ "$SENDDBN" = 'YES' ] ; then export DBNALERT_TYPE=${DBNALERT_TYPE:-DATA} $SIPHONROOT/bin/dbn_alert $DBNALERT_TYPE MADIS_DUMP $job ${rawpoes}/atovs.ibm.${HOUR}.$EXT fi else # cleanup rm -f atovs.ibm fi done done