diff --git a/.gitignore b/.gitignore index d920f42121..e60595b75c 100644 --- a/.gitignore +++ b/.gitignore @@ -107,13 +107,10 @@ jobs/JGFS_ATMOS_WAFS_GRIB2 jobs/JGFS_ATMOS_WAFS_GRIB2_0P25 jobs/JGLOBAL_ATMOS_ANALYSIS jobs/JGLOBAL_ATMOS_ANALYSIS_CALC -jobs/JGLOBAL_ATMOS_NCEPPOST -jobs/JGLOBAL_ATMOS_POST_MANAGER # scripts symlinks scripts/exemcsfc_global_sfc_prep.sh scripts/exgdas_atmos_chgres_forenkf.sh scripts/exgdas_atmos_gldas.sh -scripts/exgdas_atmos_nceppost.sh scripts/exgdas_atmos_verfozn.sh scripts/exgdas_atmos_verfrad.sh scripts/exgdas_atmos_vminmon.sh @@ -132,7 +129,6 @@ scripts/exgfs_atmos_wafs_grib2.sh scripts/exgfs_atmos_wafs_grib2_0p25.sh scripts/exglobal_atmos_analysis.sh scripts/exglobal_atmos_analysis_calc.sh -scripts/exglobal_atmos_pmgr.sh scripts/exglobal_diag.sh # ush symlinks ush/calcanl_gfs.py @@ -140,15 +136,11 @@ ush/calcinc_gfs.py ush/chgres_cube.sh ush/emcsfc_ice_blend.sh ush/emcsfc_snow.sh -ush/fix_precip.sh ush/fv3gfs_driver_grid.sh -ush/fv3gfs_dwn_nems.sh ush/fv3gfs_filter_topo.sh ush/fv3gfs_make_grid.sh ush/fv3gfs_make_orog.sh ush/getncdimlen -ush/gfs_nceppost.sh -ush/gfs_transfer.sh ush/gldas_archive.sh ush/gldas_forcing.sh ush/gldas_get_data.sh @@ -160,12 +152,10 @@ ush/global_chgres_driver.sh ush/global_cycle.sh ush/global_cycle_driver.sh ush/gsi_utils.py -ush/link_crtm_fix.sh ush/minmon_xtrct_costs.pl ush/minmon_xtrct_gnorms.pl ush/minmon_xtrct_reduct.pl ush/mkwfsgbl.sh -ush/mod_icec.sh ush/ozn_xtrct.sh ush/radmon_ck_stdout.sh ush/radmon_err_rpt.sh @@ -173,7 +163,6 @@ ush/radmon_verf_angle.sh ush/radmon_verf_bcoef.sh ush/radmon_verf_bcor.sh ush/radmon_verf_time.sh -ush/trim_rh.sh ush/wafs_blending.sh ush/wafs_grib2.regrid.sh ush/wafs_intdsk.sh diff --git a/jobs/JGLOBAL_ATMOS_NCEPPOST b/jobs/JGLOBAL_ATMOS_NCEPPOST new file mode 100755 index 0000000000..45adca8e50 --- /dev/null +++ b/jobs/JGLOBAL_ATMOS_NCEPPOST @@ -0,0 +1,153 @@ +#!/bin/ksh +set -x + +export RUN_ENVIR=${RUN_ENVIR:-"nco"} +export PS4='$SECONDS + ' +date + + +############################# +# Source relevant config files +############################# +configs="base post" +export EXPDIR=${EXPDIR:-$HOMEgfs/parm/config} +config_path=${EXPDIR:-$NWROOT/gfs.${gfs_ver}/parm/config} +for config in $configs; do + . $config_path/config.$config + status=$? + [[ $status -ne 0 ]] && exit $status +done + + +########################################## +# Source machine runtime environment +########################################## +. $HOMEgfs/env/${machine}.env post +status=$? +[[ $status -ne 0 ]] && exit $status + + +############################################## +# Obtain unique process id (pid) and make temp directory +############################################## +export pid=${pid:-$$} +export outid=${outid:-"LL$job"} +export DATA=${DATA:-${DATAROOT}/${jobid:?}} +mkdir -p $DATA +cd $DATA + + +############################################## +# Run setpdy and initialize PDY variables +############################################## +export cycle="t${cyc}z" +setpdy.sh +. ./PDY + + +############################################## +# Determine Job Output Name on System +############################################## +export pgmout="OUTPUT.${pid}" +export pgmerr=errfile + +#################################### +# Specify version numbers +#################################### +export crtm_ver=${post_crtm_ver:-v2.2.6} +export gfs_ver=${gfs_ver:-v15.0.0} +export hwrf_ver=${hwrf_ver:-v11.0.5} +export g2tmpl_ver=${g2tmpl_ver:-v1.5.0} + +############################################## +# Set variables used in the exglobal script +############################################## +export CDATE=${CDATE:-${PDY}${cyc}} +export CDUMP=${CDUMP:-${RUN:-"gfs"}} +export COMPONENT=${COMPONENT:-atmos} + + +############################################## +# Begin JOB SPECIFIC work +############################################## +export APRUNP=${APRUN:-$APRUN_NP} +export RERUN=${RERUN:-NO} +export HOMECRTM=${HOMECRTM:-${NWROOT}/lib/crtm/${crtm_ver}} +export FIXCRTM=${CRTM_FIX:-${HOMECRTM}/fix} +export PARMpost=${PARMpost:-$HOMEgfs/parm/post} +export INLINE_POST=${WRITE_DOPOST:-".false."} + +export COMIN=${COMIN:-$ROTDIR/$RUN.$PDY/$cyc/$COMPONENT} +export COMOUT=${COMOUT:-$ROTDIR/$RUN.$PDY/$cyc/$COMPONENT} + +[[ ! -d $COMOUT ]] && mkdir -m 775 -p $COMOUT + +if [ $RUN = gfs ];then + export FHOUT_PGB=${FHOUT_GFS:-3} #Output frequency of gfs pgb file at 1.0 and 0.5 deg. +fi +if [ $RUN = gdas ]; then + export IGEN_GFS="gfs_avn" + export IGEN_ANL="anal_gfs" + export IGEN_FCST="gfs_avn" + export IGEN_GDAS_ANL="anal_gdas" + export FHOUT_PGB=${FHOUT:-1} #Output frequency of gfs pgb file at 1.0 and 0.5 deg. +fi + +if [ $GRIBVERSION = grib2 ]; then + export IGEN_ANL="anal_gfs" + export IGEN_FCST="gfs_avn" + export IGEN_GFS="gfs_avn" +fi + +####################################### +# Specify Restart File Name to Key Off +####################################### +export restart_file=$COMIN/${RUN}.t${cyc}z.logf + +#################################### +# Specify Timeout Behavior of Post +# +# SLEEP_TIME - Amount of time to wait for +# a restart file before exiting +# SLEEP_INT - Amount of time to wait between +# checking for restart files +#################################### +export SLEEP_TIME=900 +export SLEEP_INT=5 + + +############################################################### +# Run relevant exglobal script +env +msg="HAS BEGUN on `hostname`" +postmsg "$msg" +$LOGSCRIPT + + +$SCRgfs/ex${RUN}_atmos_nceppost.sh +status=$? +[[ $status -ne 0 ]] && exit $status + +############################################## +# End JOB SPECIFIC work +############################################## + +############################################## +# Final processing +############################################## +if [ -e "$pgmout" ]; then + cat $pgmout +fi + +msg="ENDED NORMALLY." +postmsg "$msg" + + +########################################## +# Remove the Temporary working directory +########################################## +cd $DATAROOT +[[ $KEEPDATA = "NO" ]] && rm -rf $DATA + +date +exit 0 diff --git a/jobs/JGLOBAL_ATMOS_POST_MANAGER b/jobs/JGLOBAL_ATMOS_POST_MANAGER new file mode 100755 index 0000000000..94c848627f --- /dev/null +++ b/jobs/JGLOBAL_ATMOS_POST_MANAGER @@ -0,0 +1,104 @@ +#!/bin/sh + +######################################## +# GFS post manager +######################################## + +export RUN_ENVIR=${RUN_ENVIR:-"nco"} +export PS4='$SECONDS + ' +date + +############################# +# Source relevant config files +############################# +set -x +configs="base post" +export EXPDIR=${EXPDIR:-$HOMEgfs/parm/config} +config_path=${EXPDIR:-$NWROOT/gfs.${gfs_ver}/parm/config} +for config in $configs; do + . $config_path/config.$config + status=$? + [[ $status -ne 0 ]] && exit $status +done + + +########################################## +# Source machine runtime environment +########################################## +. $HOMEgfs/env/${machine}.env post +status=$? +[[ $status -ne 0 ]] && exit $status + +set -xue +# #### 07/30/1999 ################### +# SET SHELL PROCESSING VARIABLES +# ################################### +export PS4='$SECONDS + ' +date + +#################################### +# Specify NET and RUN Name and model +#################################### +export NET=${NET:-gfs} +export RUN=${RUN:-gfs} +export COMPONENT=${COMPONENT:-atmos} + +#################################### +# obtain unique process id (pid) and make temp directories +#################################### +export pid=${pid:-$$} +export DATA=${DATA:-${DATAROOT}/${jobid:?}} +mkdir $DATA +cd $DATA + +#################################### +# Determine Job Output Name on System +#################################### +export outid="LL$job" +export jobid="${outid}.o${pid}" +export pgmout="OUTPUT.${pid}" + +#################################### +# Specify version numbers +#################################### +export gfs_ver=${gfs_ver:-v15.0.0} + +#################################### +# Specify Execution Areas +#################################### +export HOMEgfs=${HOMEgfs:-${NWROOT}/gfs.${gfs_ver}} +export EXECgfs=${HOMEgfs:-$HOMEgfs/exec} +export FIXgfs=${HOMEgfs:-$HOMEgfs/fix} +export PARMgfs=${HOMEgfs:-$HOMEgfs/parm} +export USHgfs=${HOMEgfs:-$HOMEgfs/ush} + +########################### +# Set up EXT variable +########################### +export EXT_FCST=NO + +################################### +# Set up the UTILITIES +################################### +# export HOMEutil=${HOMEutil:-/nw${envir}/util.${util_ver}} +# export utilscript=${utilscript:-$HOMEutil/ush} +# export utilexec=${utilexec:-$HOMEutil/exec} + +########################################### +# Run setpdy and initialize PDY variables +########################################### +export cycle=t${cyc}z +setpdy.sh +. ./PDY + +export ROTDIR=${ROTDIR:-${COMROOT:?}/$NET/$envir} +export COMIN=${COMIN:-$ROTDIR/$RUN.$PDY/$cyc/$COMPONENT} +export COMOUT=${COMOUT:-$ROTDIR/$RUN.$PDY/$cyc/$COMPONENT} + + +######################################################## +# Execute the script. +$HOMEgfs/scripts/exglobal_atmos_pmgr.sh +######################################################## + +date diff --git a/scripts/exgdas_atmos_nceppost.sh b/scripts/exgdas_atmos_nceppost.sh new file mode 100755 index 0000000000..dc7b126988 --- /dev/null +++ b/scripts/exgdas_atmos_nceppost.sh @@ -0,0 +1,393 @@ +##################################################################### +echo "-----------------------------------------------------" +echo " exgdas_nceppost.sh" +echo " Sep 07 - Chuang - Modified script to run unified post" +echo " July 14 - Carlis - Changed to 0.25 deg grib2 master file" +echo " Feb 16 - Lin - Modify to use Vertical Structure" +echo " Aug 17 - Meng - Modify to use 3-digit forecast hour naming" +echo " master and flux 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 " and remove writing data file to /nwges" +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 " Aug 20 - Meng - Remove .ecf extentsion per EE2 review." +echo " Sep 20 - Meng - Update clean up files per EE2 review." +echo " Mar 21 - Meng - Update POSTGRB2TBL default setting." +echo " Oct 21 - Meng - Remove jlogfile for wcoss2 transition." +echo " Feb 22 - Lin - Exception handling if anl input not found." +echo "-----------------------------------------------------" +##################################################################### + +set -x + +cd $DATA + +msg="HAS BEGUN on `hostname`" +postmsg "$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} +export MODICEC=${MODICEC:-$USHgfs/mod_icec.sh} +export INLINE_POST=${INLINE_POST:-".false."} + +############################################################ +# Define Variables: +# ----------------- +# fhr 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} +# specify default model output format: 3 for sigio and 4 +# for nemsio +export OUTTYP=${OUTTYP:-4} +export OUTPUT_FILE=${OUTPUT_FILE:-"nemsio"} +export TCYC=${TCYC:-".t${cyc}z."} +export PREFIX=${PREFIX:-${RUN}${TCYC}} +if [ $OUTTYP -eq 4 ] ; then + if [ $OUTPUT_FILE = "netcdf" ]; then + export SUFFIX=".nc" + else + export SUFFIX=".nemsio" + fi +else + export SUFFIX= +fi +export machine=${machine:-WCOSS_C} + +########################### +# Specify Output layers +########################### +export POSTGPVARS="KPO=57,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.7,0.4,0.2,0.1,0.07,0.04,0.02,0.01," + +########################################################## +# 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 +############################################################ +# 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} +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} + +# 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 + 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} + $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 + 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 +############################################################ + +for fhr in $post_times +do + ############################### + # 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}.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 + + msg="Starting post for fhr=$fhr" + postmsg "$msg" + + ############################### + # Put restart files into /nwges + # for backup to start Model Fcst + ############################### + [[ -f flxfile ]] && rm flxfile ; [[ -f nemsfile ]] && rm nemsfile + if [ $OUTTYP -eq 4 ] ; then + ln -sf $COMIN/${PREFIX}atmf$fhr${SUFFIX} nemsfile + export NEMSINP=nemsfile + ln -sf $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 + +# 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 + + export OUTTYP=${OUTTYP:-4} + + 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 + 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 ]] ; 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 + fi + + export FLXIOUT=flxifile + export PGBOUT=pgbfile + export PGIOUT=pgifile + export PGBOUT2=pgbfile.grib2 + export PGIOUT2=pgifile.grib2.idx + export FILTER=0 + export fhr3=$fhr + if [ $GRIBVERSION = 'grib2' ] + then + MASTERFHR=${PREFIX}master.grb2f${fhr} + MASTERFHRIDX=${PREFIX}master.grb2if${fhr} + fi + + + if [ $INLINE_POST = ".false." ]; then + $POSTGPSH + else + cp $COMOUT/${MASTERFHR} $PGBOUT + fi + export err=$?; err_chk + + + if test $GRIBVERSION = 'grib2' + then + mv $PGBOUT $PGBOUT2 + fi + + #wm Process pgb files + export FH=`expr $fhr + 0` + export downset=${downset:-1} + $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} + $DBNROOT/bin/dbn_alert MODEL ${run}_PGB2_0P25_WIDX $job $COMOUT/${PREFIX}pgrb2.0p25.f${fhr}.idx + $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 [ $GRIBVERSION = 'grib2' ] ; then + if [ $INLINE_POST = ".false." ]; then + cp $PGBOUT2 $COMOUT/${MASTERFHR} + fi + $GRB2INDEX $PGBOUT2 $COMOUT/${MASTERFHRIDX} + fi + +# 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 + else + export PostFlatFile=$PARMpost/postxconfig-NT-GFS-FLUX.txt + export CTLFILE=$PARMpost/postcntrl_gfs_flux.xml + fi + export PGBOUT=fluxfile + export FILTER=0 + FLUXFL=${PREFIX}sfluxgrbf${fhr}.grib2 + FLUXFLIDX=${PREFIX}sfluxgrbf${fhr}.grib2.idx + + if [ $INLINE_POST = ".false." ]; then + $POSTGPSH + 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 + $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 + $DBNROOT/bin/dbn_alert MODEL ${run}_SGB_GB2_WIDX $job $COMOUT/${PREFIX}sfluxgrbf${fhr}.grib2.idx + fi + fi + + [[ -f pgbfile.grib2 ]] && rm pgbfile.grib2 ; [[ -f flxfile ]] && rm flxfile + +done + +#---------------------------------- +fi ## end_if_times +#---------------------------------- + +#cat $pgmout +#msg='ENDED NORMALLY.' +#postmsg "$jlogfile" "$msg" + +exit 0 + +################## END OF SCRIPT ####################### diff --git a/scripts/exglobal_atmos_pmgr.sh b/scripts/exglobal_atmos_pmgr.sh new file mode 100755 index 0000000000..a9bcb4251f --- /dev/null +++ b/scripts/exglobal_atmos_pmgr.sh @@ -0,0 +1,80 @@ +#! /bin/ksh +# +# Script name: exgfs_pmgr.sh.sms +# +# This script monitors the progress of the gfs_fcst job +# +set -x + +hour=00 +typeset -Z2 hour + +case $RUN in + gfs) TEND=384 + TCP=385;; + gdas) TEND=9 + TCP=10;; +esac + +if [ -e posthours ]; then + rm -f posthours +fi + +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" + else + let "hour=hour+3" + fi +done +postjobs=`cat posthours` + +# +# Wait for all fcst hours to finish +# +icnt=1 +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 + ecflow_client --event release_postanl + fi +#### 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 + fi + + sleep 10 + icnt=$((icnt + 1)) + 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 + +exit diff --git a/sorc/link_workflow.sh b/sorc/link_workflow.sh index 946838c7cd..39db4889d7 100755 --- a/sorc/link_workflow.sh +++ b/sorc/link_workflow.sh @@ -85,24 +85,16 @@ fi #--add files from external repositories #--------------------------------------- cd ${pwd}/../jobs ||exit 8 - $LINK ../sorc/upp.fd/jobs/JGLOBAL_ATMOS_POST_MANAGER . - $LINK ../sorc/upp.fd/jobs/JGLOBAL_ATMOS_NCEPPOST . - $LINK ../sorc/gldas.fd/jobs/JGDAS_ATMOS_GLDAS . + $LINK ../sorc/gldas.fd/jobs/JGDAS_ATMOS_GLDAS . cd ${pwd}/../parm ||exit 8 [[ -d post ]] && rm -rf post $LINK ../sorc/upp.fd/parm post [[ -d gldas ]] && rm -rf gldas $LINK ../sorc/gldas.fd/parm gldas cd ${pwd}/../scripts ||exit 8 - $LINK ../sorc/upp.fd/scripts/exgdas_atmos_nceppost.sh . - $LINK ../sorc/upp.fd/scripts/exglobal_atmos_pmgr.sh . $LINK ../sorc/ufs_utils.fd/scripts/exemcsfc_global_sfc_prep.sh . $LINK ../sorc/gldas.fd/scripts/exgdas_atmos_gldas.sh . cd ${pwd}/../ush ||exit 8 - for file in fv3gfs_dwn_nems.sh gfs_nceppost.sh \ - gfs_transfer.sh mod_icec.sh link_crtm_fix.sh trim_rh.sh fix_precip.sh; do - $LINK ../sorc/upp.fd/ush/$file . - done for file in emcsfc_ice_blend.sh fv3gfs_driver_grid.sh fv3gfs_make_orog.sh global_cycle_driver.sh \ emcsfc_snow.sh fv3gfs_filter_topo.sh global_cycle.sh fv3gfs_make_grid.sh ; do $LINK ../sorc/ufs_utils.fd/ush/$file . diff --git a/ush/fix_precip.sh b/ush/fix_precip.sh new file mode 100755 index 0000000000..62912b4408 --- /dev/null +++ b/ush/fix_precip.sh @@ -0,0 +1,13 @@ + #!/bin/sh + # + # usage $0 output (list of gfs grib2 forecast files in order) + # + C=":APCP:surface:" + D=":ACPCP:surface:" + F=":NCPCP:surface:" + output=$1 + shift 1 + cat $* | wgrib2 - -match "($C|$D|$F)" -set_grib_type c3 \ + -if "$C" -ncep_norm $output \ + -if "$D" -ncep_norm $output \ + -if "$F" -ncep_norm $output diff --git a/ush/fv3gfs_dwn_nems.sh b/ush/fv3gfs_dwn_nems.sh new file mode 100755 index 0000000000..4190e9525a --- /dev/null +++ b/ush/fv3gfs_dwn_nems.sh @@ -0,0 +1,109 @@ +#!/bin/ksh +set -x + +# 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. +# Wen Meng 10/2019: Use bilinear interpolation for LAND, It can trancate land-sea mask as 0 or 1. +# Wen Meng 11/2019: Teak sea ice cover via land-sea mask. + +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 MODICEC=${MODICEC:-$USHgfs/mod_icec.sh} + +export opt1=' -set_grib_type same -new_grid_winds earth ' +export opt21=' -new_grid_interpolation bilinear -if ' +export opt22=":(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 ' +if [ $machine = "S4" ]; then + 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" +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 $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 +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 diff --git a/ush/gfs_nceppost.sh b/ush/gfs_nceppost.sh new file mode 100755 index 0000000000..e99e9d2020 --- /dev/null +++ b/ush/gfs_nceppost.sh @@ -0,0 +1,433 @@ + +################################################################################ +#### UNIX Script Documentation Block +# . . +# Script name: gfs_nceppost.sh +# Script description: Posts the global pressure GRIB file +# +# Author: Mark Iredell Org: NP23 Date: 1999-05-01 +# +# Abstract: This script reads a single global GFS IO file and (optionally) +# a global flux file and creates a global pressure GRIB file. +# The resolution and generating code of the output GRIB file can also +# be set in the argument list. +# +# Script history log: +# 1999-05-01 Mark Iredell +# 2007-04-04 Huiya Chuang: Modify the script to run unified post +# 2012-06-04 Jun Wang: add grib2 option +# 2015-03-20 Lin Gan: add Perl for Post XML performance upgrade +# 2016-02-08 Lin Gan: Modify to use Vertical Structure +# 2018-02-05 Wen Meng: For EE2 standard, create gfs_nceppost.sh based +# global_nceppost.sh and change EXECglobal to EXECgfs; +# Remove legacy setting for reading non-nemsio model output +# and generating grib1 data +# 2019-06-02 Wen Meng: Remove the links of gfs fix files. +# 2021-06-11 Yali Mao: Instead of err_chk, 'exit $err' for wafsfile +# if POSTGPEXEC fails +# +# Usage: global_postgp.sh SIGINP FLXINP FLXIOUT PGBOUT PGIOUT IGEN +# +# Input script positional parameters: +# 1 Input sigma file +# defaults to $SIGINP +# 2 Input flux file +# defaults to $FLXINP +# 3 Output flux index file +# defaults to $FLXIOUT +# 4 Output pressure GRIB file +# defaults to $PGBOUT +# 5 Output pressure GRIB index file +# defaults to $PGIOUT, then to none +# 8 Model generating code, +# defaults to $IGEN, then to input sigma generating code +# +# Imported Shell Variables: +# SIGINP Input sigma file +# overridden by $1 +# FLXINP Input flux file +# overridden by $2 +# FLXIOUT Output flux index file +# overridden by $3 +# PGBOUT Output pressure GRIB file +# overridden by $4. If not defined, +# post will use the filename specified in +# the control file +# PGIOUT Output pressure GRIB index file +# overridden by $5; defaults to none +# IGEN Model generating code +# overridden by $8; defaults to input sigma generating code +##### Moorthi: Add new imported shell variable for running chgres +# CHGRESSH optional: the script to run chgres +# default to to ${USHglobal}/global_chgres.sh +# SIGLEVEL optional: the coordinate text file +# default to to /nwprod/fix/global_hyblev.l${LEVS}.txt +##### Chuang: Add new imported Shell Variable for ncep post +# OUTTYP Output file type read in by post +# 1: if user has a sigma file and needs post to run chgres to convert to gfs io file +# 2: if user already has a gfs io file +# 3: if user uses post to read sigma file directly +# 0: if user wishes to generate both gfsio and sigma files +# 4: if user uses post to read nemsio file directly +# VDATE Verifying date 10 digits yyyymmddhh +# GFSOUT Optional, 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 +# CTLFILE Optional, Your version of control file if not using operational one +# OVERPARMEXEC Optional, the executable for changing Grib KPDS ID +# default to to ${EXECglobal}/overparm_grib +# CHGRESTHREAD Optional, speed up chgres by using multiple threads +# default to 1 +# FILTER Optional, set to 1 to filter SLP and 500 mb height using copygb +# D3DINP Optional, Inout D3D file, if not defined, post will run +# without processing D3D file +# D3DOUT Optional, output D3D file, if not defined, post will +# use the file name specified in the control file +# IPVOUT Optional, output IPV file, if not defined, post will +# use the file name specified in the control file +# GENPSICHI Optional, set to YES will generate psi and chi and +# append it to the end of PGBOUT. Default to NO +# GENPSICHIEXE Optional, specify where executable is for generating +# psi and chi. +######################################################################## +# EXECUTIL Directory for utility executables +# defaults to /nwprod/util/exec +# USHUTIL Directory for utility scripts +# defaults to /nwprod/util/ush +# EXECglobal Directory for global executables +# defaults to /nwprod/exec +# USHglobal Directory for global scripts +# defaults to /nwprod/ush +# DATA working directory +# (if nonexistent will be made, used and deleted) +# defaults to current working directory +# MP Multi-processing type ("p" or "s") +# defaults to "p", or "s" if LOADL_STEP_TYPE is not PARALLEL +# XC Suffix to add to executables +# defaults to none +# POSTGPEXEC Global post executable +# defaults to ${EXECglobal}/ncep_post +# GRBINDEX GRIB index maker +# defaults to ${EXECUTIL}/grbindex$XC +# POSTGPLIST File containing further namelist inputs +# defaults to /dev/null +# INISCRIPT Preprocessing script +# defaults to none +# LOGSCRIPT Log posting script +# defaults to none +# ERRSCRIPT Error processing script +# defaults to 'eval [[ $err = 0 ]]' +# ENDSCRIPT Postprocessing script +# defaults to none +# POSTGPVARS Other namelist inputs to the global post executable +# such as IDRT,KO,PO,KTT,KT,PT,KZZ,ZZ, +# NCPUS,MXBIT,IDS,POB,POT,MOO,MOOA,MOW,MOWA, +# ICEN,ICEN2,IENST,IENSI +# defaults to none set +# NTHREADS Number of threads +# defaults to 1 +# NTHSTACK Size of stack per thread +# defaults to 64000000 +# VERBOSE Verbose flag (YES or NO) +# defaults to NO +# PGMOUT Executable standard output +# defaults to $pgmout, then to '&1' +# PGMERR Executable standard error +# defaults to $pgmerr, then to '&1' +# pgmout Executable standard output default +# pgmerr Executable standard error default +# REDOUT standard output redirect ('1>' or '1>>') +# defaults to '1>', or to '1>>' to append if $PGMOUT is a file +# REDERR standard error redirect ('2>' or '2>>') +# defaults to '2>', or to '2>>' to append if $PGMERR is a file +# +# Exported Shell Variables: +# PGM Current program name +# pgm +# ERR Last return code +# err +# +# Modules and files referenced: +# scripts : $INISCRIPT +# $LOGSCRIPT +# $ERRSCRIPT +# $ENDSCRIPT +# +# programs : $POSTGPEXEC +# $GRBINDEX +# +# input data : $1 or $SIGINP +# $2 or $SFCINP +# $POSTGPLIST +# +# output data: $3 or $FLXIOUT +# $4 or $PGBOUT +# $5 or $PGIOUT +# $PGMOUT +# $PGMERR +# +# scratch : ${DATA}/postgp.inp.sig +# ${DATA}/postgp.inp.flx +# ${DATA}/postgp.out.pgb +# +# Remarks: +# +# Condition codes +# 0 - no problem encountered +# >0 - some problem encountered +# +# Control variable resolution priority +# 1 Command line argument. +# 2 Environment variable. +# 3 Inline default. +# +# Attributes: +# Language: POSIX shell +# Machine: IBM SP +# +#### +################################################################################ +# Set environment. +export VERBOSE=${VERBOSE:-"NO"} +if [[ "$VERBOSE" = "YES" ]] +then + echo $(date) EXECUTING $0 $* >&2 + set -x +fi +# Command line arguments. +export SIGINP=${1:-${SIGINP}} +export FLXINP=${2:-${FLXINP}} +export FLXIOUT=${3:-${FLXIOUT}} +export PGBOUT=${4:-${PGBOUT}} +#export PGIOUT=${5:-${PGIOUT}} +export PGIOUT=${PGIOUT:-pgb.idx} +export IO=${6:-${IO:-0}} +export JO=${7:-${JO:-0}} +export IGEN=${8:-${IGEN:-0}} +# Directories. +export NWPROD=${NWPROD:-/nwprod} +#export EXECUTIL=${EXECUTIL:-$NWPROD/util/exec} +export USHUTIL=${USHUTIL:-$NWPROD/util/ush} +export EXECgfs=${EXECgfs:-$NWPROD/exec} +export USHgfs=${USHgfs:-$NWPROD/ush} +export DATA=${DATA:-$(pwd)} +# Filenames. +export MP=${MP:-$([[ $LOADL_STEP_TYPE = PARALLEL ]]&&echo "p"||echo "s")} +export XC=${XC} +export POSTGPEXEC=${POSTGPEXEC:-${EXECgfs}/gfs_ncep_post} +export OVERPARMEXEC=${OVERPARMEXEC:-${EXECgfs}/overparm_grib} +export POSTGPLIST=${POSTGPLIST:-/dev/null} +export INISCRIPT=${INISCRIPT} +export ERRSCRIPT=${ERRSCRIPT:-'eval [[ $err = 0 ]]'} +export LOGSCRIPT=${LOGSCRIPT} +export ENDSCRIPT=${ENDSCRIPT} +export GFSOUT=${GFSOUT:-gfsout} +export CTLFILE=${CTLFILE:-$NWPROD/parm/gfs_cntrl.parm} +#export MODEL_OUT_FORM=${MODEL_OUT_FORM:-binarynemsiompiio} +export OUTPUT_FILE=${OUTPUT_FILE:-"nemsio"} +export GRIBVERSION=${GRIBVERSION:-'grib1'} +# Other variables. +export POSTGPVARS=${POSTGPVARS} +export NTHREADS=${NTHREADS:-1} +export NTHSTACK=${NTHSTACK:-64000000} +export PGMOUT=${PGMOUT:-${pgmout:-'&1'}} +export PGMERR=${PGMERR:-${pgmerr:-'&2'}} +export CHGRESTHREAD=${CHGRESTHREAD:-1} +export FILTER=${FILTER:-0} +export GENPSICHI=${GENPSICHI:-NO} +export GENPSICHIEXE=${GENPSICHIEXE:-${EXECgfs}/genpsiandchi} +export ens=${ens:-NO} +#export D3DINP=${D3DINP:-/dev/null} +typeset -L1 l=$PGMOUT +[[ $l = '&' ]]&&a=''||a='>' +export REDOUT=${REDOUT:-'1>'$a} +typeset -L1 l=$PGMERR +[[ $l = '&' ]]&&a=''||a='>' +export REDERR=${REDERR:-'2>'$a} +################################################################################ +# Preprocessing +$INISCRIPT + +# Chuang: Run chgres if OUTTYP=1 or 0 + +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 +fi + +export SIGHDR=${SIGHDR:-$NWPROD/exec/global_sighdr} +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} +fi + +# allow threads to use threading in Jim's sp lib +# but set default to 1 +export OMP_NUM_THREADS=${OMP_NUM_THREADS:-1} + +pwd=$(pwd) +if [[ -d $DATA ]] +then + mkdata=NO +else + mkdir -p $DATA + mkdata=YES +fi +cd $DATA||exit 99 +################################################################################ +# Post GRIB +export PGM=$POSTGPEXEC +export pgm=$PGM +$LOGSCRIPT +cat <postgp.inp.nml$$ + &NAMPGB + $POSTGPVARS +EOF + +cat <>postgp.inp.nml$$ +/ +EOF + +if [[ "$VERBOSE" = "YES" ]] +then + cat postgp.inp.nml$$ +fi + +# making the time stamp format for ncep post +export YY=`echo $VDATE | cut -c1-4` +export MM=`echo $VDATE | cut -c5-6` +export DD=`echo $VDATE | cut -c7-8` +export HH=`echo $VDATE | cut -c9-10` + +cat > itag <> itag + +cat itag + +rm -f fort.* + +#ln -sf $SIGINP postgp.inp.sig$$ +#ln -sf $FLXINP postgp.inp.flx$$ +#ln -sf $PGBOUT postgp.out.pgb$$ + +# 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 + +fi +export CTL=`basename $CTLFILE` + +ln -sf griddef.out fort.110 +cp ${PARMpost}/nam_micro_lookup.dat ./eta_micro_lookup.dat + +echo "gfs_nceppost.sh OMP_NUM_THREADS= $OMP_NUM_THREADS" +${APRUN:-mpirun.lsf} $POSTGPEXEC < itag > outpost_gfs_${VDATE}_${CTL} + +export ERR=$? +export err=$ERR + +if [ $err -ne 0 ] ; then + 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 + +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 +fi +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 +fi +################################################################################ +# Postprocessing +cd $pwd +[[ $mkdata = YES ]]&&rmdir $DATA +$ENDSCRIPT +set +x +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 new file mode 100755 index 0000000000..028004d904 --- /dev/null +++ b/ush/gfs_transfer.sh @@ -0,0 +1,85 @@ +#!/bin/ksh + +##################################################################### +echo "-----------------------------------------------------" +echo " Script: gfs_transfer.sh" +echo " " +echo " Purpose - Copy GFS Posts to /nwges and /com" +echo " Alert posted files to DBNet" +echo " " +echo " History - " +echo " Cooke - 04/21/05 - Inital version, based off of" +echo " global_transfer.sh" +echo " Meng - 01/04/18 - Remove writing data file to /nwges." +echo " Meng - 09/14/20 - Update model output format to netcdf for GFS V16" +echo "-----------------------------------------------------" +##################################################################### +set -xa + +# export CNVGRIB=/nwprod/util/exec/cnvgrib +# export GRB2INDX=/nwprod/util/exec/grb2index +# export WGRIB2=/nwprod/util/exec/wgrib2 + + +#if test "$SENDCOM" = "YES" +#then + # + # Save Pressure and SFLUX GRIB/GRIB Index files + # +# cp flxifile $COMOUT/${RUN}.${cycle}.sfluxgrbif$fhr + +# Chuang: keeping gfs surface files around because post and dng +# use them now + #if [[ $fhr -gt 84 ]] + #then + # if [[ $fhr -ne 120 && $fhr -ne 168 ]] + # then + # rm $COMOUT/${RUN}.${cycle}.bf$fhr + # fi + #fi +#fi + +############################################ +# Convert the sflux file to grib2 format: +############################################ +#cp $COMIN/${RUN}.${cycle}.sfluxgrbf$fhr sfluxgrbf$fhr +#if [ `expr $fhr % 3` -eq 0 ]; then +#$CNVGRIB -g12 -p40 $COMIN/${RUN}.${cycle}.sfluxgrbf$fhr sfluxgrbf${fhr}.grib2 +#$WGRIB2 sfluxgrbf${fhr}.grib2 -s> sfluxgrbf${fhr}.grib2.idx + +#if [ $SENDCOM = YES ] +#then +# cp sfluxgrbf${fhr}.grib2 $COMOUT/${RUN}.${cycle}.sfluxgrbf${fhr}.grib2 +# cp sfluxgrbf${fhr}.grib2.idx $COMOUT/${RUN}.${cycle}.sfluxgrbf${fhr}.grib2.idx +#fi + +#fi +# +# DBNet Alerts for gfs suite +# + +if test "$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 + #echo $DBNROOT/bin/dbn_alert MODEL GFS_SGB_GB2 $job $COMOUT/${RUN}.${cycle}.sfluxgrbf${fhr}.grib2 + #echo $DBNROOT/bin/dbn_alert MODEL GFS_SGB_GB2_WIDX $job $COMOUT/${RUN}.${cycle}.sfluxgrbf${fhr}.grib2.idx + #fi + + 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 + $DBNROOT/bin/dbn_alert MODEL GFS_BF $job $COMOUT/${RUN}.t${cyc}z.sfcf$fhr.nc + fi + if [[ $fhr -eq 120 ]] + then + $DBNROOT/bin/dbn_alert MODEL GFS_BF $job $COMOUT/${RUN}.t${cyc}z.sfcf$fhr.nc + fi +fi + +exit 0 + diff --git a/ush/global_nceppost.sh b/ush/global_nceppost.sh new file mode 100755 index 0000000000..65fde56cf1 --- /dev/null +++ b/ush/global_nceppost.sh @@ -0,0 +1,505 @@ + +################################################################################ +#### UNIX Script Documentation Block +# . . +# Script name: global_nceppost.sh +# Script description: Posts the global pressure GRIB file +# +# Author: Mark Iredell Org: NP23 Date: 1999-05-01 +# +# Abstract: This script reads a single global GFS IO file and (optionally) +# a global flux file and creates a global pressure GRIB file. +# The resolution and generating code of the output GRIB file can also +# be set in the argument list. +# +# Script history log: +# 1999-05-01 Mark Iredell +# 2007-04-04 Huiya Chuang: Modify the script to run unified post +# 2012-06-04 Jun Wang: add grib2 option +# 2015-03-20 Lin Gan: add Perl for Post XML performance upgrade +# 2016-02-08 Lin Gan: Modify to use Vertical Structure +# +# Usage: global_postgp.sh SIGINP FLXINP FLXIOUT PGBOUT PGIOUT IGEN +# +# Input script positional parameters: +# 1 Input sigma file +# defaults to $SIGINP +# 2 Input flux file +# defaults to $FLXINP +# 3 Output flux index file +# defaults to $FLXIOUT +# 4 Output pressure GRIB file +# defaults to $PGBOUT +# 5 Output pressure GRIB index file +# defaults to $PGIOUT, then to none +# 8 Model generating code, +# defaults to $IGEN, then to input sigma generating code +# +# Imported Shell Variables: +# SIGINP Input sigma file +# overridden by $1 +# FLXINP Input flux file +# overridden by $2 +# FLXIOUT Output flux index file +# overridden by $3 +# PGBOUT Output pressure GRIB file +# overridden by $4. If not defined, +# post will use the filename specified in +# the control file +# PGIOUT Output pressure GRIB index file +# overridden by $5; defaults to none +# IGEN Model generating code +# overridden by $8; defaults to input sigma generating code +##### Moorthi: Add new imported shell variable for running chgres +# CHGRESSH optional: the script to run chgres +# default to to ${USHglobal}/global_chgres.sh +# SIGLEVEL optional: the coordinate text file +# default to to /nwprod/fix/global_hyblev.l${LEVS}.txt +##### Chuang: Add new imported Shell Variable for ncep post +# OUTTYP Output file type read in by post +# 1: if user has a sigma file and needs post to run chgres to convert to gfs io file +# 2: if user already has a gfs io file +# 3: if user uses post to read sigma file directly +# 0: if user wishes to generate both gfsio and sigma files +# 4: if user uses post to read nemsio file directly +# VDATE Verifying date 10 digits yyyymmddhh +# GFSOUT Optional, 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 +# CTLFILE Optional, Your version of control file if not using operational one +# OVERPARMEXEC Optional, the executable for changing Grib KPDS ID +# default to to ${EXECglobal}/overparm_grib +# CHGRESTHREAD Optional, speed up chgres by using multiple threads +# default to 1 +# FILTER Optional, set to 1 to filter SLP and 500 mb height using copygb +# D3DINP Optional, Inout D3D file, if not defined, post will run +# without processing D3D file +# D3DOUT Optional, output D3D file, if not defined, post will +# use the file name specified in the control file +# IPVOUT Optional, output IPV file, if not defined, post will +# use the file name specified in the control file +# GENPSICHI Optional, set to YES will generate psi and chi and +# append it to the end of PGBOUT. Default to NO +# GENPSICHIEXE Optional, specify where executable is for generating +# psi and chi. +######################################################################## +# EXECUTIL Directory for utility executables +# defaults to /nwprod/util/exec +# USHUTIL Directory for utility scripts +# defaults to /nwprod/util/ush +# EXECglobal Directory for global executables +# defaults to /nwprod/exec +# USHglobal Directory for global scripts +# defaults to /nwprod/ush +# DATA working directory +# (if nonexistent will be made, used and deleted) +# defaults to current working directory +# MP Multi-processing type ("p" or "s") +# defaults to "p", or "s" if LOADL_STEP_TYPE is not PARALLEL +# XC Suffix to add to executables +# defaults to none +# POSTGPEXEC Global post executable +# defaults to ${EXECglobal}/ncep_post +# GRBINDEX GRIB index maker +# defaults to ${EXECUTIL}/grbindex$XC +# ANOMCATSH Global anomaly GRIB script +# defaults to ${USHglobal/global_anomcat.sh +# POSTGPLIST File containing further namelist inputs +# defaults to /dev/null +# INISCRIPT Preprocessing script +# defaults to none +# LOGSCRIPT Log posting script +# defaults to none +# ERRSCRIPT Error processing script +# defaults to 'eval [[ $err = 0 ]]' +# ENDSCRIPT Postprocessing script +# defaults to none +# POSTGPVARS Other namelist inputs to the global post executable +# such as IDRT,KO,PO,KTT,KT,PT,KZZ,ZZ, +# NCPUS,MXBIT,IDS,POB,POT,MOO,MOOA,MOW,MOWA, +# ICEN,ICEN2,IENST,IENSI +# defaults to none set +# NTHREADS Number of threads +# defaults to 1 +# NTHSTACK Size of stack per thread +# defaults to 64000000 +# VERBOSE Verbose flag (YES or NO) +# defaults to NO +# PGMOUT Executable standard output +# defaults to $pgmout, then to '&1' +# PGMERR Executable standard error +# defaults to $pgmerr, then to '&1' +# pgmout Executable standard output default +# pgmerr Executable standard error default +# REDOUT standard output redirect ('1>' or '1>>') +# defaults to '1>', or to '1>>' to append if $PGMOUT is a file +# REDERR standard error redirect ('2>' or '2>>') +# defaults to '2>', or to '2>>' to append if $PGMERR is a file +# +# Exported Shell Variables: +# PGM Current program name +# pgm +# ERR Last return code +# err +# +# Modules and files referenced: +# scripts : $INISCRIPT +# $LOGSCRIPT +# $ERRSCRIPT +# $ENDSCRIPT +# $ANOMCATSH +# +# programs : $POSTGPEXEC +# $GRBINDEX +# +# input data : $1 or $SIGINP +# $2 or $SFCINP +# $POSTGPLIST +# +# output data: $3 or $FLXIOUT +# $4 or $PGBOUT +# $5 or $PGIOUT +# $PGMOUT +# $PGMERR +# +# scratch : ${DATA}/postgp.inp.sig +# ${DATA}/postgp.inp.flx +# ${DATA}/postgp.out.pgb +# +# Remarks: +# +# Condition codes +# 0 - no problem encountered +# >0 - some problem encountered +# +# Control variable resolution priority +# 1 Command line argument. +# 2 Environment variable. +# 3 Inline default. +# +# Attributes: +# Language: POSIX shell +# Machine: IBM SP +# +#### +################################################################################ +# Set environment. +export VERBOSE=${VERBOSE:-"NO"} +if [[ "$VERBOSE" = "YES" ]] +then + echo $(date) EXECUTING $0 $* >&2 + set -x +fi +# Command line arguments. +export SIGINP=${1:-${SIGINP}} +export FLXINP=${2:-${FLXINP}} +export FLXIOUT=${3:-${FLXIOUT}} +export PGBOUT=${4:-${PGBOUT}} +#export PGIOUT=${5:-${PGIOUT}} +export PGIOUT=${PGIOUT:-pgb.idx} +export IO=${6:-${IO:-0}} +export JO=${7:-${JO:-0}} +export IGEN=${8:-${IGEN:-0}} +# Directories. +export NWPROD=${NWPROD:-/nwprod} +#export EXECUTIL=${EXECUTIL:-$NWPROD/util/exec} +export USHUTIL=${USHUTIL:-$NWPROD/util/ush} +export EXECglobal=${EXECglobal:-$NWPROD/exec} +export USHglobal=${USHglobal:-$NWPROD/ush} +export DATA=${DATA:-$(pwd)} +# Filenames. +export MP=${MP:-$([[ $LOADL_STEP_TYPE = PARALLEL ]]&&echo "p"||echo "s")} +export XC=${XC} +export POSTGPEXEC=${POSTGPEXEC:-${EXECglobal}/ncep_post} +export OVERPARMEXEC=${OVERPARMEXEC:-${EXECglobal}/overparm_grib} +export ANOMCATSH=${ANOMCATSH:-${USHglobal}/global_anomcat.sh} +export CHGRESSH=${CHGRESSH:-${USHglobal}/global_chgres.sh} +export POSTGPLIST=${POSTGPLIST:-/dev/null} +export INISCRIPT=${INISCRIPT} +export ERRSCRIPT=${ERRSCRIPT:-'eval [[ $err = 0 ]]'} +export LOGSCRIPT=${LOGSCRIPT} +export ENDSCRIPT=${ENDSCRIPT} +export GFSOUT=${GFSOUT:-gfsout} +export CTLFILE=${CTLFILE:-$NWPROD/parm/gfs_cntrl.parm} +export MODEL_OUT_FORM=${MODEL_OUT_FORM:-binarynemsiompiio} +export GRIBVERSION=${GRIBVERSION:-'grib1'} +# Other variables. +export POSTGPVARS=${POSTGPVARS} +export NTHREADS=${NTHREADS:-1} +export NTHSTACK=${NTHSTACK:-64000000} +export PGMOUT=${PGMOUT:-${pgmout:-'&1'}} +export PGMERR=${PGMERR:-${pgmerr:-'&2'}} +export CHGRESTHREAD=${CHGRESTHREAD:-1} +export FILTER=${FILTER:-1} +export GENPSICHI=${GENPSICHI:-NO} +export GENPSICHIEXE=${GENPSICHIEXE:-${EXECglobal}/genpsiandchi} +export ens=${ens:-NO} +#export D3DINP=${D3DINP:-/dev/null} +typeset -L1 l=$PGMOUT +[[ $l = '&' ]]&&a=''||a='>' +export REDOUT=${REDOUT:-'1>'$a} +typeset -L1 l=$PGMERR +[[ $l = '&' ]]&&a=''||a='>' +export REDERR=${REDERR:-'2>'$a} +################################################################################ +# Preprocessing +$INISCRIPT + +# Chuang: Run chgres if OUTTYP=1 or 0 + +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 +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 + +# 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} + +# 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 +fi + +# allow threads to use threading in Jim's sp lib +# but set default to 1 +export OMP_NUM_THREADS=${OMP_NUM_THREADS:-1} + +pwd=$(pwd) +if [[ -d $DATA ]] +then + mkdata=NO +else + mkdir -p $DATA + mkdata=YES +fi +cd $DATA||exit 99 +################################################################################ +# Post GRIB +export PGM=$POSTGPEXEC +export pgm=$PGM +$LOGSCRIPT +cat <postgp.inp.nml$$ + &NAMPGB + $POSTGPVARS +EOF + +cat <>postgp.inp.nml$$ + / +EOF +if [[ "$VERBOSE" = "YES" ]] +then + cat postgp.inp.nml$$ +fi + +# making the time stamp format for ncep post +export YY=`echo $VDATE | cut -c1-4` +export MM=`echo $VDATE | cut -c5-6` +export DD=`echo $VDATE | cut -c7-8` +export HH=`echo $VDATE | cut -c9-10` + +cat > itag <> itag + +cat itag + +rm -f fort.* + +#ln -sf $SIGINP postgp.inp.sig$$ +#ln -sf $FLXINP postgp.inp.flx$$ +#ln -sf $PGBOUT postgp.out.pgb$$ + +# 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 + +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 + +fi +export CTL=`basename $CTLFILE` + +ln -sf griddef.out fort.110 +cp ${PARMglobal}/nam_micro_lookup.dat ./eta_micro_lookup.dat + +${APRUN:-mpirun.lsf} $POSTGPEXEC < itag > outpost_gfs_${VDATE}_${CTL} + +export ERR=$? +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 + +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 +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 +fi +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 +fi +################################################################################ +# Postprocessing +cd $pwd +[[ $mkdata = YES ]]&&rmdir $DATA +$ENDSCRIPT +set +x +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 new file mode 100755 index 0000000000..1ce1085ecd --- /dev/null +++ b/ush/link_crtm_fix.sh @@ -0,0 +1,35 @@ +#! /bin/sh + +# Get CRTM fix directory from (in this order): +# 1. First argument to script, or +# 2. $FIXCRTM environment variable, or +# 3. Nowhere. Give up. Whine. +FIXCRTM="${1:-${FIXCRTM:-MISSING}}" + +if [[ "$FIXCRTM" == "MISSING" ]] ; then + 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 +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" . +done + +for what in 'Aerosol' 'Cloud' ; do + ln -s "$FIXCRTM/${what}Coeff.bin" . +done + +for what in $FIXCRTM/*Emis* ; do + ln -s $what . +done + +exit 0 diff --git a/ush/mod_icec.sh b/ush/mod_icec.sh new file mode 100755 index 0000000000..bb8c22182f --- /dev/null +++ b/ush/mod_icec.sh @@ -0,0 +1,23 @@ +#!/bin/sh +set -x +#This script is used for modifing icee via land-sea mask +#Wen Meng 11/2019: First Version + +f=$1 + +export WGRIB2=${WGRIB2:-${NWPROD:-/nwprod}/util/exec/wgrib2} + +$WGRIB2 $optncpu $f \ + -if 'LAND' -rpn 'sto_1' -fi \ + -if 'ICEC' -rpn 'rcl_1:0:==:*' -fi \ + -set_grib_type same \ + -set_scaling same same \ + -grib_out $f.new +export err=$?; err_chk +mv $f.new $f + +exit 0 + +#-if 'ICEC' -rpn 'rcl_1:-1:*:1:+:*' -fi \ + + diff --git a/ush/trim_rh.sh b/ush/trim_rh.sh new file mode 100755 index 0000000000..9140e97124 --- /dev/null +++ b/ush/trim_rh.sh @@ -0,0 +1,17 @@ +#!/bin/ksh +set -x + +#This is scripts is used to trim RH vaule larger than 100. +# Wen Meng 12/2017: First Version + +f=$1 + +export WGRIB2=${WGRIB2:-${NWPROD:-/nwprod}/util/exec/wgrib2} + +$WGRIB2 $optncpu $f -not_if ':RH:' -grib $f.new \ + -if ':RH:' -rpn "10:*:0.5:+:floor:1000:min:10:/" -set_grib_type same \ + -set_scaling -1 0 -grib_out $f.new +export err=$?; err_chk +mv $f.new $f + +exit 0