#!/bin/sh #------------------------------------------------------------- echo "Starting time of forecast and emission" echo "Enter year YY?"; read sy echo "Enter month MM?"; read sm echo "Enter day DD?"; read sd syr=`printf %2.2d $sy` smo=`printf %2.2d $sm` sda=`printf %2.2d $sd` # when updating the forecast once a day at 00Z shr=00 # this value can be constant rather than input echo "Initial Simulation (y/n)?" read cmd if [ "$cmd" == "y" ]; then rm -f start_list.txt rm -f start_prev.txt rm -f merg_list.txt rm -f emit_?????? rm -f PARDUMP_???? rm -f PP_??????_???? rm -f CG_??????_???? rm -f TG_?????? rm -f CONTROL rm -f hysplit.bin rm -f plot??.html rm -f CONC.CFG SETUP.CFG LABELS.CFG rm -f VMSDIST WARNING MESSAGE CONTROL else # For all subsequent simulation updates ... # Initialize the started simulations list with those that were # started previous to today because the file should only contain # the start times that correspond to the analysis period. The # issue with the start_list file is that it also contains those # simulations that were started during the forecast period. cp -p start_prev.txt start_list.txt cat start_list.txt | while read PRUN; do # update the particle files to match the script start time # previous particle positions were for the last forecast mv PP_${smo}${PRUN}_${sda}${shr} PARDUMP_${PRUN} done rm -f PP_??????_???? fi echo "Continue (y/n)?" read cmd if [ "$cmd" == "n" ]; then exit; fi echo "$0 Starting: $syr $smo $sda" #------------------------------------------------------------- WEB="" if [ -f /usr/bin/firefox ];then WEB="/usr/bin";fi if [ -f /usr/local/bin/firefox ];then WEB="/usr/local/bin";fi MDL="${HOME}/hysplit" MAP="${MDL}/graphics/arlmap" MET="." if [ ! -f ASCDATA.CFG ]; then echo "-90.0 -180.0" >ASCDATA.CFG echo "1.0 1.0" >>ASCDATA.CFG echo "180 360" >>ASCDATA.CFG echo "2" >>ASCDATA.CFG echo "0.2" >>ASCDATA.CFG echo "'$MDL/bdyfiles/'" >>ASCDATA.CFG fi #-------------------------------------------------------------- olat=48.0 olon=-88.0 lvl1=10.0 run=6 ztop=10000.0 data=NAM # /pub/forecast/2023018/hysplit.t00z.namsf.NEtile #---------------------------------------------------------- echo "&SETUP " >SETUP.CFG echo "ndump = ${run}, " >>SETUP.CFG echo "delt = 5.0, " >>SETUP.CFG echo "numpar = -2500, " >>SETUP.CFG echo "maxpar = 20000, " >>SETUP.CFG echo "/ " >>SETUP.CFG #---------------------------------------------------------- for fd in 0 1; do let dd=$sd+$fd DD=`printf %2.2d $dd` for HH in 00 06 12 18; do # PART 1 - restart emission section from list of current simulations if [ -f start_list.txt ];then cat start_list.txt | while read PRUN; do echo "$syr $smo $DD $HH " >CONTROL echo "1 ">>CONTROL echo "$olat $olon $lvl1 ">>CONTROL echo "$run ">>CONTROL echo "0 ">>CONTROL echo "$ztop ">>CONTROL echo "1 ">>CONTROL echo "$MET/ ">>CONTROL echo "$data${sda}.t00z ">>CONTROL echo "1 ">>CONTROL echo "GASP ">>CONTROL echo "0.0 ">>CONTROL echo "0.0 ">>CONTROL echo "00 00 00 00 00 ">>CONTROL echo "1 ">>CONTROL echo "50.0 -90.0 ">>CONTROL echo "0.05 0.05 ">>CONTROL echo "20.0 30.0 ">>CONTROL echo "./ ">>CONTROL echo "CG_${smo}${PRUN}_${DD}${HH}">>CONTROL echo "1 ">>CONTROL echo "100 ">>CONTROL echo "00 00 00 00 00 ">>CONTROL echo "00 00 00 00 00 ">>CONTROL echo "00 06 00 ">>CONTROL echo "1 ">>CONTROL echo "0.0 0.0 0.0 ">>CONTROL echo "0.0 0.0 0.0 0.0 0.0 ">>CONTROL echo "0.0 0.0 0.0 ">>CONTROL echo "0.0 ">>CONTROL echo "0.0 ">>CONTROL mv PARDUMP_${PRUN} PARINIT cp PARINIT PP_${smo}${PRUN}_${DD}${HH} ${MDL}/exec/hycs_std if [ -f PARDUMP ];then mv PARDUMP PARDUMP_${PRUN} rm -f PARINIT fi done fi # end of start_list.txt exists section # PART 2 - new emission section echo "$syr $smo $DD $HH " >CONTROL echo "1 ">>CONTROL echo "$olat $olon $lvl1 ">>CONTROL echo "$run ">>CONTROL echo "0 ">>CONTROL echo "$ztop ">>CONTROL echo "1 ">>CONTROL echo "$MET/ ">>CONTROL echo "$data${sda}.t00z ">>CONTROL echo "1 ">>CONTROL echo "GASP ">>CONTROL echo "1.0 ">>CONTROL echo "${run}.0 ">>CONTROL echo "00 00 00 00 00 ">>CONTROL echo "1 ">>CONTROL echo "50.0 -90.0 ">>CONTROL echo "0.05 0.05 ">>CONTROL echo "20.0 30.0 ">>CONTROL echo "./ ">>CONTROL echo "CG_${smo}${DD}${HH}_${DD}${HH}">>CONTROL echo "1 ">>CONTROL echo "100 ">>CONTROL echo "00 00 00 00 00 ">>CONTROL echo "00 00 00 00 00 ">>CONTROL echo "00 06 00 ">>CONTROL echo "1 ">>CONTROL echo "0.0 0.0 0.0 ">>CONTROL echo "0.0 0.0 0.0 0.0 0.0 ">>CONTROL echo "0.0 0.0 0. ">>CONTROL echo "0.0 ">>CONTROL echo "0.0 ">>CONTROL ${MDL}/exec/hycs_std if [ -f PARDUMP ];then mv PARDUMP PARDUMP_${DD}${HH};fi echo ${DD}${HH} >>start_list.txt if [ "${DD}" == "${sda}" ]; then echo ${DD}${HH} >>start_prev.txt; fi # create emission file for testing (10^12 ug = 10^6 g = 10^3 kg = 1 MT) if [ ! -f emit_${smo}${DD}${HH} ];then echo "1.0E+12" >emit_${smo}${DD}${HH} fi done done echo "Continue with post-processing (y/n)?" read cmd if [ "$cmd" == "n" ]; then exit; fi #-------------- Post Processing Section ------------------- echo "Merge Individual 6h Concentration files into one file per release" cat start_list.txt | while read PRUN; do emit=`cat emit_${smo}${PRUN}` ls CG_${smo}${PRUN}_???? >conc_list.txt ${MDL}/exec/conappend -iconc_list.txt -oTG_${smo}${PRUN} -c${emit} rm conc_list.txt done echo "Merge all release times into a single concentration output file" ls TG_?????? >merg_list.txt ${MDL}/exec/conmerge -imerg_list.txt -ohysplit.bin # -------- Concentration Plot ----------- np=`wc -l < start_prev.txt` np=`expr $np - 3` echo "Forecast start frame: $np" echo "Continue with graphics (y/n)?" read cmd if [ "$cmd" == "n" ]; then exit; fi echo "'TITLE&','Gaseous Pollutant (GASP)&'" >LABELS.CFG echo "'UNITS&',' ug&'" >>LABELS.CFG echo "'VOLUM&','/m3&'" >>LABELS.CFG ${MDL}/exec/concplot -ihysplit.bin -oplot${sda} -j${MAP} +g1 -z95 -h48.0:-86.0 -g0:500 \ -n$np:99 -k2 -c4 -v30.0+10.0+3.0+1.0+0.3+0.1+0.03+0.01+0.003+0.001 # -------- Display Graphics ------------- if [[ "$OSTYPE" == "darwin"* ]]; then open plot${sda}.html else ${WEB}/firefox plot${sda}.html & fi