|
| 1 | +#!/bin/bash |
| 2 | + |
| 3 | +#PBS -o out.post.aqm |
| 4 | +#PBS -e out.post.aqm |
| 5 | +#PBS -N aqm_test |
| 6 | +#PBS -l walltime=00:30:00 |
| 7 | +#PBS -q debug |
| 8 | +#PBS -A GFS-DEV |
| 9 | +#PBS -l place=vscatter,select=2:ncpus=48 |
| 10 | +#PBS -V |
| 11 | + |
| 12 | +set -x |
| 13 | + |
| 14 | +# specify computation resources |
| 15 | +export threads=1 |
| 16 | +export OMP_NUM_THREADS=$threads |
| 17 | +export APRUN="mpiexec -l -n 96 -ppn 48" |
| 18 | + |
| 19 | +echo "starting time" |
| 20 | +date |
| 21 | + |
| 22 | +############################################ |
| 23 | +# Loading modules |
| 24 | +############################################ |
| 25 | +module reset |
| 26 | +module use ${svndir}/modulefiles |
| 27 | +module load wcoss2_intel |
| 28 | +module load cray-pals/1.0.12 |
| 29 | +module load libjpeg/9c |
| 30 | +module load prod_util/2.0.14 |
| 31 | +module load wgrib2/2.0.8 |
| 32 | +module list |
| 33 | + |
| 34 | +msg="Starting aqm test" |
| 35 | +postmsg "$logfile" "$msg" |
| 36 | + |
| 37 | +export POSTGPEXEC=${svndir}/exec/upp.x |
| 38 | + |
| 39 | +# specify forecast start time and hour for running your post job |
| 40 | +export startdate=2025103106 |
| 41 | +export fhr=008 |
| 42 | +export cyc=`echo $startdate | cut -c9-10` |
| 43 | +export tmmark=tm00 |
| 44 | + |
| 45 | +# specify your running and output directory |
| 46 | +export DATA=$rundir/aqm_${startdate} |
| 47 | +rm -rf $DATA; mkdir -p $DATA |
| 48 | +cd $DATA |
| 49 | + |
| 50 | +export NEWDATE=`${NDATE} +${fhr} $startdate` |
| 51 | +export YY=`echo $NEWDATE | cut -c1-4` |
| 52 | +export MM=`echo $NEWDATE | cut -c5-6` |
| 53 | +export DD=`echo $NEWDATE | cut -c7-8` |
| 54 | +export HH=`echo $NEWDATE | cut -c9-10` |
| 55 | + |
| 56 | +cat > itag <<EOF |
| 57 | +&model_inputs |
| 58 | +fileName='$homedir/data_in/aqm/aqm.t${cyc}z.dyn.f${fhr}.nc' |
| 59 | +IOFORM='netcdf' |
| 60 | +grib='grib2' |
| 61 | +DateStr='${YY}-${MM}-${DD}_${HH}:00:00' |
| 62 | +MODELNAME='FV3R' |
| 63 | +fileNameFlux='$homedir/data_in/aqm/aqm.t${cyc}z.phy.f${fhr}.nc' |
| 64 | +/ |
| 65 | +&NAMPGB |
| 66 | +KPO=47,PO=1000.,975.,950.,925.,900.,875.,850.,825.,800.,775.,750.,725.,700.,675.,650.,625.,600.,575.,550.,525.,500.,475.,450.,425.,400.,375.,350.,325.,300.,275.,250.,225.,200.,175.,150.,125.,100.,70.,50.,30.,20.,10.,7.,5.,3.,2.,1.,aqf_on=.true., |
| 67 | +/ |
| 68 | +EOF |
| 69 | + |
| 70 | +# copy fix data |
| 71 | +cp ${svndir}/fix/nam_micro_lookup.dat ./eta_micro_lookup.dat |
| 72 | +cp ${svndir}/parm/aqm/postxconfig-NT-AQM.txt ./postxconfig-NT.txt |
| 73 | +cp ${svndir}/parm/params_grib2_tbl_new ./params_grib2_tbl_new |
| 74 | + |
| 75 | +# Run the UPP |
| 76 | +${APRUN} ${POSTGPEXEC} < itag > outpost_aqm_${NEWDATE} |
| 77 | + |
| 78 | +################################################ |
| 79 | +# Compare with baseline data |
| 80 | +################################################ |
| 81 | +fhr=`expr $fhr + 0` |
| 82 | +fhr2=`printf "%02d" $fhr` |
| 83 | + |
| 84 | +# AQM post processing generates 1 file |
| 85 | +filelist="CMAQ${fhr2}.${tmmark}" |
| 86 | + |
| 87 | +for file in $filelist; do |
| 88 | +export filein2=$file |
| 89 | +ls -l ${filein2} |
| 90 | +export err=$? |
| 91 | + |
| 92 | +if [ $err = "0" ] ; then |
| 93 | + # use cmp to see if new pgb files are identical to the control one |
| 94 | + cmp ${filein2} $homedir/data_out/aqm/${filein2}.${machine} |
| 95 | + |
| 96 | + # if not bit-identical, use cmp_grib2_grib2 to compare each grib record |
| 97 | + export err1=$? |
| 98 | + if [ $err1 -eq 0 ] ; then |
| 99 | + msg="aqm test: your new post executable generates bit-identical ${filein2} as the develop branch" |
| 100 | + echo $msg |
| 101 | + else |
| 102 | + msg="aqm test: your new post executable did not generate bit-identical ${filein2} as the develop branch" |
| 103 | + echo $msg |
| 104 | + echo " start comparing each grib record and write the comparison result to *diff files" |
| 105 | + echo " check these *diff files to make sure your new post only change variables which you intend to change" |
| 106 | + $cmp_grib2_grib2 $homedir/data_out/aqm/${filein2}.${machine} ${filein2} > ${filein2}.diff |
| 107 | + fi |
| 108 | +else |
| 109 | + msg="aqm test: post failed using your new post executable to generate ${filein2}" |
| 110 | + echo $msg 2>&1 | tee -a TEST_ERROR |
| 111 | +fi |
| 112 | + |
| 113 | +postmsg "$logfile" "$msg" |
| 114 | +done |
| 115 | + |
| 116 | +echo "PROGRAM IS COMPLETE!!!!!" 2>&1 | tee SUCCESS |
| 117 | +msg="Ending aqm test" |
| 118 | +postmsg "$logfile" "$msg" |
0 commit comments