1. Set up FV3GFS - delippi/PhD-globalRadarOSSE GitHub Wiki
Set up FV3GFS
1. Clone, compile, and set up the fv3gfs repository
git clone --recursive gerrit:global-workflow
cd global-workflow
git checkout -b dl2rw_global
cd sorc
sh checkout.sh
mv gsi.fd gsi.fd_fv3da.v1.0.38
git clone --recursive gerrit:ProdGSI gsi.fd
cd gsi.fd
git checkout dl2rw
git describe --tags
git fetch --tags origin
- git merge fv3da.v1.0.38 [fix conflicts if any] commit 9d33888d51d89c7a04a87def1230705ffa28296a
+ git merge fv3da.v1.0.43 [fix conflicts if any] commit 8793971458a5a81ae6bb1076142301f7334f9a28
git commit
- git describe --tags [should say something like fv3da.v1.0.38-2-g7bcddc0]
+ git describe --tags [should say something like fv3da.v1.0.43-3-g8793971]
sh build_all.sh
sh link_fv3gfs.sh emc[nco] cray[theia]
2. Modify the GSI code to assimilate radial wind in a global configuration for FV3GFS. And recompile.
cd /scratch4/NCEPDEV/fv3-cam/save/Donald.E.Lippi/fv3gfs/sorc/gsi.fd/ush
vi build_all.sh
[compile only GSI and clean=NO]
vi build_gsi.sh
[clean=NO]
modified files:
/scratch4/NCEPDEV/fv3-cam/save/Donald.E.Lippi/fv3gfs/ush/fv3ics.py
/scratch4/NCEPDEV/fv3-cam/save/Donald.E.Lippi/fv3gfs/sorc/gsi.fd/scripts/exglobal_analysis_fv3gfs.sh.ecf
/scratch4/NCEPDEV/fv3-cam/save/Donald.E.Lippi/fv3gfs/sorc/gsi.fd/src/gsimod.F90
/scratch4/NCEPDEV/fv3-cam/save/Donald.E.Lippi/fv3gfs/sorc/gsi.fd/src/setuprw.f90
/scratch4/NCEPDEV/fv3-cam/save/Donald.E.Lippi/fv3gfs/sorc/gsi.fd/src/gridmod.F90
/scratch4/NCEPDEV/fv3-cam/save/Donald.E.Lippi/fv3gfs/sorc/gsi.fd/src/gsisub.F90
/scratch4/NCEPDEV/fv3-cam/save/Donald.E.Lippi/fv3gfs/sorc/gsi.fd/src/general_read_gfsatm.f90
/scratch4/NCEPDEV/fv3-cam/save/Donald.E.Lippi/fv3gfs/sorc/gsi.fd/fix/global_anavinfo.l64.txt.w
cd /scratch4/NCEPDEV/fv3-cam/save/Donald.E.Lippi/fv3gfs/sorc
sh build_gsi.sh
sh link_fv3gfs.sh emc[nco] cray[theia]
3. Save GSI modification in new branch
cd /scratch4/NCEPDEV/fv3-cam/save/Donald.E.Lippi/fv3gfs/sorc/gsi.fd
git branch
[* (HEAD detached at fv3da.v1.0.14)]
git branch -a
git push --delete origin <branch_name>
git branch -d <branch_name>
git branch -b dl2rw_global
git add [names of modified files]
git commit
git push origin dl2rw_global
4. Add reflectivity to the diag table.
cd /gpfs/hps3/emc/meso/save/Donald.E.Lippi/global-workflow-20190306/parm/parm_fv3diag
vi diag_table
diff --git a/parm/parm_fv3diag/diag_table b/parm/parm_fv3diag/diag_table
index 4617eab..be57cc9 100644
--- a/parm/parm_fv3diag/diag_table
+++ b/parm/parm_fv3diag/diag_table
@@ -21,6 +21,7 @@
"gfs_dyn", "w", "dzdt", "fv3_history", "all", .false., "none", 2
"gfs_dyn", "ps", "pressfc", "fv3_history", "all", .false., "none", 2
"gfs_dyn", "hs", "hgtsfc", "fv3_history", "all", .false., "none", 2
+"gfs_dyn", "reflectivity","dbz", "fv3_history", "all", .false., "none", 2
"gfs_phys", "ALBDO_ave", "albdo_ave", "fv3_history2d", "all", .false., "none", 2
"gfs_phys", "cnvprcp_ave", "cprat_ave", "fv3_history2d", "all", .false., "none", 2
Double check that the FV3 is capable of outputting reflectivity.
cd /gpfs/hps3/emc/meso/save/Donald.E.Lippi/global-workflow-20190306/sorc/fv3gfs.fd/FV3/atmos_cubed_sphere/driver/fvGFS
vi fv_nggps_diag.F90
Below is just a summary of a small amount of the changes. See the following for full details https://vlab.ncep.noaa.gov/redmine/projects/comfv3/repository/revisions/c51c51f3c84645bf082de962dbcff1ff9235760f
@@ -88,11 +88,12 @@ module fv_nggps_diags_mod
logical master
integer :: id_ua, id_va, id_pt, id_delp, id_pfhy, id_pfnh
- integer :: id_w, id_delz, id_diss, id_ps, id_hs
+ integer :: id_w, id_delz, id_diss, id_ps, id_hs, id_dbz
integer :: kstt_ua, kstt_va, kstt_pt, kstt_delp, kstt_pfhy
integer :: kstt_pfnh, kstt_w, kstt_delz, kstt_diss, kstt_ps,kstt_hs
integer :: kend_ua, kend_va, kend_pt, kend_delp, kend_pfhy
integer :: kend_pfnh, kend_w, kend_delz, kend_diss, kend_ps,kend_hs
+ integer :: kstt_dbz, kend_dbz
integer :: kstt_windvect, kend_windvect
integer :: isco, ieco, jsco, jeco, npzo, ncnsto
integer :: nlevs
@@ -267,6 +268,13 @@ contains
nlevs = nlevs + 1
endif
!
+ id_dbz = register_diag_field ( trim(file_name), 'reflectivity', axes(1:3), Time, &
+ 'Stoelinga simulated reflectivity', 'dBz', missing_value=missing_value)
+ if( rainwat > 0 .and. id_dbz > 0) then
+ kstt_dbz = nlevs+1; kend_dbz = nlevs+npzo
+ nlevs = nlevs + npzo
+ endif
+!
cd /gpfs/hps3/emc/meso/save/Donald.E.Lippi/global-workflow-20190306/sorc
sh build_fv3.sh
sh link_fv3gfs.sh emc cray
4. Edit POST
fv3gfs_downstream_nems.sh
#!/bin/ksh
set -x
echo "Running: $0"
#-----------------------------------------------------------------------
#-Hui-Ya Chuang, January 2014: First version.
# This script was written to include all new Grib2 GFS downstream post processing in
# EMC's parallel so that EMC can reproduce all operational pgb files as in operations.
# Due to EMC's limited resources, MPMD is used to speed up downstream post processing.
#-Hui-Ya Chuang, September 2015:
# modification to generate select grids on non-WCOSS machines without using MPMD.
# NCEP R&D machines do not have MPMD.
#-Fanglin Yang, September 2015
# 1. restructured and simplified the script.
# 2. use wgrib2 instead of copygb2 for interpolation. copygb2 is slow and is not
# working for converting grib2 files that are produced by nceppost using nemsio files.
# 3. use wgrib2 to convert pgbm on quarter-degree (no matter gaussian or lat-lon) grid
# to pgbq on quarter-degree lat-lon grid.
# 4. Between using COPYGB2 and WGRIB2, about 50% of the fields are bit-wise identical.
# Others are different at the noise level at spotted points.
#-Fanglin Yang, February 2016
# 1. For NEMSIO, gfspost1 exceends 6-hour CPU limits on WCOSS. Remove pgrbh and pgrbl
#-Fanglin Yang, March 2017
# 1. Modified for FV3GFS, using NCEP-NCO standard output name convention
# 2. Add option24 to turn on bitmap in grib2 file (from Wen Meng)
#-Wen Meng, January 2018, add flag PGB1F for turning on/ogg grib1 pgb data at 1.00 deg. generation.
#-Wen Meng, Feburary 2018
# 1. Add flag PGBS for turning on/off pgb data at 1.0 and 0.5 deg. generation frequency of FHOUT_PGB defined.
#-----------------------------------------------------------------------
echo "!!!!!CREATING $RUN DOWNSTREAM PRODUCTS FOR FH = $FH !!!!!!"
export downset=${downset:-1}
export DATA=${DATA:-/ptmpd2/$LOGNAME/test}
export CNVGRIB=${CNVGRIB:-${NWPROD:-/nwprod}/util/exec/cnvgrib21}
export COPYGB2=${COPYGB2:-${NWPROD:-/nwprod}/util/exec/copygb2}
export WGRIB2=${WGRIB2:-${NWPROD:-/nwprod}/util/exec/wgrib2}
export GRBINDEX=${GRBINDEX:-${NWPROD:-nwprod}/util/exec/grbindex}
export RUN=${RUN:-"gfs"}
export cycn=`echo $CDATE |cut -c 9-10`
export TCYC=${TCYC:-".t${cycn}z."}
export PREFIX=${PREFIX:-${RUN}${TCYC}}
export PGB1F=${PGB1F:-"NO"}
export FHOUT_PGB=${FHOUT_PGB:-3}
#export PGBS=${PGBS:-"NO"} #YES-- generate 1.00 and 0.50 deg pgb data
export PGBS="NO" #YES-- generate 1.00 and 0.50 deg pgb data
#--wgrib2 regrid parameters
export option1=' -set_grib_type same -new_grid_winds earth '
export option21=' -new_grid_interpolation bilinear -if '
export option22=":(LAND|CRAIN|CICEP|CFRZR|CSNOW|ICSEV):"
export option23=' -new_grid_interpolation neighbor -fi '
export option24=' -set_bitmap 1 -set_grib_max_bits 16 -if '
export option25=":(APCP|ACPCP|PRATE|CPRAT):"
export option26=' -set_grib_max_bits 25 -fi -if '
export option27=":(APCP|ACPCP|PRATE|CPRAT|DZDT):"
export option28=' -new_grid_interpolation budget -fi '
export grid0p125="latlon 0:2880:0.125 90:1441:-0.125"
export grid0p25="latlon 0:1440:0.25 90:721:-0.25"
export grid0p5="latlon 0:720:0.5 90:361:-0.5"
export grid1p0="latlon 0:360:1.0 90:181:-1.0"
export grid2p5="latlon 0:144:2.5 90:73:-2.5"
unset paramlist paramlistb
if [ $FH -eq -1 ] ; then
#export paramlist=/global/save/Hui-Ya.Chuang/gfs_trunk/sib/fix/global_1x1_paramlist_g2.anl
export paramlist=${paramlist:-$PARMpost/global_1x1_paramlist_g2.anl}
export paramlistb=${paramlistb:-$PARMpost/global_master-catchup_parmlist_g2}
export fhr3=anl
export PGBS=NO #YES
elif [ $FH -eq 0 ] ; then
export paramlist=${paramlist:-$PARMpost/global_1x1_paramlist_g2.f000}
export paramlistb=${paramlistb:-$PARMpost/global_master-catchup_parmlist_g2}
export fhr3=000
export PGBS=NO #YES
else
export paramlist=${paramlist:-$PARMpost/global_1x1_paramlist_g2}
export paramlistb=${paramlistb:-$PARMpost/global_master-catchup_parmlist_g2}
export fhr3=`expr $FH + 0 `
if [ $fhr3 -lt 100 ]; then export fhr3="0$fhr3"; fi
if [ $fhr3 -lt 10 ]; then export fhr3="0$fhr3"; fi
if [ $fhr3%${FHOUT_PGB} -eq 0 ]; then
export PGBS=NO #YES
fi
fi
$WGRIB2 $PGBOUT2 | grep -F -f $paramlist | $WGRIB2 -i -grib tmpfile1_$fhr3 $PGBOUT2
export err=$?; err_chk
#if [ $machine = WCOSS -o $machine = WCOSS_C -a $downset = 2 ]; then
if [ $downset = 2 ]; then
$WGRIB2 $PGBOUT2 | grep -F -f $paramlistb | $WGRIB2 -i -grib tmpfile2_$fhr3 $PGBOUT2
export err=$?; err_chk
fi
#-----------------------------------------------------
#-----------------------------------------------------
if [ $machine = WCOSS -o $machine = WCOSS_C -o $machine = WCOSS_DELL_P3 ]; then
#-----------------------------------------------------
#-----------------------------------------------------
export nset=1
export totalset=2
if [ $downset = 1 ]; then totalset=1 ; fi
#..............................................
while [ $nset -le $totalset ]; do
#..............................................
export tmpfile=$(eval echo tmpfile${nset}_${fhr3})
# split of Grib files to run downstream jobs using MPMD
export ncount=`$WGRIB2 $tmpfile |wc -l`
# export tasks_post=$(eval echo \$tasksp_$nknd)
export nproc=${nproc:-${npe_dwn:-24}}
if [ $nproc -gt $ncount ]; then
echo " *** FATA ERROR: Total number of records in $tmpfile is not right"
export err=8
err_chk
fi
export inv=`expr $ncount / $nproc`
rm -f $DATA/poescript
export iproc=1
export end=0
while [ $iproc -le $nproc ] ; do
export start=`expr ${end} + 1`
export end=`expr ${start} + ${inv} - 1`
if [ $end -ge $ncount ](/delippi/PhD-globalRadarOSSE/wiki/-$end--ge-$ncount-) ;then
export end=$ncount
fi
# if final record of each piece is ugrd, add vgrd
# copygb will only interpolate u and v together
#$WGRIB2 -d $end $tmpfile |grep -i ugrd
$WGRIB2 -d $end $tmpfile |egrep -i "ugrd|ustm|uflx"
export rc=$?
if [ $rc -eq 0 ](/delippi/PhD-globalRadarOSSE/wiki/-$rc--eq-0-) ; then
export end=`expr ${end} + 1`
fi
if [ $iproc -eq $nproc ]; then
export end=$ncount
fi
$WGRIB2 $tmpfile -for ${start}:${end} -grib ${tmpfile}_${iproc}
export err=$?; err_chk
echo "${GFSDWNSH:-$USHgfs/fv3gfs_dwn_nems.sh} ${tmpfile}_${iproc} $fhr3 $iproc $nset" >> $DATA/poescript
# if at final record and have not reached the final processor then write echo's to
# poescript for remaining processors
if [ $end -eq $ncount ](/delippi/PhD-globalRadarOSSE/wiki/-$end--eq-$ncount-) ;then
while [ $iproc -lt $nproc ](/delippi/PhD-globalRadarOSSE/wiki/-$iproc--lt-$nproc-);do
export iproc=`expr $iproc + 1`
echo "/bin/echo $iproc" >> $DATA/poescript
done
break
fi
export iproc=`expr $iproc + 1`
done
date
chmod 775 $DATA/poescript
export MP_PGMMODEL=mpmd
export MP_CMDFILE=$DATA/poescript
launcher=${APRUN_DWN:-"aprun -j 1 -n 24 -N 24 -d 1 cfp"}
if [ $machine = WCOSS_C -o $machine = WCOSS_DELL_P3 ] ; then
$launcher $MP_CMDFILE
else
$launcher
fi
export err=$?
if [ $err -ne 0 ]; then sh +x $DATA/poescript ; fi
date
export iproc=1
while [ $iproc -le $nproc ]; do
if [ $nset = 1 ]; then
#cat pgb2file_${fhr3}_${iproc}_0p25 >> pgb2file_${fhr3}_0p25
cat pgb2file_${fhr3}_${iproc}_0p125 >> pgb2file_${fhr3}_0p125
if [ "$PGBS" = "YES" ]; then
cat pgb2file_${fhr3}_${iproc}_0p5 >> pgb2file_${fhr3}_0p5
cat pgb2file_${fhr3}_${iproc}_1p0 >> pgb2file_${fhr3}_1p0
if [ "$PGB1F" = 'YES' ]; then
cat pgbfile_${fhr3}_${iproc}_1p0 >> pgbfile_${fhr3}_1p0
fi
fi
elif [ $nset = 2 ]; then
#cat pgb2bfile_${fhr3}_${iproc}_0p25 >> pgb2bfile_${fhr3}_0p25
cat pgb2bfile_${fhr3}_${iproc}_0p125 >> pgb2bfile_${fhr3}_0p125
if [ "$PGBS" = "YES" ]; then
cat pgb2bfile_${fhr3}_${iproc}_0p5 >> pgb2bfile_${fhr3}_0p5
cat pgb2bfile_${fhr3}_${iproc}_1p0 >> pgb2bfile_${fhr3}_1p0
fi
fi
export iproc=`expr $iproc + 1`
done
date
#Chuang: generate second land mask using bi-linear interpolation and append to the end
# if [ $nset = 1 ]; then
# rm -f land.grb newland.grb newnewland.grb newnewland.grb1
# $WGRIB2 $tmpfile -match "LAND:surface" -grib land.grb
##0p25 degree
# $WGRIB2 land.grb -set_grib_type same -new_grid_interpolation bilinear -new_grid_winds earth -new_grid $grid0p25 newland.grb
# $WGRIB2 newland.grb -set_byte 4 11 218 -grib newnewland.grb
# cat ./newnewland.grb >> pgb2file_${fhr3}_0p25
# $CNVGRIB -g21 newnewland.grb newnewland.grb1
# cat ./newnewland.grb1 >> pgbfile_${fhr3}_0p25
##0p5 degree
# rm -f newland.grb newnewland.grb newnewland.grb1
# $WGRIB2 land.grb -set_grib_type same -new_grid_interpolation bilinear -new_grid_winds earth -new_grid $grid0p5 newland.grb
# $WGRIB2 newland.grb -set_byte 4 11 218 -grib newnewland.grb
# cat ./newnewland.grb >> pgb2file_${fhr3}_0p5
#1p0
# rm -f newland.grb newnewland.grb newnewland.grb1
# $WGRIB2 land.grb -set_grib_type same -new_grid_interpolation bilinear -new_grid_winds earth -new_grid $grid1p0 newland.grb
# $WGRIB2 newland.grb -set_byte 4 11 218 -grib newnewland.grb
# cat ./newnewland.grb >> pgb2file_${fhr3}_1p0
# $CNVGRIB -g21 newnewland.grb newnewland.grb1
# cat ./newnewland.grb1 >> pgbfile_${fhr3}_1p0
# fi
if [ $nset = 1 ]; then
if [ $fhr3 = anl ]; then
#$WGRIB2 -s pgb2file_${fhr3}_0p25 > $COMOUT/${PREFIX}pgrb2.0p25.anl.idx
$WGRIB2 -s pgb2file_${fhr3}_0p125 > $COMOUT/${PREFIX}pgrb2.0p125.anl.idx
#cp pgb2file_${fhr3}_0p25 $COMOUT/${PREFIX}pgrb2.0p25.anl
cp pgb2file_${fhr3}_0p125 $COMOUT/${PREFIX}pgrb2.0p125.anl
if [ "$PGBS" = "YES" ]; then
$WGRIB2 -s pgb2file_${fhr3}_0p5 > $COMOUT/${PREFIX}pgrb2.0p50.anl.idx
$WGRIB2 -s pgb2file_${fhr3}_1p0 > $COMOUT/${PREFIX}pgrb2.1p00.anl.idx
cp pgb2file_${fhr3}_0p5 $COMOUT/${PREFIX}pgrb2.0p50.anl
cp pgb2file_${fhr3}_1p0 $COMOUT/${PREFIX}pgrb2.1p00.anl
if [ "$PGB1F" = 'YES' ]; then
cp pgbfile_${fhr3}_1p0 $COMOUT/${PREFIX}pgrb.1p00.anl
$GRBINDEX $COMOUT/${PREFIX}pgrb.1p00.anl $COMOUT/${PREFIX}pgrb.1p00.anl.idx
fi
fi
else
#$WGRIB2 -s pgb2file_${fhr3}_0p25 > $COMOUT/${PREFIX}pgrb2.0p25.f${fhr3}.idx
$WGRIB2 -s pgb2file_${fhr3}_0p125 > $COMOUT/${PREFIX}pgrb2.0p125.f${fhr3}.idx
#cp pgb2file_${fhr3}_0p25 $COMOUT/${PREFIX}pgrb2.0p25.f${fhr3}
cp pgb2file_${fhr3}_0p125 $COMOUT/${PREFIX}pgrb2.0p125.f${fhr3}
if [ "$PGBS" = "YES" ]; then
$WGRIB2 -s pgb2file_${fhr3}_0p5 > $COMOUT/${PREFIX}pgrb2.0p50.f${fhr3}.idx
$WGRIB2 -s pgb2file_${fhr3}_1p0 > $COMOUT/${PREFIX}pgrb2.1p00.f${fhr3}.idx
cp pgb2file_${fhr3}_0p5 $COMOUT/${PREFIX}pgrb2.0p50.f${fhr3}
cp pgb2file_${fhr3}_1p0 $COMOUT/${PREFIX}pgrb2.1p00.f${fhr3}
if [ "$PGB1F" = 'YES' ]; then
cp pgbfile_${fhr3}_1p0 $COMOUT/${PREFIX}pgrb.1p00.f${fhr3}
$GRBINDEX $COMOUT/${PREFIX}pgrb.1p00.f${fhr3} $COMOUT/${PREFIX}pgrb.1p00.f${fhr3}.idx
fi
fi
fi
elif [ $nset = 2 ]; then
if [ $fhr3 = anl ]; then
#$WGRIB2 -s pgb2bfile_${fhr3}_0p25 > $COMOUT/${PREFIX}pgrb2b.0p25.anl.idx
$WGRIB2 -s pgb2bfile_${fhr3}_0p125 > $COMOUT/${PREFIX}pgrb2b.0p125.anl.idx
#cp pgb2bfile_${fhr3}_0p25 $COMOUT/${PREFIX}pgrb2b.0p25.anl
cp pgb2bfile_${fhr3}_0p125 $COMOUT/${PREFIX}pgrb2b.0p125.anl
if [ "$PGBS" = "YES" ]; then
$WGRIB2 -s pgb2bfile_${fhr3}_0p5 > $COMOUT/${PREFIX}pgrb2b.0p50.anl.idx
$WGRIB2 -s pgb2bfile_${fhr3}_1p0 > $COMOUT/${PREFIX}pgrb2b.1p00.anl.idx
cp pgb2bfile_${fhr3}_0p5 $COMOUT/${PREFIX}pgrb2b.0p50.anl
cp pgb2bfile_${fhr3}_1p0 $COMOUT/${PREFIX}pgrb2b.1p00.anl
fi
else
#$WGRIB2 -s pgb2bfile_${fhr3}_0p25 > $COMOUT/${PREFIX}pgrb2b.0p25.f${fhr3}.idx
$WGRIB2 -s pgb2bfile_${fhr3}_0p125 > $COMOUT/${PREFIX}pgrb2b.0p125.f${fhr3}.idx
#cp pgb2bfile_${fhr3}_0p25 $COMOUT/${PREFIX}pgrb2b.0p25.f${fhr3}
cp pgb2bfile_${fhr3}_0p125 $COMOUT/${PREFIX}pgrb2b.0p125.f${fhr3}
if [ "$PGBS" = "YES" ]; then
$WGRIB2 -s pgb2bfile_${fhr3}_0p5 > $COMOUT/${PREFIX}pgrb2b.0p50.f${fhr3}.idx
$WGRIB2 -s pgb2bfile_${fhr3}_1p0 > $COMOUT/${PREFIX}pgrb2b.1p00.f${fhr3}.idx
cp pgb2bfile_${fhr3}_0p5 $COMOUT/${PREFIX}pgrb2b.0p50.f${fhr3}
cp pgb2bfile_${fhr3}_1p0 $COMOUT/${PREFIX}pgrb2b.1p00.f${fhr3}
fi
fi
fi
#..............................................
export nset=`expr $nset + 1 `
done
#..............................................
#---------------------------------------------------------------
#---------------------------------------------------------------
# R&D machine has no MPDP. Only generate 0.25 and 1 deg files
else
#---------------------------------------------------------------
#---------------------------------------------------------------
$WGRIB2 tmpfile1_$fhr3 $option1 $option21 $option22 $option23 $option24 \
$option25 $option26 $option27 $option28 \
-new_grid $grid0p125 pgb2file_${fhr3}_0p125 #\
#-new_grid $grid0p25 pgb2file_${fhr3}_0p25 \
#-new_grid $grid0p5 pgb2file_${fhr3}_0p5 \
#-new_grid $grid1p0 pgb2file_${fhr3}_1p0
export err=$?; err_chk
# convert 1 deg files back to Grib1 for verification
if [ "$PGB1F" = 'YES' ]; then
if [ $fhr3 = anl ]; then
$CNVGRIB -g21 pgb2file_${fhr3}_1p0 $COMOUT/${PREFIX}pgrb.1p00.anl
export err=$?; err_chk
$GRBINDEX $COMOUT/${PREFIX}pgrb.1p00.anl $COMOUT/${PREFIX}pgrb.1p00.anl.idx
else
$CNVGRIB -g21 pgb2file_${fhr3}_1p0 $COMOUT/${PREFIX}pgrb.1p00.f${fhr3}
export err=$?; err_chk
$GRBINDEX $COMOUT/${PREFIX}pgrb.1p00.f${fhr3} $COMOUT/${PREFIX}pgrb.1p00.f${fhr3}.idx
fi
fi
if [ $fhr3 = anl ]; then
#$WGRIB2 -s pgb2file_${fhr3}_0p25 > $COMOUT/${PREFIX}pgrb2.0p25.anl.idx
$WGRIB2 -s pgb2file_${fhr3}_0p125 > $COMOUT/${PREFIX}pgrb2.0p125.anl.idx
#cp pgb2file_${fhr3}_0p25 $COMOUT/${PREFIX}pgrb2.0p25.anl
cp pgb2file_${fhr3}_0p125 $COMOUT/${PREFIX}pgrb2.0p125.anl
if [ "$PGBS" = "YES" ]; then
$WGRIB2 -s pgb2file_${fhr3}_1p0 > $COMOUT/${PREFIX}pgrb2.1p00.anl.idx
cp pgb2file_${fhr3}_1p0 $COMOUT/${PREFIX}pgrb2.1p00.anl
fi
else
#$WGRIB2 -s pgb2file_${fhr3}_0p25 > $COMOUT/${PREFIX}pgrb2.0p25.f${fhr3}.idx
$WGRIB2 -s pgb2file_${fhr3}_0p125 > $COMOUT/${PREFIX}pgrb2.0p125.f${fhr3}.idx
#cp pgb2file_${fhr3}_0p25 $COMOUT/${PREFIX}pgrb2.0p25.f${fhr3}
cp pgb2file_${fhr3}_0p125 $COMOUT/${PREFIX}pgrb2.0p125.f${fhr3}
if [ "$PGBS" = "YES" ]; then
$WGRIB2 -s pgb2file_${fhr3}_1p0 > $COMOUT/${PREFIX}pgrb2.1p00.f${fhr3}.idx
cp pgb2file_${fhr3}_1p0 $COMOUT/${PREFIX}pgrb2.1p00.f${fhr3}
fi
fi
#---------------------------------------------------------------
fi
echo "!!!!!!CREATION OF SELECT $RUN DOWNSTREAM PRODUCTS COMPLETED FOR FHR = $FH !!!!!!!"
#---------------------------------------------------------------
exit 0
fv3gfs_dwn_nems.sh
#!/bin/ksh
set -x
echo "Running: $0"
# this script generates 0.25/0.5/1/2.5 deg pgb files for each small Grib file
# Hui-Ya Chuang 01/2014: First Version
# Fanglin Yang 09/2015: Modified to use WGRIB2 instead of COPYGB2 for interpolation
# Fanglin Yang 02/2016: remove 0.5-deg and 2.5deg output to speed up post
# Fanglin Yang 09/11/2017: add option opt24 to turn on bitmap (from Wen Meng)
# Wen Meng 12/2017: add trim_rh.sh for triming RH values larger than 100.
# Wen Meng 01/2018: add flag PGB1F for turning on/off wgrib1 pgb data at 1.00 deg. generation.
# Wen Meng 02/2018: add flag PGBS for turning on/off pgb data at 1.0 and 0.5 deg. generation.
export tmpfile=$1
export fhr3=$2
export iproc=$3
export nset=$4
export CNVGRIB=${CNVGRIB:-$${NWPROD:-/nwprod}/util/exec/cnvgrib21}
export COPYGB2=${COPYGB2:-$${NWPROD:-/nwprod}/util/exec/copygb2}
export WGRIB2=${WGRIB2:-${NWPROD:-/nwprod}/util/exec/wgrib2}
export TRIMRH=${TRIMRH:-$USHgfs/trim_rh.sh}
export opt1=' -set_grib_type same -new_grid_winds earth '
export opt21=' -new_grid_interpolation bilinear -if '
export opt22=":(LAND|CSNOW|CRAIN|CFRZR|CICEP|ICSEV):"
export opt23=' -new_grid_interpolation neighbor -fi '
export opt24=' -set_bitmap 1 -set_grib_max_bits 16 -if '
export opt25=":(APCP|ACPCP|PRATE|CPRAT):"
export opt26=' -set_grib_max_bits 25 -fi -if '
export opt27=":(APCP|ACPCP|PRATE|CPRAT|DZDT):"
export opt28=' -new_grid_interpolation budget -fi '
export grid0p125="latlon 0:2880:0.125 90:1441:-0.125"
export grid0p25="latlon 0:1440:0.25 90:721:-0.25"
export grid0p5="latlon 0:720:0.5 90:361:-0.5"
export grid1p0="latlon 0:360:1.0 90:181:-1.0"
export grid2p5="latlon 0:144:2.5 90:73:-2.5"
export PGB1F=${PGB1F:-"NO"}
export PGBS=${PGBS:-"NO"}
if [ $nset = 1 ]; then
if [ "$PGBS" = "YES" ]; then
$WGRIB2 $tmpfile $opt1 $opt21 $opt22 $opt23 $opt24 $opt25 $opt26 $opt27 $opt28 \
-new_grid $grid0p25 pgb2file_${fhr3}_${iproc}_0p25 \
-new_grid $grid1p0 pgb2file_${fhr3}_${iproc}_1p0 \
-new_grid $grid0p5 pgb2file_${fhr3}_${iproc}_0p5
export err=$?; err_chk
$TRIMRH pgb2file_${fhr3}_${iproc}_0p25
$TRIMRH pgb2file_${fhr3}_${iproc}_0p5
$TRIMRH pgb2file_${fhr3}_${iproc}_1p0
#$CNVGRIB -g21 pgb2file_${fhr3}_${iproc}_0p25 pgbfile_${fhr3}_${iproc}_0p25
if [ "$PGB1F" = 'YES' ]; then
$CNVGRIB -g21 pgb2file_${fhr3}_${iproc}_1p0 pgbfile_${fhr3}_${iproc}_1p0
export err=$?; err_chk
fi
else
$WGRIB2 $tmpfile $opt1 $opt21 $opt22 $opt23 $opt24 $opt25 $opt26 $opt27 $opt28 \
-new_grid $grid0p125 pgb2file_${fhr3}_${iproc}_0p125
#-new_grid $grid0p25 pgb2file_${fhr3}_${iproc}_0p25
export err=$?; err_chk
#$TRIMRH pgb2file_${fhr3}_${iproc}_0p25
$TRIMRH pgb2file_${fhr3}_${iproc}_0p125
fi
elif [ $nset = 2 ]; then
if [ "$PGBS" = "YES" ]; then
$WGRIB2 $tmpfile $opt1 $opt21 $opt22 $opt23 $opt24 $opt25 $opt26 $opt27 $opt28 \
-new_grid $grid0p25 pgb2bfile_${fhr3}_${iproc}_0p25 \
-new_grid $grid1p0 pgb2bfile_${fhr3}_${iproc}_1p0 \
-new_grid $grid0p5 pgb2bfile_${fhr3}_${iproc}_0p5
export err=$?; err_chk
$TRIMRH pgb2bfile_${fhr3}_${iproc}_0p25
$TRIMRH pgb2bfile_${fhr3}_${iproc}_0p5
$TRIMRH pgb2bfile_${fhr3}_${iproc}_1p0
else
$WGRIB2 $tmpfile $opt1 $opt21 $opt22 $opt23 $opt24 $opt25 $opt26 $opt27 $opt28 \
-new_grid $grid0p125 pgb2bfile_${fhr3}_${iproc}_0p125
#-new_grid $grid0p25 pgb2bfile_${fhr3}_${iproc}_0p25
export err=$?; err_chk
$TRIMRH pgb2bfile_${fhr3}_${iproc}_0p125
fi
fi
#----------------------------------------------------------------------------------------------
#--Hui-Ya Chuang
# export grid1p0="0 6 0 0 0 0 0 0 360 181 0 0 90000000 0 48 -90000000 359000000 1000000 1000000 0"
# $COPYGB2 -g "${grid1p0}" -i0 -x tmpfile_${FH}_${iproc} pgb2file_${FH}_${iproc}_1p0
# export grid0p5="0 6 0 0 0 0 0 0 720 361 0 0 90000000 0 48 -90000000 359500000 500000 500000 0"
# $COPYGB2 -g "${grid0p5}" -i0 -x tmpfile_${FH}_${iproc} pgb2file_${FH}_${iproc}_0p5
# export grid2p5="0 6 0 0 0 0 0 0 144 73 0 0 90000000 0 48 -90000000 357500000 2500000 2500000 0"
# $COPYGB2 -g "${grid2p5}" -i0 -x tmpfile_${FH}_${iproc} pgb2file_${FH}_${iproc}_2p5
# $CNVGRIB -g21 pgb2file_${fhr3}_${iproc}_1p0 pgbfile_${fhr3}_${iproc}_1p0
# $CNVGRIB -g21 pgb2file_${fhr3}_${iproc}_2p5 pgbfile_${fhr3}_${iproc}_2p5
#----------------------------------------------------------------------------------------------
exit 0
exgfs_nceppost.sh.ecf
#!/bin/ksh
#####################################################################
echo "-----------------------------------------------------"
echo " exgfs_nceppost.sh.ecf"
echo " Apr 99 - Michaud - Generated to post global forecast"
echo " Mar 03 - Zhu - Add post for 0.5x0.5 degree"
echo " Nov 03 - Gilbert - Modified from exglobal_post.sh.sms"
echo " to run only one master post job."
echo " Jan 07 - Cooke - Add DBNet Alert for Master files"
echo " May 07 - Chuang - Modified scripts to run unified post"
echo " Feb 10 - Carlis - Add 12-hr accum precip bucket at f192"
echo " Jun 12 - Wang - Add option for grb2"
echo " Jul 14 - Carlis - Add 0.25 deg master "
echo " Mar 17 - F Yang - Modified for running fv3gfs"
echo " Aug 17 - Meng - Add flags for turning on/off flx, gtg "
echo " and satellite look like file creation"
echo " and use 3-digit forecast hour naming"
echo " post output files"
echo " Dec 17 - Meng - Link sfc data file to flxfile "
echo " since fv3gfs does not output sfc files any more."
echo " Dec 17 - Meng - Add fv3gfs_downstream_nems.sh for pgb processing "
echo " Jan 18 - Meng - Add flag PGBF for truning on/off pgb processing. "
echo " Jan 18 - Meng - For EE2 standard, move IDRT POSTGPVARS setting"
echo " from j-job script."
echo " Feb 18 - Meng - Removed legacy setting for generating grib1 data"
echo " and reading sigio model outputs."
echo "-----------------------------------------------------"
#####################################################################
set -x
cd $DATA
# specify model output format type: 4 for nemsio, 3 for sigio
msg="HAS BEGUN on `hostname`"
postmsg "$jlogfile" "$msg"
export POSTGPSH=${POSTGPSH:-$USHgfs/gfs_nceppost.sh}
export GFSDOWNSH=${GFSDOWNSH:-$USHgfs/fv3gfs_downstream_nems.sh}
export GFSDWNSH=${GFSDWNSH:-$USHgfs/fv3gfs_dwn_nems.sh}
export TRIMRH=${TRIMRH:-$USHgfs/trim_rh.sh}
############################################################
# Define Variables:
# -----------------
# FH is the current forecast hour.
# SLEEP_TIME is the number of seconds to sleep before exiting with error.
# SLEEP_INT is the number of seconds to sleep between restrt file checks.
# restart_file is the name of the file to key off of to kick off post.
############################################################
#export IO=${LONB:-1440}
#export JO=${LATB:-721}
export IO=${LONB:-2880}
export JO=${LATB:-1441}
export OUTTYP=${OUTTYP:-4}
export FLXF=${FLXF:-"YES"}
export GOESF=${GOESF:-"YES"}
export GTGF=${GTGF:-"YES"}
export PGBF=${PGBF:-"YES"}
export TCYC=${TCYC:-".t${cyc}z."}
export PREFIX=${PREFIX:-${RUN}${TCYC}}
if [ $OUTTYP -eq 4 ] ; then
export SUFFIX=".nemsio"
else
export SUFFIX=
fi
export machine=${machine:-WCOSS_C}
###########################
# Specify Output layers
###########################
export POSTGPVARS="KPO=50,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.,40.,30.,20.,15.,10.,7.,5.,3.,2.,1.,0.4,"
##########################################################
# Specify variable to directly output pgrb2 files for GDAS/GFS
##########################################################
export IDRT=${IDRT:-0} # IDRT=0 is setting for outputting grib files on lat/lon grid
############################################################
# Post Analysis Files before starting the Forecast Post
############################################################
# Process analysis when post_times is 00
export stime=`echo $post_times | cut -c1-3`
if [ $OUTTYP -eq 4 ] ; then
export loganl=$COMIN/${PREFIX}atmanl${SUFFIX}
else
export loganl=$COMIN/${PREFIX}sanl
fi
#----------------------------------
if [ ${stime} = "anl" ]; then
#----------------------------------
if test -f $loganl
then
# add new environmental variables for running new ncep post
# Validation date
export VDATE=${PDY}${cyc}
# specify output file name from chgres which is input file name to nceppost
# if model already runs gfs io, make sure GFSOUT is linked to the gfsio file
# new imported variable for global_nceppost.sh
export GFSOUT=${PREFIX}gfsioanl
# specify smaller control file for GDAS because GDAS does not
# produce flux file, the default will be /nwprod/parm/gfs_cntrl.parm
if [ $GRIBVERSION = 'grib2' ]; then
# use grib2 nomonic table in product g2tmpl directory as default
export POSTGRB2TBL=${POSTGRB2TBL:-${G2TMPL_SRC}/params_grib2_tbl_new}
export PostFlatFile=${PostFlatFile:-$PARMpost/postxconfig-NT-GFS-ANL.txt}
export CTLFILE=$PARMpost/postcntrl_gfs_anl.xml
fi
rm sigfile sfcfile nemsfile
if [ $OUTTYP -eq 4 ] ; then
ln -fs $COMIN/${PREFIX}atmanl${SUFFIX} nemsfile
export NEMSINP=nemsfile
ln -fs $COMIN/${PREFIX}sfcanl${SUFFIX} flxfile
export FLXINP=flxfile
fi
export PGBOUT=pgbfile
export PGIOUT=pgifile
export PGBOUT2=pgbfile.grib2
export PGIOUT2=pgifile.grib2.idx
export IGEN=$IGEN_ANL
export FILTER=1
$POSTGPSH
export err=$?; err_chk
if test $GRIBVERSION = 'grib2'
then
cp $PGBOUT $PGBOUT2
fi
# Process pgb files
if test "$PGBF" = 'YES'
then
export FH=-1
export downset=${downset:-2}
$GFSDOWNSH
export err=$?; err_chk
fi
if test "$SENDCOM" = 'YES'
then
export fhr3=anl
if [ $GRIBVERSION = 'grib2' ]
then
MASTERANL=${PREFIX}master.grb2${fhr3}
MASTERANLIDX=${PREFIX}master.grb2i${fhr3}
cp $PGBOUT2 $COMOUT/${MASTERANL}
$GRB2INDEX $PGBOUT2 $COMOUT/${MASTERANLIDX}
fi
if test "$SENDDBN" = 'YES'
then
$DBNROOT/bin/dbn_alert MODEL GFS_MSC_sfcanl $job $COMOUT/${PREFIX}sfcanl${SUFFIX}
$DBNROOT/bin/dbn_alert MODEL GFS_SA $job $COMOUT/${PREFIX}atmanl${SUFFIX}
#alert removed in v15.0 $DBNROOT/bin/dbn_alert MODEL GFS_MASTER $job $COMOUT/${MASTERANL}
if test "$PGBF" = 'YES'
then
#$DBNROOT/bin/dbn_alert MODEL GFS_PGB2_0P25 $job $COMOUT/${PREFIX}pgrb2.0p25.anl
#$DBNROOT/bin/dbn_alert MODEL GFS_PGB2_0P25_WIDX $job $COMOUT/${PREFIX}pgrb2.0p25.anl.idx
#$DBNROOT/bin/dbn_alert MODEL GFS_PGB2B_0P25 $job $COMOUT/${PREFIX}pgrb2b.0p25.anl
#$DBNROOT/bin/dbn_alert MODEL GFS_PGB2B_0P25_WIDX $job $COMOUT/${PREFIX}pgrb2b.0p25.anl.idx
$DBNROOT/bin/dbn_alert MODEL GFS_PGB2_0P125 $job $COMOUT/${PREFIX}pgrb2.0p125.anl
$DBNROOT/bin/dbn_alert MODEL GFS_PGB2_0P125_WIDX $job $COMOUT/${PREFIX}pgrb2.0p125.anl.idx
$DBNROOT/bin/dbn_alert MODEL GFS_PGB2B_0P125 $job $COMOUT/${PREFIX}pgrb2b.0p125.anl
$DBNROOT/bin/dbn_alert MODEL GFS_PGB2B_0P125_WIDX $job $COMOUT/${PREFIX}pgrb2b.0p125.anl.idx
#$DBNROOT/bin/dbn_alert MODEL GFS_PGB2_0P5 $job $COMOUT/${PREFIX}pgrb2.0p50.anl
#$DBNROOT/bin/dbn_alert MODEL GFS_PGB2_0P5_WIDX $job $COMOUT/${PREFIX}pgrb2.0p50.anl.idx
#$DBNROOT/bin/dbn_alert MODEL GFS_PGB2B_0P5 $job $COMOUT/${PREFIX}pgrb2b.0p50.anl
#$DBNROOT/bin/dbn_alert MODEL GFS_PGB2B_0P5_WIDX $job $COMOUT/${PREFIX}pgrb2b.0p50.anl.idx
#$DBNROOT/bin/dbn_alert MODEL GFS_PGB2_1P0 $job $COMOUT/${PREFIX}pgrb2.1p00.anl
#$DBNROOT/bin/dbn_alert MODEL GFS_PGB2_1P0_WIDX $job $COMOUT/${PREFIX}pgrb2.1p00.anl.idx
#$DBNROOT/bin/dbn_alert MODEL GFS_PGB2B_1P0 $job $COMOUT/${PREFIX}pgrb2b.1p00.anl
#$DBNROOT/bin/dbn_alert MODEL GFS_PGB2B_1P0_WIDX $job $COMOUT/${PREFIX}pgrb2b.1p00.anl.idx
fi
fi
fi
rm pgbfile pgifile pgbfile.grib2 tfile prmsl h5wav
# ecflow_client --event release_pgrb2_anl
fi
#----------------------------------
else ## not_anl if_stime
#----------------------------------
SLEEP_LOOP_MAX=`expr $SLEEP_TIME / $SLEEP_INT`
# Chuang: modify to submit one post job at a time
############################################################
# Loop Through the Post Forecast Files
############################################################
for fhr in $post_times
do
echo 'Start processing fhr='$post_times
###############################
# Start Looping for the
# existence of the restart files
###############################
set -x
export pgm="postcheck"
ic=1
while [ $ic -le $SLEEP_LOOP_MAX ]
do
if test -f $restart_file$fhr$SUFFIX
then
break
else
ic=`expr $ic + 1`
sleep $SLEEP_INT
fi
###############################
# If we reach this point assume
# fcst job never reached restart
# period and error exit
###############################
if [ $ic -eq $SLEEP_LOOP_MAX ]
then
echo " *** FATA ERROR: No model output in nemsio for f${fhr} "
export err=9
err_chk
fi
done
set -x
msg="Starting post for fhr=$fhr"
postmsg "$jlogfile" "$msg"
###############################
# Put restart files into /nwges
# for backup to start Model Fcst
###############################
rm sigfile sfcfile flxfile nemsfile
if [ $OUTTYP -eq 4 ] ; then
ln -fs $COMIN/${PREFIX}atmf${fhr}${SUFFIX} nemsfile
export NEMSINP=nemsfile
ln -fs $COMIN/${PREFIX}sfcf${fhr}${SUFFIX} flxfile
export FLXINP=flxfile
fi
if test $fhr -gt 0
then
export IGEN=$IGEN_FCST
else
export IGEN=$IGEN_ANL
fi
export VDATE=`${NDATE} +${fhr} ${PDY}${cyc}`
export OUTTYP=${OUTTYP:-4}
export GFSOUT=${PREFIX}gfsio${fhr}
if [ $GRIBVERSION = 'grib2' ]; then
export POSTGRB2TBL=${POSTGRB2TBL:-${G2TMPL_SRC}/params_grib2_tbl_new}
export PostFlatFile=${PostFlatFile:-$PARMpost/postxconfig-NT-GFS.txt}
if [ $RUN = gfs ] ; then
export IGEN=$IGEN_GFS
if [ $fhr -gt 0 ] ; then export IGEN=$IGEN_FCST ; fi
else
export IGEN=$IGEN_GDAS_ANL
if [ $fhr -gt 0 ] ; then export IGEN=$IGEN_FCST ; fi
fi
if [ $RUN = gfs ](/delippi/PhD-globalRadarOSSE/wiki/-$RUN-=-gfs-) ; then
if test $fhr -eq 0
then
export PostFlatFile=$PARMpost/postxconfig-NT-GFS-F00.txt
export CTLFILE=$PARMpost/postcntrl_gfs_f00.xml
else
export CTLFILE=${CTLFILEGFS:-$PARMpost/postcntrl_gfs.xml}
fi
else
if test $fhr -eq 0
then
export PostFlatFile=$PARMpost/postxconfig-NT-GFS-F00.txt
export CTLFILE=${CTLFILEGFS:-$PARMpost/postcntrl_gfs_f00.xml}
else
export CTLFILE=${CTLFILEGFS:-$PARMpost/postcntrl_gfs.xml}
fi
fi
# export CTL=`basename $CTLFILE1`
fi
export FLXIOUT=flxifile
export PGBOUT=pgbfile
export PGIOUT=pgifile
export PGBOUT2=pgbfile.grib2
export PGIOUT2=pgifile.grib2.idx
export FILTER=1
$POSTGPSH
export err=$?; err_chk
if test $GRIBVERSION = 'grib2'
then
cp $PGBOUT $PGBOUT2
fi
# Process pgb files
if test "$PGBF" = 'YES'
then
export FH=`expr $fhr + 0`
export downset=${downset:-2}
$GFSDOWNSH
export err=$?; err_chk
fi
if [ $GRIBVERSION = 'grib2' ]; then
MASTERFL=${PREFIX}master.grb2f${fhr}
MASTERFLIDX=${PREFIX}master.grb2if${fhr}
fi
if test $SENDCOM = "YES"
then
# echo "$PDY$cyc$pad$fhr" > $COMOUT/${RUN}.t${cyc}z.master.control
if [ $GRIBVERSION = 'grib2' ] ; then
cp $PGBOUT2 $COMOUT/${MASTERFL}
$GRB2INDEX $PGBOUT2 $COMOUT/${MASTERFLIDX}
fi
if test "$SENDDBN" = 'YES'
then
if [ $GRIBVERSION = 'grib2' ] ; then
#alert removed in v15.0 $DBNROOT/bin/dbn_alert MODEL GFS_MASTER $job $COMOUT/${MASTERFL}
if test "$PGBF" = 'YES'
then
#$DBNROOT/bin/dbn_alert MODEL GFS_PGB2_0P25 $job $COMOUT/${PREFIX}pgrb2.0p25.f${fhr}
#$DBNROOT/bin/dbn_alert MODEL GFS_PGB2_0P25_WIDX $job $COMOUT/${PREFIX}pgrb2.0p25.f${fhr}.idx
#$DBNROOT/bin/dbn_alert MODEL GFS_PGB2B_0P25 $job $COMOUT/${PREFIX}pgrb2b.0p25.f${fhr}
#$DBNROOT/bin/dbn_alert MODEL GFS_PGB2B_0P25_WIDX $job $COMOUT/${PREFIX}pgrb2b.0p25.f${fhr}.idx
$DBNROOT/bin/dbn_alert MODEL GFS_PGB2_0P125 $job $COMOUT/${PREFIX}pgrb2.0p125.f${fhr}
$DBNROOT/bin/dbn_alert MODEL GFS_PGB2_0P125_WIDX $job $COMOUT/${PREFIX}pgrb2.0p125.f${fhr}.idx
$DBNROOT/bin/dbn_alert MODEL GFS_PGB2B_0P125 $job $COMOUT/${PREFIX}pgrb2b.0p125.f${fhr}
$DBNROOT/bin/dbn_alert MODEL GFS_PGB2B_0P125_WIDX $job $COMOUT/${PREFIX}pgrb2b.0p125.f${fhr}.idx
if [ -s $COMOUT/${PREFIX}pgrb2.0p50.f${fhr} ] ; then
$DBNROOT/bin/dbn_alert MODEL GFS_PGB2_0P5 $job $COMOUT/${PREFIX}pgrb2.0p50.f${fhr}
$DBNROOT/bin/dbn_alert MODEL GFS_PGB2_0P5_WIDX $job $COMOUT/${PREFIX}pgrb2.0p50.f${fhr}.idx
$DBNROOT/bin/dbn_alert MODEL GFS_PGB2B_0P5 $job $COMOUT/${PREFIX}pgrb2b.0p50.f${fhr}
$DBNROOT/bin/dbn_alert MODEL GFS_PGB2B_0P5_WIDX $job $COMOUT/${PREFIX}pgrb2b.0p50.f${fhr}.idx
fi
if [ -s $COMOUT/${PREFIX}pgrb2.1p00.f${fhr} ] ; then
$DBNROOT/bin/dbn_alert MODEL GFS_PGB2_1P0 $job $COMOUT/${PREFIX}pgrb2.1p00.f${fhr}
$DBNROOT/bin/dbn_alert MODEL GFS_PGB2_1P0_WIDX $job $COMOUT/${PREFIX}pgrb2.1p00.f${fhr}.idx
$DBNROOT/bin/dbn_alert MODEL GFS_PGB2B_1P0 $job $COMOUT/${PREFIX}pgrb2b.1p00.f${fhr}
$DBNROOT/bin/dbn_alert MODEL GFS_PGB2B_1P0_WIDX $job $COMOUT/${PREFIX}pgrb2b.1p00.f${fhr}.idx
fi
fi
fi
fi
# x3=`expr $fhr % 3`
# x3=0 ---> Standard 3-hourly or 12-hourly output
# Only master grib files are needed for the hourly files
# if [ $x3 -eq 0 ] ; then
export fhr
$USHgfs/gfs_transfer.sh
# fi
fi
rm pgbfile* pgifile* tfile prmsl h5wav
# use post to generate GFS Grib2 Flux file as model generated Flux file
# will be in nemsio format after FY17 upgrade.
if [ $OUTTYP -eq 4 -a $FLXF = "YES" ] ; then
if test $fhr -eq 0
then
export PostFlatFile=$PARMpost/postxconfig-NT-GFS-FLUX-F00.txt
export CTLFILE=$PARMpost/postcntrl_gfs_flux_f00.xml
else
export PostFlatFile=$PARMpost/postxconfig-NT-GFS-FLUX.txt
export CTLFILE=$PARMpost/postcntrl_gfs_flux.xml
fi
export PGBOUT=fluxfile
export FILTER=0
$POSTGPSH
export err=$?; err_chk
FLUXFL=${PREFIX}sfluxgrbf${fhr}.grib2
FLUXFLIDX=${PREFIX}sfluxgrbf${fhr}.grib2.idx
mv fluxfile $COMOUT/${FLUXFL}
$WGRIB2 -s $COMOUT/${FLUXFL} > $COMOUT/${FLUXFLIDX}
if test "$SENDDBN" = 'YES'
then
$DBNROOT/bin/dbn_alert MODEL GFS_SGB_GB2 $job $COMOUT/${FLUXFL}
$DBNROOT/bin/dbn_alert MODEL GFS_SGB_GB2_WIDX $job $COMOUT/${FLUXFLIDX}
fi
fi
# process satellite look alike separately so that master pgb gets out in time
# set outtyp to 2 because master post already generates gfs io files
if [ $GOESF = "YES" ]; then
export OUTTYP=${OUTTYP:-4}
# specify output file name from chgres which is input file name to nceppost
# if model already runs gfs io, make sure GFSOUT is linked to the gfsio file
# new imported variable for global_nceppost.sh
export GFSOUT=${PREFIX}gfsio${fhr}
# link satellite coefficients files, use hwrf version as ops crtm 2.0.5
# does not new coefficient files used by post
export FIXCRTM=${FIXCRTM:-${CRTM_FIX}}
$USHgfs/link_crtm_fix.sh $FIXCRTM
if [ $GRIBVERSION = 'grib2' ] ; then
export PostFlatFile=$PARMpost/postxconfig-NT-GFS-GOES.txt
export CTLFILE=$PARMpost/postcntrl_gfs_goes.xml
fi
export FLXINP=flxfile
export FLXIOUT=flxifile
export PGBOUT=goesfile
export PGIOUT=goesifile
export FILTER=0
export IO=0
export JO=0
export IGEN=0
if [ $NET = gfs ]; then
$POSTGPSH
export err=$?; err_chk
fi
if [ $GRIBVERSION = 'grib2' ]; then
SPECIALFL=${PREFIX}special.grb2
SPECIALFLIDX=${PREFIX}special.grb2i
fi
fhr3=$fhr
if test $SENDCOM = "YES"
then
# echo "$PDY$cyc$pad$fhr" > $COMOUT/${RUN}.t${cyc}z.master.control
mv goesfile $COMOUT/${SPECIALFL}f$fhr
mv goesifile $COMOUT/${SPECIALFLIDX}f$fhr
fi
# rm flxfile flxifile goesfile goesifile
rm flxifile goesfile goesifile
fi
# end of satellite processing
########################## GTG start ##########################
# process gtg turbulence separately so that master pgb and
# satellite look alike gets out in time.
# process gtg turbulence only when fhr is every 3 hour between [3, 36]
if [ $fhr -ge 3 && $fhr -le 36 && $((fhr%3)) -eq 0 && $GTGF = "YES" ](/delippi/PhD-globalRadarOSSE/wiki/-$fhr--ge-3--&&--$fhr--le-36--&&-$((fhr%3))--eq-0-&&-$GTGF-=-"YES"-) ; then
export OUTTYP=${OUTTYP:-4}
# specify output file name from chgres which is input file name to nceppost
# if model already runs gfs io, make sure GFSOUT is linked to the gfsio file
# new imported variable for global_nceppost.sh
export GFSOUT=${PREFIX}gfsio${fhr}
# gtg has its own configurations
cp $PARMpost/gtg.config.gfs gtg.config
if [ $RUN = gfs && $GRIBVERSION = 'grib2' ](/delippi/PhD-globalRadarOSSE/wiki/-$RUN-=-gfs-&&-$GRIBVERSION-=-'grib2'-) ; then
export PostFlatFile=$PARMpost/postxconfig-NT-GFS-GTG.txt
export CTLFILE=${CTLFILEGTG:-$PARMpost/postcntrl_gfs_gtg.xml}
export FLXIOUT=flxifile
export PGBOUT=gtgfile
export PGIOUT=gtgifile
export FILTER=0
export IGEN=$IGEN_GFS
$POSTGPSH
export err=$?; err_chk
SPECIALFL=${PREFIX}gtg.grb2
SPECIALFLIDX=${PREFIX}gtg.grb2i
if test $SENDCOM = "YES"
then
cp $PGBOUT $COMOUT/${SPECIALFL}f$fhr
cp $PGIOUT $COMOUT/${SPECIALFLIDX}f$fhr
if [ $SENDDBN = YES ]; then
$DBNROOT/bin/dbn_alert MODEL GFS_GTG_GB2 $job $COMOUT/${SPECIALFL}f$fhr
fi
fi
else
echo 'Warning!!!! GTG is NOT generated!!! Currently GTG only supports GFS and grib2.'
fi
else
echo 'Warning!!!! GTG is NOT generated!!! Currently GTG forecast hour is every 3 hour between [3, 36].'
fi # $fhr [3, 36]
########################### GTG end ###########################
rm flxfile flxifile gtgfile gtgifile
# end of gtg turbulence processing
done
#----------------------------------
fi ## end_if_stime
#----------------------------------
#cat $pgmout
#msg='ENDED NORMALLY.'
#postmsg "$jlogfile" "$msg"
exit 0
################## END OF SCRIPT #######################