Skip to content

Commit

Permalink
Modify avgspr_meta to use both new/old COM
Browse files Browse the repository at this point in the history
 On branch feature/gefs_v13_atmos_prep
 Changes to be committed:
	modified:   gempak/ush/gefs_avgspr_meta.sh
	modified:   jobs/JGEFS_ATMOS_AVGSPR_GEMPAK_META

Refs: NOAA-EMC#103
  • Loading branch information
XianwuXue-NOAA committed Jan 30, 2023
1 parent a1ca49b commit 2af3341
Show file tree
Hide file tree
Showing 2 changed files with 78 additions and 15 deletions.
85 changes: 72 additions & 13 deletions gempak/ush/gefs_avgspr_meta.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,13 @@ if [[ ${STRICT:-NO} == "YES" ]]; then
fi

# datatypes.tbl uses COMIN, so have to update it locally
COMIN="$COMIN/$COMPONENT/gempak"
if [[ ${NewCOM:-"YES"} == "YES" ]]; then
COMINavg="${COMIN}/avg/${COMPONENT}/products/gempak"
COMINspr="${COMIN}/spr/${COMPONENT}/products/gempak"
else
COMINavg="${COMIN}/$COMPONENT/gempak"
COMINspr=${COMINavg}
fi

mkdir $DATA/gefs_avgspr
cd $DATA/gefs_avgspr
Expand All @@ -48,13 +54,39 @@ for area in natl mpac; do
for fcsthr in ${fcsthrs}; do

for fn in avg spr; do
rm -rf $fn
INFILE=${COMIN}/ge${fn}${sGrid}_${PDY}${cyc}f${fcsthr}
if [ -e ${fn} ]; then rm -rf ${fn}; fi
if [[ ${NewCOM:-"YES"} == "YES" ]]; then
INFILE=$[COMIN${fn}]/gefs${sGrid}_${PDY}${cyc}f${fcsthr}
else
INFILE=$[COMIN${avg}]/ge${fn}${sGrid}_${PDY}${cyc}f${fcsthr}
fi
if [ -r ${INFILE} ]; then
ln -s ${INFILE} $fn
fi
done

# fn=avg
# rm -rf $fn
# if [[ ${NewCOM:-"YES"} == "YES" ]]; then
# INFILE=${COMINavg}/gefs${sGrid}_${PDY}${cyc}f${fcsthr}
# else
# INFILE=${COMINavg}/ge${fn}${sGrid}_${PDY}${cyc}f${fcsthr}
# fi
# if [ -r ${INFILE} ]; then
# ln -s ${INFILE} $fn
# fi
#
# fn=spr
# rm -rf $fn
# if [[ ${NewCOM:-"YES"} == "YES" ]]; then
# INFILE=${COMINspr}/gefs${sGrid}_${PDY}${cyc}f${fcsthr}
# else
# INFILE=${COMINspr}/ge${fn}${sGrid}_${PDY}${cyc}f${fcsthr}
# fi
# if [ -r ${INFILE} ]; then
# ln -s ${INFILE} $fn
# fi

cat > cmdfile_meta <<- EOF
GDATTIM = F${fcsthr}
GAREA = ${garea}
Expand Down Expand Up @@ -155,16 +187,16 @@ for area in natl mpac; do
fi

if [ $SENDCOM = "YES" ] ; then
mv ${metaname} ${COMOUT}/$COMPONENT/gempak/meta/
mv ${metaname} ${COMOUT}/
if [ $SENDDBN = "YES" ] ; then
$DBNROOT/bin/dbn_alert MODEL ${DBN_ALERT_TYPE} $job ${COMOUT}/$COMPONENT/gempak/meta/${metaname}
$DBNROOT/bin/dbn_alert MODEL ${DBN_ALERT_TYPE} $job ${COMOUT}/${metaname}
fi
fi
done


# Make metafiles for North and South America...as well as Alaska.
ln -s $COMIN/geavg${sGrid}_${PDY}${cyc}f* ./
#ln -s $COMIN/geavg${sGrid}_${PDY}${cyc}f* ./

for area in nam sam ak; do
if [ ${area} = "nam" ] ; then
Expand Down Expand Up @@ -237,12 +269,39 @@ for area in nam sam ak; do

for fcsthr in ${fcsthrs}; do
for fn in avg spr; do
rm -rf $fn
if [ -r $COMIN/ge${fn}${sGrid}_${PDY}${cyc}f${fcsthr} ]; then
ln -s $COMIN/ge${fn}${sGrid}_${PDY}${cyc}f${fcsthr} $fn
if [ -e ${fn} ]; then rm -rf ${fn}; fi
if [[ ${NewCOM:-"YES"} == "YES" ]]; then
INFILE=$[COMIN${fn}]/gefs${sGrid}_${PDY}${cyc}f${fcsthr}
else
INFILE=$[COMIN${avg}]/ge${fn}${sGrid}_${PDY}${cyc}f${fcsthr}
fi
if [ -r ${INFILE} ]; then
ln -s ${INFILE} $fn
fi
done

# fn=avg
# if [ -e ${fn} ]; then rm -rf ${fn}; fi
# if [[ ${NewCOM:-"YES"} == "YES" ]]; then
# INFILE=${COMINavg}/gefs${sGrid}_${PDY}${cyc}f${fcsthr}
# else
# INFILE=${COMINavg}/ge${fn}${sGrid}_${PDY}${cyc}f${fcsthr}
# fi
# if [ -r ${INFILE} ]; then
# ln -s ${INFILE} $fn
# fi
#
# fn=spr
# if [ -e ${fn} ]; then rm -rf ${fn}; fi
# if [[ ${NewCOM:-"YES"} == "YES" ]]; then
# INFILE=${COMINspr}/gefs${sGrid}_${PDY}${cyc}f${fcsthr}
# else
# INFILE=${COMINspr}/ge${fn}${sGrid}_${PDY}${cyc}f${fcsthr}
# fi
# if [ -r ${INFILE} ]; then
# ln -s ${INFILE} $fn
# fi

cat > cmdfile_meta <<- EOF
GAREA = ${garea}
PROJ = ${proj}
Expand Down Expand Up @@ -341,7 +400,7 @@ for area in nam sam ak; do


# =====
COMINtemp=$COMIN
# COMINtemp=$COMIN
export COMIN=./

cp $FIXgempak/datatype${sGrid}.tbl datatype.tbl
Expand Down Expand Up @@ -417,7 +476,7 @@ for area in nam sam ak; do
exit $err
fi

export COMIN=$COMINtemp
# export COMIN=$COMINtemp

#####################################################
# GEMPAK DOES NOT ALWAYS HAVE A NON ZERO RETURN CODE
Expand All @@ -435,9 +494,9 @@ for area in nam sam ak; do
fi

if [ $SENDCOM = "YES" ] ; then
mv ${metaname} ${COMOUT}/$COMPONENT/gempak/meta/
mv ${metaname} ${COMOUT}/
if [ $SENDDBN = "YES" ] ; then
$DBNROOT/bin/dbn_alert MODEL ${DBN_ALERT_TYPE} $job ${COMOUT}/$COMPONENT/gempak/meta/${metaname}
$DBNROOT/bin/dbn_alert MODEL ${DBN_ALERT_TYPE} $job ${COMOUT}/${metaname}
fi
fi
done
Expand Down
8 changes: 6 additions & 2 deletions jobs/JGEFS_ATMOS_AVGSPR_GEMPAK_META
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,11 @@ export FIXgempak=${FIXgempak:-$GEMPAKgefs/fix}
# gefs_avgspr_meta.sh overrides COMIN locally to work with datatype.tbl
ver=${ver:-$(echo ${gefs_ver}|cut -c1-5)}
export COMIN=${COMIN:-$(compath.py $envir/com/$NET/${ver})/${RUN}.${PDY}/$cyc}
export COMOUT=${COMOUT:-$(compath.py -o $NET/${ver})/${RUN}.${PDY}/$cyc}
if [[ ${NewCOM:-"YES"} == "YES" ]]; then
export COMOUT=${COMOUT:-$(compath.py -o $NET/${ver})/${RUN}.${PDY}/${cyc}/avg/$COMPONENT/products/gempak/meta}
else
export COMOUT=${COMOUT:-$(compath.py -o $NET/${ver})/${RUN}.${PDY}/${cyc}/$COMPONENT/gempak/meta}
fi

#############################
# Source relevant config files
Expand All @@ -86,7 +90,7 @@ for config in $configs; do
done

export COMPONENT=${COMPONENT:-atmos}
if [[ $SENDCOM == "YES" && ! -d $COMOUT/$COMPONENT/gempak/meta ]]; then mkdir -p -m 755 $COMOUT/$COMPONENT/gempak/meta; fi
if [[ $SENDCOM == "YES" && ! -d $COMOUT ]]; then mkdir -p -m 755 $COMOUT; fi

echo "Environment before calling script"
env | sort
Expand Down

0 comments on commit 2af3341

Please sign in to comment.