From ba6c6f233278295d0fa5cb3ace2e188af8fe2678 Mon Sep 17 00:00:00 2001 From: "Walter.Kolczynski" Date: Wed, 4 May 2022 16:03:34 +0000 Subject: [PATCH] Update formatting and style for new post scripts Some of the new post scripts that were brought over from UPP had irregular indentation and style. These were updated to have proper indentation and style more like we're trying to use in global-workflow. This includes updating heredocs to use <<- instead of << to allow proper indentation, a change that we plan on making elsewhere but haven't gotten to yet. Refs: #769 --- scripts/exgdas_atmos_nceppost.sh | 313 ++++++++++++++---------------- scripts/exglobal_atmos_pmgr.sh | 58 +++--- ush/fv3gfs_dwn_nems.sh | 96 ++++----- ush/gfs_nceppost.sh | 187 +++++++++--------- ush/gfs_transfer.sh | 10 +- ush/global_nceppost.sh | 323 +++++++++++++++---------------- ush/link_crtm_fix.sh | 24 +-- 7 files changed, 475 insertions(+), 536 deletions(-) diff --git a/scripts/exgdas_atmos_nceppost.sh b/scripts/exgdas_atmos_nceppost.sh index ed2571647b..8616b35453 100755 --- a/scripts/exgdas_atmos_nceppost.sh +++ b/scripts/exgdas_atmos_nceppost.sh @@ -80,124 +80,107 @@ export IDRT=${IDRT:-0} # IDRT=0 is setting for outputting grib files on lat/lon # Chuang: modify to 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} + export loganl=$COMIN/${PREFIX}atmanl${SUFFIX} else - export loganl=$COMIN/${PREFIX}sanl + 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} - -# set outtyp to 1 because we need to run chgres in the post before model start running chgres -# otherwise set to 0, then chgres will not be executed in global_nceppost.sh - - 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=${RUN}.${cycle}.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 - export POSTGRB2TBL=${POSTGRB2TBL:-${g2tmpl_ROOT}/share/params_grib2_tbl_new} - export PostFlatFile=${PostFlatFile:-$PARMpost/postxconfig-NT-GFS-ANL.txt} - export CTLFILE=$PARMpost/postcntrl_gfs_anl.xml - fi - - [[ -f flxfile ]] && rm flxfile ; [[ -f nemsfile ]] && rm nemsfile - if [ $OUTTYP -eq 4 ] ; then + if [ -f $loganl ]; then + # add new environmental variables for running new ncep post + # Validation date + + export VDATE=${PDY}${cyc} + + # set outtyp to 1 because we need to run chgres in the post before model start running chgres + # otherwise set to 0, then chgres will not be executed in global_nceppost.sh + + 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=${RUN}.${cycle}.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 + export POSTGRB2TBL=${POSTGRB2TBL:-${g2tmpl_ROOT}/share/params_grib2_tbl_new} + export PostFlatFile=${PostFlatFile:-$PARMpost/postxconfig-NT-GFS-ANL.txt} + export CTLFILE=$PARMpost/postcntrl_gfs_anl.xml + fi + + [[ -f flxfile ]] && rm flxfile ; [[ -f nemsfile ]] && rm 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=0 - - #specify fhr even for analysis because postgp uses it -# export fhr=00 - - $POSTGPSH - export err=$?; err_chk - - - if test $GRIBVERSION = 'grib2' - then - mv $PGBOUT $PGBOUT2 - -#Proces pgb files - export FH=-1 - export downset=${downset:-1} - $GFSDOWNSH - export err=$?; err_chk - - export fhr3=anl - - fi - - if test $SENDCOM = 'YES' - then - export fhr3=anl - if [ $GRIBVERSION = 'grib2' ] - then - MASTERANL=${PREFIX}master.grb2${fhr3} -##########XXW Accord to Boi, fortran index should use *if${fhr}, wgrib index use .idx - #MASTERANLIDX=${RUN}.${cycle}.master.grb2${fhr3}.idx - MASTERANLIDX=${PREFIX}master.grb2i${fhr3} - cp $PGBOUT2 $COMOUT/${MASTERANL} - $GRB2INDEX $PGBOUT2 $COMOUT/${MASTERANLIDX} - fi - - if test $SENDDBN = 'YES' - then + fi + export PGBOUT=pgbfile + export PGIOUT=pgifile + export PGBOUT2=pgbfile.grib2 + export PGIOUT2=pgifile.grib2.idx + export IGEN=$IGEN_ANL + export FILTER=0 + + # specify fhr even for analysis because postgp uses it + # export fhr=00 + + $POSTGPSH + export err=$?; err_chk + + + if [ $GRIBVERSION = 'grib2' ]; then + mv $PGBOUT $PGBOUT2 + + #Proces pgb files + export FH=-1 + export downset=${downset:-1} + $GFSDOWNSH + export err=$?; err_chk + + export fhr3=anl + fi + + if [ $SENDCOM = 'YES' ]; then + export fhr3=anl + if [ $GRIBVERSION = 'grib2' ]; then + MASTERANL=${PREFIX}master.grb2${fhr3} + ##########XXW Accord to Boi, fortran index should use *if${fhr}, wgrib index use .idx + #MASTERANLIDX=${RUN}.${cycle}.master.grb2${fhr3}.idx + MASTERANLIDX=${PREFIX}master.grb2i${fhr3} + cp $PGBOUT2 $COMOUT/${MASTERANL} + $GRB2INDEX $PGBOUT2 $COMOUT/${MASTERANLIDX} + fi + + if [ $SENDDBN = 'YES' ]; then run=$(echo $RUN | tr '[a-z]' '[A-Z]') - if [ $GRIBVERSION = 'grib2' ] - then - $DBNROOT/bin/dbn_alert MODEL ${run}_MSC_sfcanl $job $COMOUT/${PREFIX}sfc${fhr3}${SUFFIX} + if [ $GRIBVERSION = 'grib2' ]; then + $DBNROOT/bin/dbn_alert MODEL ${run}_MSC_sfcanl $job $COMOUT/${PREFIX}sfc${fhr3}${SUFFIX} $DBNROOT/bin/dbn_alert MODEL ${run}_SA $job $COMIN/${PREFIX}atm${fhr3}${SUFFIX} $DBNROOT/bin/dbn_alert MODEL GDAS_PGA_GB2 $job $COMOUT/${PREFIX}pgrb2.1p00.${fhr3} $DBNROOT/bin/dbn_alert MODEL GDAS_PGA_GB2_WIDX $job $COMOUT/${PREFIX}pgrb2.1p00.${fhr3}.idx - fi + fi fi + fi + rm pgbfile.grib2 + else + #### atmanl file not found need failing job + echo " *** FATAL ERROR: No model anl file output " + export err=9 + err_chk + fi +else ## not_anl if_stimes + SLEEP_LOOP_MAX=$(expr $SLEEP_TIME / $SLEEP_INT) - fi - rm pgbfile.grib2 -else - #### atmanl file not found need failing job - echo " *** FATAL ERROR: No model anl file output " - export err=9 - err_chk -fi - -#---------------------------------- -else ## not_anl if_stimes -#---------------------------------- - -SLEEP_LOOP_MAX=$(expr $SLEEP_TIME / $SLEEP_INT) - -############################################################ -# Loop Through the Post Forecast Files -############################################################ + ############################################################ + # Loop Through the Post Forecast Files + ############################################################ -for fhr in $post_times -do + for fhr in $post_times; do ############################### # Start Looping for the # existence of the restart files @@ -205,26 +188,23 @@ do set -x export pgm="postcheck" ic=1 - while [ $ic -le $SLEEP_LOOP_MAX ] - do - if test -f ${restart_file}${fhr}.txt - 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 " *** FATAL ERROR: No model output in nemsio for f${fhr} " - export err=9 - err_chk - fi + while [ $ic -le $SLEEP_LOOP_MAX ]; do + if [ -f ${restart_file}${fhr}.txt ]; 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 " *** FATAL ERROR: No model output in nemsio for f${fhr} " + export err=9 + err_chk + fi done set -x @@ -235,7 +215,8 @@ do # Put restart files into /nwges # for backup to start Model Fcst ############################### - [[ -f flxfile ]] && rm flxfile ; [[ -f nemsfile ]] && rm nemsfile + [[ -f flxfile ]] && rm flxfile + [[ -f nemsfile ]] && rm nemsfile if [ $OUTTYP -eq 4 ] ; then ln -sf $COMIN/${PREFIX}atmf$fhr${SUFFIX} nemsfile export NEMSINP=nemsfile @@ -243,43 +224,40 @@ do export FLXINP=flxfile fi - if test $fhr -gt 0 - then - export IGEN=$IGEN_FCST + if [ $fhr -gt 0 ]; then + export IGEN=$IGEN_FCST else - export IGEN=$IGEN_ANL + export IGEN=$IGEN_ANL fi - -# add new environmental variables for running new ncep post -# Validation date + + # add new environmental variables for running new ncep post + # Validation date export VDATE=$(${NDATE} +${fhr} ${PDY}${cyc}) - -# set to 3 to output lat/lon grid - + + # set to 3 to output lat/lon grid + export OUTTYP=${OUTTYP:-4} - if [ $GRIBVERSION = 'grib2' ] ; then + if [ $GRIBVERSION = 'grib2' ]; then export POSTGRB2TBL=${POSTGRB2TBL:-${g2tmpl_ROOT}/share/params_grib2_tbl_new} export PostFlatFile=$PARMpost/postxconfig-NT-GFS.txt - if [ $RUN = gfs ] ; then + if [ $RUN = gfs ]; then export IGEN=$IGEN_GFS - if [ $fhr -gt 0 ] ; then export IGEN=$IGEN_FCST ; fi + 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 + if [ $fhr -gt 0 ]; then export IGEN=$IGEN_FCST ; fi fi - if [[ $RUN = gfs ]] ; then - if test $fhr -eq 0 - then + if [[ $RUN = gfs ]]; then + if [ $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 + if [ $fhr -eq 0 ]; then export PostFlatFile=$PARMpost/postxconfig-NT-GFS-F00.txt export CTLFILE=${CTLFILEGFS:-$PARMpost/postcntrl_gfs_f00.xml} else @@ -287,7 +265,7 @@ do fi fi fi - + export FLXIOUT=flxifile export PGBOUT=pgbfile export PGIOUT=pgifile @@ -295,12 +273,10 @@ do export PGIOUT2=pgifile.grib2.idx export FILTER=0 export fhr3=$fhr - if [ $GRIBVERSION = 'grib2' ] - then + if [ $GRIBVERSION = 'grib2' ]; then MASTERFHR=${PREFIX}master.grb2f${fhr} MASTERFHRIDX=${PREFIX}master.grb2if${fhr} fi - if [ $INLINE_POST = ".false." ]; then $POSTGPSH @@ -309,9 +285,7 @@ do fi export err=$?; err_chk - - if test $GRIBVERSION = 'grib2' - then + if [ $GRIBVERSION = 'grib2' ]; then mv $PGBOUT $PGBOUT2 fi @@ -321,7 +295,6 @@ do $GFSDOWNSH export err=$?; err_chk - if [ $SENDDBN = YES ]; then run=$(echo $RUN | tr '[a-z]' '[A-Z]') $DBNROOT/bin/dbn_alert MODEL ${run}_PGB2_0P25 $job $COMOUT/${PREFIX}pgrb2.0p25.f${fhr} @@ -329,10 +302,9 @@ do $DBNROOT/bin/dbn_alert MODEL ${run}_PGB_GB2 $job $COMOUT/${PREFIX}pgrb2.1p00.f${fhr} $DBNROOT/bin/dbn_alert MODEL ${run}_PGB_GB2_WIDX $job $COMOUT/${PREFIX}pgrb2.1p00.f${fhr}.idx fi - - - if test $SENDCOM = 'YES' - then + + + if [ $SENDCOM = 'YES' ]; then if [ $GRIBVERSION = 'grib2' ] ; then if [ $INLINE_POST = ".false." ]; then cp $PGBOUT2 $COMOUT/${MASTERFHR} @@ -340,19 +312,18 @@ do $GRB2INDEX $PGBOUT2 $COMOUT/${MASTERFHRIDX} fi -# Model generated flux files will be in nemsio after FY17 upgrade -# use post to generate Grib2 flux files + # Model generated flux files will be in nemsio after FY17 upgrade + # use post to generate Grib2 flux files if [ $OUTTYP -eq 4 ] ; then export NEMSINP=$COMIN/${PREFIX}atmf${fhr}${SUFFIX} export FLXINP=$COMIN/${PREFIX}sfcf${fhr}${SUFFIX} - if test $fhr -eq 0 - then - export PostFlatFile=$PARMpost/postxconfig-NT-GFS-FLUX-F00.txt - export CTLFILE=$PARMpost/postcntrl_gfs_flux_f00.xml + if [ $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 + export PostFlatFile=$PARMpost/postxconfig-NT-GFS-FLUX.txt + export CTLFILE=$PARMpost/postcntrl_gfs_flux.xml fi export PGBOUT=fluxfile export FILTER=0 @@ -361,14 +332,13 @@ do if [ $INLINE_POST = ".false." ]; then $POSTGPSH - export err=$?; err_chk + export err=$?; err_chk mv fluxfile $COMOUT/${FLUXFL} fi $WGRIB2 -s $COMOUT/${FLUXFL} > $COMOUT/${FLUXFLIDX} fi - if test "$SENDDBN" = 'YES' -a \( "$RUN" = 'gdas' \) -a $(expr $fhr % 3) -eq 0 - then + if [ "$SENDDBN" = 'YES' -a \( "$RUN" = 'gdas' \) -a $(expr $fhr % 3) -eq 0 ]; then $DBNROOT/bin/dbn_alert MODEL ${run}_SF $job $COMOUT/${PREFIX}atmf${fhr}${SUFFIX} $DBNROOT/bin/dbn_alert MODEL ${run}_BF $job $COMOUT/${PREFIX}sfcf${fhr}${SUFFIX} $DBNROOT/bin/dbn_alert MODEL ${run}_SGB_GB2 $job $COMOUT/${PREFIX}sfluxgrbf${fhr}.grib2 @@ -376,13 +346,10 @@ do fi fi - [[ -f pgbfile.grib2 ]] && rm pgbfile.grib2 ; [[ -f flxfile ]] && rm flxfile - -done - -#---------------------------------- -fi ## end_if_times -#---------------------------------- + [[ -f pgbfile.grib2 ]] && rm pgbfile.grib2 + [[ -f flxfile ]] && rm flxfile + done +fi ## end_if_times #cat $pgmout #msg='ENDED NORMALLY.' diff --git a/scripts/exglobal_atmos_pmgr.sh b/scripts/exglobal_atmos_pmgr.sh index 67f25c8f32..1a00eda1a6 100755 --- a/scripts/exglobal_atmos_pmgr.sh +++ b/scripts/exglobal_atmos_pmgr.sh @@ -10,28 +10,29 @@ hour=00 typeset -Z2 hour case $RUN in - gfs) TEND=384 - TCP=385;; - gdas) TEND=9 - TCP=10;; + gfs) + TEND=384 + TCP=385 + ;; + gdas) + TEND=9 + TCP=10 + ;; esac if [ -e posthours ]; then - rm -f posthours + rm -f posthours fi -while [ $hour -lt $TCP ]; -do +while [ $hour -lt $TCP ]; do echo $hour >>posthours - if [ $hour -lt 120 ] - then - if [ $hour -eq 99 ] - then - typeset -Z3 hour - fi - let "hour=hour+1" + if [ $hour -lt 120 ]; then + if [ $hour -eq 99 ]; then + typeset -Z3 hour + fi + let "hour=hour+1" else - let "hour=hour+3" + let "hour=hour+3" fi done postjobs=$(cat posthours) @@ -40,39 +41,32 @@ postjobs=$(cat posthours) # Wait for all fcst hours to finish # icnt=1 -while [ $icnt -lt 1000 ] -do - for fhr in $postjobs - do +while [ $icnt -lt 1000 ]; do + for fhr in $postjobs; do fhr3=$(printf "%03d" $fhr) - if [ -s ${COMIN}/${RUN}.${cycle}.logf${fhr}.txt -o -s ${COMIN}/${RUN}.${cycle}.logf${fhr3}.txt ] - then - if [ $fhr -eq 0 ] - then -#### ecflow_client --event release_${RUN}_postanl + if [ -s ${COMIN}/${RUN}.${cycle}.logf${fhr}.txt -o -s ${COMIN}/${RUN}.${cycle}.logf${fhr3}.txt ]; then + if [ $fhr -eq 0 ]; then + #### ecflow_client --event release_${RUN}_postanl ecflow_client --event release_postanl fi -#### ecflow_client --event release_${RUN}_post${fhr} + #### ecflow_client --event release_${RUN}_post${fhr} ecflow_client --event release_post${fhr3} # Remove current fhr from list postjobs=$(echo $postjobs | sed "s/${fhr}//") fi done - + result_check=$(echo $postjobs | wc -w) - if [ $result_check -eq 0 ] - then - break + if [ $result_check -eq 0 ]; then + break fi sleep 10 icnt=$((icnt + 1)) - if [ $icnt -ge 1080 ] - then + if [ $icnt -ge 1080 ]; then msg="ABORTING after 3 hours of waiting for ${RUN} FCST hours $postjobs." err_exit $msg fi - done echo Exiting $0 diff --git a/ush/fv3gfs_dwn_nems.sh b/ush/fv3gfs_dwn_nems.sh index 7797c447b8..b49daee45c 100755 --- a/ush/fv3gfs_dwn_nems.sh +++ b/ush/fv3gfs_dwn_nems.sh @@ -33,7 +33,7 @@ export opt26=' -set_grib_max_bits 25 -fi -if ' export opt27=":(APCP|ACPCP|PRATE|CPRAT|DZDT):" export opt28=' -new_grid_interpolation budget -fi ' if [ $machine = "S4" ]; then - export optncpu=' -ncpu 1 ' + export optncpu=' -ncpu 1 ' fi export grid0p25="latlon 0:1440:0.25 90:721:-0.25" export grid0p5="latlon 0:720:0.5 90:361:-0.5" @@ -44,54 +44,54 @@ export PGB1F=${PGB1F:-"NO"} export PGBS=${PGBS:-"NO"} if [ $nset = 1 ]; then - if [ "$PGBS" = "YES" ]; then - $WGRIB2 $optncpu $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 - #tweak sea ice cover - count=$($WGRIB2 $optncpu pgb2file_${fhr3}_${iproc}_0p25 -match "LAND|ICEC" |wc -l) - if [ $count -eq 2 ]; then - $MODICEC pgb2file_${fhr3}_${iproc}_0p25 - $MODICEC pgb2file_${fhr3}_${iproc}_0p5 - $MODICEC pgb2file_${fhr3}_${iproc}_1p0 - fi - #$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 $optncpu $tmpfile $opt1 $opt21 $opt22 $opt23 $opt24 $opt25 $opt26 $opt27 $opt28 \ - -new_grid $grid0p25 pgb2file_${fhr3}_${iproc}_0p25 - export err=$?; err_chk - $TRIMRH pgb2file_${fhr3}_${iproc}_0p25 - #tweak sea ice cover - count=$($WGRIB2 $optncpu pgb2file_${fhr3}_${iproc}_0p25 -match "LAND|ICEC" |wc -l) - if [ $count -eq 2 ]; then - $MODICEC pgb2file_${fhr3}_${iproc}_0p25 - fi - fi + if [ "$PGBS" = "YES" ]; then + $WGRIB2 $optncpu $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 + #tweak sea ice cover + count=$($WGRIB2 $optncpu pgb2file_${fhr3}_${iproc}_0p25 -match "LAND|ICEC" |wc -l) + if [ $count -eq 2 ]; then + $MODICEC pgb2file_${fhr3}_${iproc}_0p25 + $MODICEC pgb2file_${fhr3}_${iproc}_0p5 + $MODICEC pgb2file_${fhr3}_${iproc}_1p0 + fi + #$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 $optncpu $tmpfile $opt1 $opt21 $opt22 $opt23 $opt24 $opt25 $opt26 $opt27 $opt28 \ + -new_grid $grid0p25 pgb2file_${fhr3}_${iproc}_0p25 + export err=$?; err_chk + $TRIMRH pgb2file_${fhr3}_${iproc}_0p25 + #tweak sea ice cover + count=$($WGRIB2 $optncpu pgb2file_${fhr3}_${iproc}_0p25 -match "LAND|ICEC" |wc -l) + if [ $count -eq 2 ]; then + $MODICEC pgb2file_${fhr3}_${iproc}_0p25 + fi + fi elif [ $nset = 2 ]; then - if [ "$PGBS" = "YES" ]; then - $WGRIB2 $optncpu $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 $optncpu $tmpfile $opt1 $opt21 $opt22 $opt23 $opt24 $opt25 $opt26 $opt27 $opt28 \ - -new_grid $grid0p25 pgb2bfile_${fhr3}_${iproc}_0p25 - export err=$?; err_chk - $TRIMRH pgb2bfile_${fhr3}_${iproc}_0p25 - fi + if [ "$PGBS" = "YES" ]; then + $WGRIB2 $optncpu $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 $optncpu $tmpfile $opt1 $opt21 $opt22 $opt23 $opt24 $opt25 $opt26 $opt27 $opt28 \ + -new_grid $grid0p25 pgb2bfile_${fhr3}_${iproc}_0p25 + export err=$?; err_chk + $TRIMRH pgb2bfile_${fhr3}_${iproc}_0p25 + fi fi #---------------------------------------------------------------------------------------------- diff --git a/ush/gfs_nceppost.sh b/ush/gfs_nceppost.sh index 8a7f7d54f0..6c75572d10 100755 --- a/ush/gfs_nceppost.sh +++ b/ush/gfs_nceppost.sh @@ -188,10 +188,9 @@ ################################################################################ # Set environment. export VERBOSE=${VERBOSE:-"NO"} -if [[ "$VERBOSE" = "YES" ]] -then - echo $(date) EXECUTING $0 $* >&2 - set -x +if [[ "$VERBOSE" = "YES" ]]; then + echo $(date) EXECUTING $0 $* >&2 + set -x fi # Command line arguments. export SIGINP=${1:-${SIGINP}} @@ -253,10 +252,10 @@ export APRUN=${APRUNP:-${APRUN:-""}} # exit if NEMSINP does not exist if [ ${OUTTYP} -eq 4 ] ; then - if [ ! -s $NEMSINP -o ! -s $FLXINP ] ; then - echo "model files not found, exitting" - exit 111 - fi + if [ ! -s $NEMSINP -o ! -s $FLXINP ] ; then + echo "model files not found, exitting" + exit 111 + fi fi export SIGHDR=${SIGHDR:-$NWPROD/exec/global_sighdr} @@ -264,14 +263,14 @@ export IDRT=${IDRT:-4} # run post to read nemsio file if OUTTYP=4 if [ ${OUTTYP} -eq 4 ] ; then - if [ ${OUTPUT_FILE} = "netcdf" ]; then - export MODEL_OUT_FORM=${MODEL_OUT_FORM:-netcdfpara} - elif [ ${OUTPUT_FILE} = "nemsio" ]; then - export MODEL_OUT_FORM=${MODEL_OUT_FORM:-binarynemsiompiio} - else - export MODEL_OUT_FORM=${MODEL_OUT_FORM:-binarynemsiompiio} - fi - export GFSOUT=${NEMSINP} + if [ ${OUTPUT_FILE} = "netcdf" ]; then + export MODEL_OUT_FORM=${MODEL_OUT_FORM:-netcdfpara} + elif [ ${OUTPUT_FILE} = "nemsio" ]; then + export MODEL_OUT_FORM=${MODEL_OUT_FORM:-binarynemsiompiio} + else + export MODEL_OUT_FORM=${MODEL_OUT_FORM:-binarynemsiompiio} + fi + export GFSOUT=${NEMSINP} fi # allow threads to use threading in Jim's sp lib @@ -279,12 +278,11 @@ fi export OMP_NUM_THREADS=${OMP_NUM_THREADS:-1} pwd=$(pwd) -if [[ -d $DATA ]] -then - mkdata=NO +if [[ -d $DATA ]]; then + mkdata=NO else - mkdir -p $DATA - mkdata=YES + mkdir -p $DATA + mkdata=YES fi cd $DATA||exit 99 ################################################################################ @@ -292,18 +290,17 @@ cd $DATA||exit 99 export PGM=$POSTGPEXEC export pgm=$PGM $LOGSCRIPT -cat <postgp.inp.nml$$ - &NAMPGB - $POSTGPVARS +cat <<-EOF >postgp.inp.nml$$ + &NAMPGB + $POSTGPVARS EOF -cat <>postgp.inp.nml$$ -/ +cat <<-EOF >>postgp.inp.nml$$ + / EOF -if [[ "$VERBOSE" = "YES" ]] -then - cat postgp.inp.nml$$ +if [[ "$VERBOSE" = "YES" ]]; then + cat postgp.inp.nml$$ fi # making the time stamp format for ncep post @@ -312,15 +309,15 @@ export MM=$(echo $VDATE | cut -c5-6) export DD=$(echo $VDATE | cut -c7-8) export HH=$(echo $VDATE | cut -c9-10) -cat > itag < itag <<-EOF + &model_inputs + fileName='${GFSOUT}' + IOFORM='${MODEL_OUT_FORM}' + grib='${GRIBVERSION}' + DateStr='${YY}-${MM}-${DD}_${HH}:00:00' + MODELNAME='GFS' + fileNameFlux='${FLXINP}' + / EOF cat postgp.inp.nml$$ >> itag @@ -335,13 +332,12 @@ rm -f fort.* # change model generating Grib number if [ ${GRIBVERSION} = grib2 ]; then - cp ${POSTGRB2TBL} . - cp ${PostFlatFile} ./postxconfig-NT.txt - if [ ${ens} = "YES" ] ; then - sed < ${PostFlatFile} -e "s#negatively_pert_fcst#${ens_pert_type}#" > ./postxconfig-NT.txt - fi -# cp ${CTLFILE} postcntrl.xml - + cp ${POSTGRB2TBL} . + cp ${PostFlatFile} ./postxconfig-NT.txt + if [ ${ens} = "YES" ] ; then + sed < ${PostFlatFile} -e "s#negatively_pert_fcst#${ens_pert_type}#" > ./postxconfig-NT.txt + fi + # cp ${CTLFILE} postcntrl.xml fi export CTL=$(basename $CTLFILE) @@ -355,70 +351,70 @@ export ERR=$? export err=$ERR if [ $err -ne 0 ] ; then - if [ $PGBOUT = "wafsfile" ] ; then - exit $err - fi + if [ $PGBOUT = "wafsfile" ] ; then + exit $err + fi fi $ERRSCRIPT||exit 2 if [ $FILTER = "1" ] ; then + # Filter SLP and 500 mb height using copygb, change GRIB ID, and then + # cat the filtered fields to the pressure GRIB file, from Iredell -# Filter SLP and 500 mb height using copygb, change GRIB ID, and then -# cat the filtered fields to the pressure GRIB file, from Iredell - -if [ $GRIBVERSION = grib2 ]; then - if [ ${ens} = YES ] ; then - $COPYGB2 -x -i'4,0,80' -k'1 3 0 7*-9999 101 0 0' $PGBOUT tfile - export err=$?; err_chk - else - $COPYGB2 -x -i'4,0,80' -k'0 3 0 7*-9999 101 0 0' $PGBOUT tfile - export err=$?; err_chk - fi - $WGRIB2 tfile -set_byte 4 11 1 -grib prmsl - export err=$?; err_chk - if [ ${ens} = YES ] ; then - $COPYGB2 -x -i'4,1,5' -k'1 3 5 7*-9999 100 0 50000' $PGBOUT tfile - export err=$?; err_chk - else - $COPYGB2 -x -i'4,1,5' -k'0 3 5 7*-9999 100 0 50000' $PGBOUT tfile - export err=$?; err_chk - fi - $WGRIB2 tfile -set_byte 4 11 193 -grib h5wav - export err=$?; err_chk - -#cat $PGBOUT prmsl h5wav >> $PGBOUT -#wm -# cat prmsl h5wav >> $PGBOUT -[[ -f prmsl ]] && rm prmsl ; [[ -f h5wav ]] && rm h5wav ; [[ -f tfile ]] && rm tfile - -fi + if [ $GRIBVERSION = grib2 ]; then + if [ ${ens} = YES ] ; then + $COPYGB2 -x -i'4,0,80' -k'1 3 0 7*-9999 101 0 0' $PGBOUT tfile + export err=$?; err_chk + else + $COPYGB2 -x -i'4,0,80' -k'0 3 0 7*-9999 101 0 0' $PGBOUT tfile + export err=$?; err_chk + fi + $WGRIB2 tfile -set_byte 4 11 1 -grib prmsl + export err=$?; err_chk + if [ ${ens} = YES ] ; then + $COPYGB2 -x -i'4,1,5' -k'1 3 5 7*-9999 100 0 50000' $PGBOUT tfile + export err=$?; err_chk + else + $COPYGB2 -x -i'4,1,5' -k'0 3 5 7*-9999 100 0 50000' $PGBOUT tfile + export err=$?; err_chk + fi + $WGRIB2 tfile -set_byte 4 11 193 -grib h5wav + export err=$?; err_chk + #cat $PGBOUT prmsl h5wav >> $PGBOUT + #wm + # cat prmsl h5wav >> $PGBOUT + [[ -f prmsl ]] && rm prmsl + [[ -f h5wav ]] && rm h5wav + [[ -f tfile ]] && rm tfile + fi fi ################################################################################ # Make GRIB index file -if [[ -n $PGIOUT ]] -then - if [ $GRIBVERSION = grib2 ]; then - # JY $GRBINDEX2 $PGBOUT $PGIOUT - $GRB2INDEX $PGBOUT $PGIOUT - fi +if [[ -n $PGIOUT ]]; then + if [ $GRIBVERSION = grib2 ]; then + # JY $GRBINDEX2 $PGBOUT $PGIOUT + $GRB2INDEX $PGBOUT $PGIOUT + fi fi -if [[ -r $FLXINP && -n $FLXIOUT && $OUTTYP -le 3 ]] -then - $GRBINDEX $FLXINP $FLXIOUT +if [[ -r $FLXINP && -n $FLXIOUT && $OUTTYP -le 3 ]]; then + $GRBINDEX $FLXINP $FLXIOUT fi ################################################################################ # generate psi and chi echo "GENPSICHI= " $GENPSICHI if [ $GENPSICHI = YES ] ; then -#echo "PGBOUT PGIOUT=" $PGBOUT $PGIOUT -#echo "YY MM=" $YY $MM - export psichifile=./psichi.grb - $GENPSICHIEXE < postgp.inp.nml$$ - rc=$? - if [[ $rc -ne 0 ]] ; then echo 'Nonzero return code rc= '$rc ; exit 3 ; fi - cat ./psichi.grb >> $PGBOUT + #echo "PGBOUT PGIOUT=" $PGBOUT $PGIOUT + #echo "YY MM=" $YY $MM + export psichifile=./psichi.grb + $GENPSICHIEXE < postgp.inp.nml$$ + rc=$? + if [[ $rc -ne 0 ]] ; then + echo 'Nonzero return code rc= '$rc + exit 3 + fi + cat ./psichi.grb >> $PGBOUT fi ################################################################################ # Postprocessing @@ -426,8 +422,7 @@ cd $pwd [[ $mkdata = YES ]]&&rmdir $DATA $ENDSCRIPT set +x -if [[ "$VERBOSE" = "YES" ]] -then - echo $(date) EXITING $0 with return code $err >&2 +if [[ "$VERBOSE" = "YES" ]]; then + echo $(date) EXITING $0 with return code $err >&2 fi exit $err diff --git a/ush/gfs_transfer.sh b/ush/gfs_transfer.sh index cab85d1796..f8b00ea623 100755 --- a/ush/gfs_transfer.sh +++ b/ush/gfs_transfer.sh @@ -58,8 +58,7 @@ set -xa # DBNet Alerts for gfs suite # -if test "$SENDDBN" = 'YES' -a "$RUN" = 'gfs' -then +if [ "$SENDDBN" = 'YES' -a "$RUN" = 'gfs' ]; then #if [ $(expr $fhr % 3) -eq 0 ]; then #echo $DBNROOT/bin/dbn_alert MODEL GFS_SGB $job $COMOUT/${RUN}.${cycle}.sfluxgrbf$fhr #echo $DBNROOT/bin/dbn_alert MODEL GFS_SGBI $job $COMOUT/${RUN}.${cycle}.sfluxgrbif$fhr @@ -69,14 +68,11 @@ then fhr=$(printf "%03d" $fhr) $DBNROOT/bin/dbn_alert MODEL GFS_SF $job $COMOUT/${RUN}.t${cyc}z.atmf$fhr.nc - - if [[ $fhr -gt 0 && $fhr -le 84 ]] - then + if [[ $fhr -gt 0 && $fhr -le 84 ]]; then $DBNROOT/bin/dbn_alert MODEL GFS_BF $job $COMOUT/${RUN}.t${cyc}z.sfcf$fhr.nc fi - if [[ $fhr -eq 120 ]] - then + if [[ $fhr -eq 120 ]]; then $DBNROOT/bin/dbn_alert MODEL GFS_BF $job $COMOUT/${RUN}.t${cyc}z.sfcf$fhr.nc fi fi diff --git a/ush/global_nceppost.sh b/ush/global_nceppost.sh index 6aedef5694..cbc9ba6ccc 100755 --- a/ush/global_nceppost.sh +++ b/ush/global_nceppost.sh @@ -184,10 +184,9 @@ ################################################################################ # Set environment. export VERBOSE=${VERBOSE:-"NO"} -if [[ "$VERBOSE" = "YES" ]] -then - echo $(date) EXECUTING $0 $* >&2 - set -x +if [[ "$VERBOSE" = "YES" ]]; then + echo $(date) EXECUTING $0 $* >&2 + set -x fi # Command line arguments. export SIGINP=${1:-${SIGINP}} @@ -250,66 +249,65 @@ export APRUN=${APRUNP:-${APRUN:-""}} # exit if SIGINP does not exist if [ ${OUTTYP} -le 3 ] ; then - if [ ! -s $SIGINP ] ; then - echo "sigma file not found, exitting" - exit 111 - fi + if [ ! -s $SIGINP ] ; then + echo "sigma file not found, exitting" + exit 111 + fi fi export SIGHDR=${SIGHDR:-$NWPROD/exec/global_sighdr} export IDRT=${IDRT:-4} if [ ${OUTTYP} -le 1 ] ; then - export JCAP=${JCAP:-$(echo jcap|$SIGHDR ${SIGINP})} - export LEVS=${LEVS:-$(echo levs|$SIGHDR ${SIGINP})} - export IDVC=${IDVC:-$(echo idvc|$SIGHDR ${SIGINP})} - export IDVM=${IDVM:-$(echo idvm|$SIGHDR ${SIGINP})} - export NVCOORD=${NVCOORD:-$(echo nvcoord|$SIGHDR ${SIGINP})} - export IVSSIG=${IVSSIG:-$(echo ivs|$SIGHDR ${SIGINP})} - export LATCH=${LATCH:-8} - if [ ${OUTTYP} -eq 1 ] ; then - export CHGRESVARS="IDVC=$IDVC,IDVM=$IDVM,NVCOORD=$NVCOORD,IVSSIG=$IVSSIG,LATCH=$LATCH," - elif [ ${OUTTYP} -eq 0 ] ; then - export CHGRESVARS="LATCH=$LATCH,$CHGRESVARS" - fi - #export SIGLEVEL=${SIGLEVEL:-""} - export SIGLEVEL=${SIGLEVEL:-"$NWPROD/fix/global_hyblev.l${LEVS}.txt"} - # specify threads for running chgres - export OMP_NUM_THREADS=$CHGRESTHREAD - export NTHREADS=$OMP_NUM_THREADS - if [ ${JCAP} -eq 574 -a ${IDRT} -eq 4 ] - then - export NTHSTACK=1024000000 - fi - export XLSMPOPTS="parthds=$NTHREADS:stack=$NTHSTACK" - - $CHGRESSH - - export ERR=$? - export err=$ERR - $ERRSCRIPT||exit 1 - + export JCAP=${JCAP:-$(echo jcap|$SIGHDR ${SIGINP})} + export LEVS=${LEVS:-$(echo levs|$SIGHDR ${SIGINP})} + export IDVC=${IDVC:-$(echo idvc|$SIGHDR ${SIGINP})} + export IDVM=${IDVM:-$(echo idvm|$SIGHDR ${SIGINP})} + export NVCOORD=${NVCOORD:-$(echo nvcoord|$SIGHDR ${SIGINP})} + export IVSSIG=${IVSSIG:-$(echo ivs|$SIGHDR ${SIGINP})} + export LATCH=${LATCH:-8} + if [ ${OUTTYP} -eq 1 ] ; then + export CHGRESVARS="IDVC=$IDVC,IDVM=$IDVM,NVCOORD=$NVCOORD,IVSSIG=$IVSSIG,LATCH=$LATCH," + elif [ ${OUTTYP} -eq 0 ] ; then + export CHGRESVARS="LATCH=$LATCH,$CHGRESVARS" + fi + #export SIGLEVEL=${SIGLEVEL:-""} + export SIGLEVEL=${SIGLEVEL:-"$NWPROD/fix/global_hyblev.l${LEVS}.txt"} + # specify threads for running chgres + export OMP_NUM_THREADS=$CHGRESTHREAD + export NTHREADS=$OMP_NUM_THREADS + if [ ${JCAP} -eq 574 -a ${IDRT} -eq 4 ]; then + export NTHSTACK=1024000000 + fi + export XLSMPOPTS="parthds=$NTHREADS:stack=$NTHSTACK" + + $CHGRESSH + + export ERR=$? + export err=$ERR + $ERRSCRIPT||exit 1 + # run post to read sigma file directly if OUTTYP=3 elif [ ${OUTTYP} -eq 3 ] ; then - export LONB=${LONB:-$(echo lonb|$SIGHDR ${SIGINP})} - export LATB=${LATB:-$(echo latb|$SIGHDR ${SIGINP})} - export MODEL_OUT_FORM=sigio - export GFSOUT=${SIGINP} + export LONB=${LONB:-$(echo lonb|$SIGHDR ${SIGINP})} + export LATB=${LATB:-$(echo latb|$SIGHDR ${SIGINP})} + export MODEL_OUT_FORM=sigio + export GFSOUT=${SIGINP} # run post to read nemsio file if OUTTYP=4 elif [ ${OUTTYP} -eq 4 ] ; then - export nemsioget=${nemsioget:-$EXECglobal/nemsio_get} - export LONB=${LONB:-$($nemsioget $NEMSINP dimx | awk '{print $2}')} - export LATB=${LATB:-$($nemsioget $NEMSINP dimy | awk '{print $2}')} - export JCAP=${JCAP:-$(expr $LATB - 2)} -# export LONB=${LONB:-$($nemsioget $NEMSINP lonf |grep -i "lonf" |awk -F"= " '{print $2}' |awk -F" " '{print $1}')} -# export LATB=${LATB:-$($nemsioget $NEMSINP latg |grep -i "latg" |awk -F"= " '{print $2}' |awk -F" " '{print $1}')} -# export JCAP=${JCAP:-$($nemsioget $NEMSINP jcap |grep -i "jcap" |awk -F"= " '{print $2}' |awk -F" " '{print $1}')} - - export MODEL_OUT_FORM=${MODEL_OUT_FORM:-binarynemsiompiio} - export GFSOUT=${NEMSINP} - ln -sf $FIXglobal/fix_am/global_lonsperlat.t${JCAP}.${LONB}.${LATB}.txt ./lonsperlat.dat - ln -sf $FIXglobal/fix_am/global_hyblev.l${LEVS}.txt ./global_hyblev.txt + export nemsioget=${nemsioget:-$EXECglobal/nemsio_get} + export LONB=${LONB:-$($nemsioget $NEMSINP dimx | awk '{print $2}')} + export LATB=${LATB:-$($nemsioget $NEMSINP dimy | awk '{print $2}')} + export JCAP=${JCAP:-$(expr $LATB - 2)} + # export LONB=${LONB:-$($nemsioget $NEMSINP lonf |grep -i "lonf" |awk -F"= " '{print $2}' |awk -F" " '{print $1}')} + # export LATB=${LATB:-$($nemsioget $NEMSINP latg |grep -i "latg" |awk -F"= " '{print $2}' |awk -F" " '{print $1}')} + # export JCAP=${JCAP:-$($nemsioget $NEMSINP jcap |grep -i "jcap" |awk -F"= " '{print $2}' |awk -F" " '{print $1}')} + + export MODEL_OUT_FORM=${MODEL_OUT_FORM:-binarynemsiompiio} + export GFSOUT=${NEMSINP} + ln -sf $FIXglobal/fix_am/global_lonsperlat.t${JCAP}.${LONB}.${LATB}.txt ./lonsperlat.dat + ln -sf $FIXglobal/fix_am/global_hyblev.l${LEVS}.txt ./global_hyblev.txt fi # allow threads to use threading in Jim's sp lib @@ -317,12 +315,11 @@ fi export OMP_NUM_THREADS=${OMP_NUM_THREADS:-1} pwd=$(pwd) -if [[ -d $DATA ]] -then - mkdata=NO +if [[ -d $DATA ]]; then + mkdata=NO else - mkdir -p $DATA - mkdata=YES + mkdir -p $DATA + mkdata=YES fi cd $DATA||exit 99 ################################################################################ @@ -330,17 +327,17 @@ cd $DATA||exit 99 export PGM=$POSTGPEXEC export pgm=$PGM $LOGSCRIPT -cat <postgp.inp.nml$$ - &NAMPGB - $POSTGPVARS +cat <<-EOF >postgp.inp.nml$$ + &NAMPGB + $POSTGPVARS EOF -cat <>postgp.inp.nml$$ - / +cat <<-EOF >>postgp.inp.nml$$ + / EOF -if [[ "$VERBOSE" = "YES" ]] -then - cat postgp.inp.nml$$ + +if [[ "$VERBOSE" = "YES" ]]; then + cat postgp.inp.nml$$ fi # making the time stamp format for ncep post @@ -349,14 +346,14 @@ export MM=$(echo $VDATE | cut -c5-6) export DD=$(echo $VDATE | cut -c7-8) export HH=$(echo $VDATE | cut -c9-10) -cat > itag < itag <<-EOF + $GFSOUT + ${MODEL_OUT_FORM} + ${GRIBVERSION} + ${YY}-${MM}-${DD}_${HH}:00:00 + GFS + $FLXINP + $D3DINP EOF cat postgp.inp.nml$$ >> itag @@ -371,26 +368,23 @@ rm -f fort.* # change model generating Grib number if [ ${GRIBVERSION} = grib1 ]; then - - if [ ${IGEN} -le 9 ] ; then - cat ${CTLFILE}|sed s:00082:0000${IGEN}:>./gfs_cntrl.parm - elif [ ${IGEN} -le 99 ] ; then - cat ${CTLFILE}|sed s:00082:000${IGEN}:>./gfs_cntrl.parm - elif [ ${IGEN} -le 999 ] ; then - cat ${CTLFILE}|sed s:00082:00${IGEN}:>./gfs_cntrl.parm - else - ln -sf ${CTLFILE} ./gfs_cntrl.parm - fi - ln -sf ./gfs_cntrl.parm fort.14 - + if [ ${IGEN} -le 9 ] ; then + cat ${CTLFILE}|sed s:00082:0000${IGEN}:>./gfs_cntrl.parm + elif [ ${IGEN} -le 99 ] ; then + cat ${CTLFILE}|sed s:00082:000${IGEN}:>./gfs_cntrl.parm + elif [ ${IGEN} -le 999 ] ; then + cat ${CTLFILE}|sed s:00082:00${IGEN}:>./gfs_cntrl.parm + else + ln -sf ${CTLFILE} ./gfs_cntrl.parm + fi + ln -sf ./gfs_cntrl.parm fort.14 elif [ ${GRIBVERSION} = grib2 ]; then - cp ${POSTGRB2TBL} . - cp ${PostFlatFile} ./postxconfig-NT.txt - if [ ${ens} = "YES" ] ; then - sed < ${PostFlatFile} -e "s#negatively_pert_fcst#${ens_pert_type}#" > ./postxconfig-NT.txt - fi -# cp ${CTLFILE} postcntrl.xml - + cp ${POSTGRB2TBL} . + cp ${PostFlatFile} ./postxconfig-NT.txt + if [ ${ens} = "YES" ] ; then + sed < ${PostFlatFile} -e "s#negatively_pert_fcst#${ens_pert_type}#" > ./postxconfig-NT.txt + fi + # cp ${CTLFILE} postcntrl.xml fi export CTL=$(basename $CTLFILE) @@ -404,93 +398,87 @@ export err=$ERR $ERRSCRIPT||exit 2 if [ $FILTER = "1" ] ; then - -# Filter SLP and 500 mb height using copygb, change GRIB ID, and then -# cat the filtered fields to the pressure GRIB file, from Iredell - -if [ $GRIBVERSION = grib1 ]; then - $COPYGB -x -i'4,0,80' -k'4*-1,1,102' $PGBOUT tfile - ln -s -f tfile fort.11 - ln -s -f prmsl fort.51 - echo 0 2|$OVERPARMEXEC - $COPYGB -x -i'4,1,5' -k'4*-1,7,100,500' $PGBOUT tfile - ln -s -f tfile fort.11 - ln -s -f h5wav fort.51 - echo 0 222|$OVERPARMEXEC - -#cat $PGBOUT prmsl h5wav >> $PGBOUT - cat prmsl h5wav >> $PGBOUT - -elif [ $GRIBVERSION = grib2 ]; then - if [ ${ens} = YES ] ; then - $COPYGB2 -x -i'4,0,80' -k'1 3 0 7*-9999 101 0 0' $PGBOUT tfile - else - $COPYGB2 -x -i'4,0,80' -k'0 3 0 7*-9999 101 0 0' $PGBOUT tfile - fi - $WGRIB2 tfile -set_byte 4 11 1 -grib prmsl - if [ ${ens} = YES ] ; then - $COPYGB2 -x -i'4,1,5' -k'1 3 5 7*-9999 100 0 50000' $PGBOUT tfile - else - $COPYGB2 -x -i'4,1,5' -k'0 3 5 7*-9999 100 0 50000' $PGBOUT tfile - fi - $WGRIB2 tfile -set_byte 4 11 193 -grib h5wav - -#cat $PGBOUT prmsl h5wav >> $PGBOUT - - cat prmsl h5wav >> $PGBOUT - -fi - + # Filter SLP and 500 mb height using copygb, change GRIB ID, and then + # cat the filtered fields to the pressure GRIB file, from Iredell + + if [ $GRIBVERSION = grib1 ]; then + $COPYGB -x -i'4,0,80' -k'4*-1,1,102' $PGBOUT tfile + ln -s -f tfile fort.11 + ln -s -f prmsl fort.51 + echo 0 2|$OVERPARMEXEC + $COPYGB -x -i'4,1,5' -k'4*-1,7,100,500' $PGBOUT tfile + ln -s -f tfile fort.11 + ln -s -f h5wav fort.51 + echo 0 222|$OVERPARMEXEC + + #cat $PGBOUT prmsl h5wav >> $PGBOUT + cat prmsl h5wav >> $PGBOUT + elif [ $GRIBVERSION = grib2 ]; then + if [ ${ens} = YES ] ; then + $COPYGB2 -x -i'4,0,80' -k'1 3 0 7*-9999 101 0 0' $PGBOUT tfile + else + $COPYGB2 -x -i'4,0,80' -k'0 3 0 7*-9999 101 0 0' $PGBOUT tfile + fi + $WGRIB2 tfile -set_byte 4 11 1 -grib prmsl + if [ ${ens} = YES ] ; then + $COPYGB2 -x -i'4,1,5' -k'1 3 5 7*-9999 100 0 50000' $PGBOUT tfile + else + $COPYGB2 -x -i'4,1,5' -k'0 3 5 7*-9999 100 0 50000' $PGBOUT tfile + fi + $WGRIB2 tfile -set_byte 4 11 193 -grib h5wav + + #cat $PGBOUT prmsl h5wav >> $PGBOUT + + cat prmsl h5wav >> $PGBOUT + fi fi ################################################################################ # Anomaly concatenation # for now just do anomaly concentration for grib1 if [ $GRIBVERSION = grib1 ]; then - - if [[ -x $ANOMCATSH ]] - then - if [[ -n $PGIOUT ]] - then - $GRBINDEX $PGBOUT $PGIOUT - fi - export PGM=$ANOMCATSH - export pgm=$PGM - $LOGSCRIPT - - eval $ANOMCATSH $PGBOUT $PGIOUT - - export ERR=$? - export err=$ERR - $ERRSCRIPT||exit 3 - fi + if [[ -x $ANOMCATSH ]]; then + if [[ -n $PGIOUT ]]; then + $GRBINDEX $PGBOUT $PGIOUT + fi + export PGM=$ANOMCATSH + export pgm=$PGM + $LOGSCRIPT + + eval $ANOMCATSH $PGBOUT $PGIOUT + + export ERR=$? + export err=$ERR + $ERRSCRIPT||exit 3 + fi fi ################################################################################ # Make GRIB index file -if [[ -n $PGIOUT ]] -then - if [ $GRIBVERSION = grib2 ]; then - # JY $GRBINDEX2 $PGBOUT $PGIOUT - $GRB2INDEX $PGBOUT $PGIOUT - else - $GRBINDEX $PGBOUT $PGIOUT - fi +if [[ -n $PGIOUT ]]; then + if [ $GRIBVERSION = grib2 ]; then + # JY $GRBINDEX2 $PGBOUT $PGIOUT + $GRB2INDEX $PGBOUT $PGIOUT + else + $GRBINDEX $PGBOUT $PGIOUT + fi fi -if [[ -r $FLXINP && -n $FLXIOUT && $OUTTYP -le 3 ]] -then - $GRBINDEX $FLXINP $FLXIOUT +if [[ -r $FLXINP && -n $FLXIOUT && $OUTTYP -le 3 ]]; then + $GRBINDEX $FLXINP $FLXIOUT fi ################################################################################ # generate psi and chi echo "GENPSICHI= " $GENPSICHI if [ $GENPSICHI = YES ] ; then -#echo "PGBOUT PGIOUT=" $PGBOUT $PGIOUT -#echo "YY MM=" $YY $MM - export psichifile=./psichi.grb - $GENPSICHIEXE < postgp.inp.nml$$ - rc=$? - if [[ $rc -ne 0 ]] ; then echo 'Nonzero return code rc= '$rc ; exit 3 ; fi - cat ./psichi.grb >> $PGBOUT + #echo "PGBOUT PGIOUT=" $PGBOUT $PGIOUT + #echo "YY MM=" $YY $MM + export psichifile=./psichi.grb + $GENPSICHIEXE < postgp.inp.nml$$ + rc=$? + if [[ $rc -ne 0 ]] ; then + echo 'Nonzero return code rc= '$rc + exit 3 + fi + cat ./psichi.grb >> $PGBOUT fi ################################################################################ # Postprocessing @@ -498,8 +486,7 @@ cd $pwd [[ $mkdata = YES ]]&&rmdir $DATA $ENDSCRIPT set +x -if [[ "$VERBOSE" = "YES" ]] -then - echo $(date) EXITING $0 with return code $err >&2 +if [[ "$VERBOSE" = "YES" ]]; then + echo $(date) EXITING $0 with return code $err >&2 fi exit $err diff --git a/ush/link_crtm_fix.sh b/ush/link_crtm_fix.sh index 1ce1085ecd..3307b5f6dd 100755 --- a/ush/link_crtm_fix.sh +++ b/ush/link_crtm_fix.sh @@ -7,29 +7,29 @@ FIXCRTM="${1:-${FIXCRTM:-MISSING}}" if [[ "$FIXCRTM" == "MISSING" ]] ; then - echo "Please specify CRTM fix location. Giving up." 1>&2 - exit 19 + echo "Please specify CRTM fix location. Giving up." 1>&2 + exit 19 fi if [[ ! -d "$FIXCRTM" ]] ; then - echo "$FIXCRTM: \$FIXCRTM is not a directory. Giving up." 1>&2 - exit 38 + echo "$FIXCRTM: \$FIXCRTM is not a directory. Giving up." 1>&2 + exit 38 fi for what in "amsre_aqua" "imgr_g11" "imgr_g12" "imgr_g13" \ - "imgr_g15" "imgr_mt1r" "imgr_mt2" "seviri_m10" \ - "ssmi_f13" "ssmi_f14" "ssmi_f15" "ssmis_f16" \ - "ssmis_f17" "ssmis_f18" "ssmis_f19" "ssmis_f20" \ - "tmi_trmm" "v.seviri_m10" "imgr_insat3d" "abi_gr" "ahi_himawari8" ; do - ln -s "$FIXCRTM/$what.TauCoeff.bin" . - ln -s "$FIXCRTM/$what.SpcCoeff.bin" . + "imgr_g15" "imgr_mt1r" "imgr_mt2" "seviri_m10" \ + "ssmi_f13" "ssmi_f14" "ssmi_f15" "ssmis_f16" \ + "ssmis_f17" "ssmis_f18" "ssmis_f19" "ssmis_f20" \ + "tmi_trmm" "v.seviri_m10" "imgr_insat3d" "abi_gr" "ahi_himawari8" ; do + ln -s "$FIXCRTM/$what.TauCoeff.bin" . + ln -s "$FIXCRTM/$what.SpcCoeff.bin" . done for what in 'Aerosol' 'Cloud' ; do - ln -s "$FIXCRTM/${what}Coeff.bin" . + ln -s "$FIXCRTM/${what}Coeff.bin" . done for what in $FIXCRTM/*Emis* ; do - ln -s $what . + ln -s $what . done exit 0