Skip to content

Commit

Permalink
More double equals, double quotes, and double brackets
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidHuber-NOAA committed Feb 20, 2025
1 parent 77f94f3 commit 440ad19
Show file tree
Hide file tree
Showing 16 changed files with 148 additions and 148 deletions.
8 changes: 4 additions & 4 deletions scripts/exgdas_atmos_chgres_forenkf.sh
Original file line number Diff line number Diff line change
Expand Up @@ -126,13 +126,13 @@ if [ $DO_CALC_ANALYSIS == "YES" ]; then
export OMP_NUM_THREADS=$NTHREADS_CHGRES
SIGLEVEL=${SIGLEVEL:-${FIXgfs}/am/global_hyblev.l${LEVS_ENKF}.txt}

if [ $USE_CFP = "YES" ]; then
if [[ -f $DATA/mp_chgres.sh ]]; then
rm $DATA/mp_chgres.sh
if [[ "${USE_CFP}" == "YES" ]]; then
if [[ -f "${DATA}/mp_chgres.sh" ]]; then
rm "${DATA}/mp_chgres.sh"
fi
fi

nfhrs=$(echo $IAUFHRS_ENKF | sed 's/,/ /g')
nfhrs=$(echo "${IAUFHRS_ENKF}" | sed 's/,/ /g')
for FHR in $nfhrs; do
echo "Regridding deterministic forecast for forecast hour $FHR"
rm -f chgres_nc_gauss0$FHR.nml
Expand Down
14 changes: 7 additions & 7 deletions scripts/exgdas_enkf_ecen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ fi
cd $DATA || exit 99

ENKF_SUFFIX="s"
if [[ $SMOOTH_ENKF = "NO" ]]; then
if [[ "${SMOOTH_ENKF}" == "NO" ]]; then
ENKF_SUFFIX=""
fi

Expand Down Expand Up @@ -256,10 +256,10 @@ if [ $RECENTER_ENKF = "YES" ]; then

export OMP_NUM_THREADS=$NTHREADS_CHGRES

if [[ -f $chgresnml ]]; then
rm -f $chgresnml
if [[ -f "${chgresnml}" ]]; then
rm -f "${chgresnml}"
fi
cat > $chgresnml << EOF
cat > "${chgresnml}" << EOF
&${nmltitle}_setup
i_output=$LONB_ENKF
j_output=$LATB_ENKF
Expand Down Expand Up @@ -368,9 +368,9 @@ done # loop over analysis times in window
################################################################################
# Postprocessing
cd $pwd
if [[ $mkdata = "YES" ]]; then
rm -rf $DATA
if [[ "${mkdata}" == "YES" ]]; then
rm -rf "${DATA}"
fi


exit ${err}
exit "${err}"
8 changes: 4 additions & 4 deletions scripts/exgdas_enkf_post.sh
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ ENKF_SPREAD=${ENKF_SPREAD:-"NO"}
################################################################################
# Preprocessing
ENKF_SUFFIX="s"
if [[ $SMOOTH_ENKF = "NO" ]]; then
if [[ "${SMOOTH_ENKF}" == "NO" ]]; then
ENKF_SUFFIX=""
fi

Expand Down Expand Up @@ -95,16 +95,16 @@ for fhr in $(seq $FHMIN $FHOUT $FHMAX); do
${NLN} "${COMIN_ATMOS_HISTORY}/${PREFIX}atmf${fhrchar}${ENKF_SUFFIX}.nc" "atmf${fhrchar}${ENKF_SUFFIX}_${memchar}"
done
fi
if [[ $ENKF_SPREAD = "YES" ]]; then
if [[ "${ENKF_SPREAD}" == "YES" ]]; then
${NLN} "${COMOUT_ATMOS_HISTORY_STAT}/${PREFIX}atmf${fhrchar}.ensspread.nc" "atmf${fhrchar}.ensspread"
fi
done

################################################################################
# Generate ensemble mean surface and atmospheric files

if [[ $SMOOTH_ENKF = "YES" ]]; then
$NCP $HYBENSMOOTH ./hybens_smoothinfo
if [[ "${SMOOTH_ENKF}" == "YES" ]]; then
$NCP "${HYBENSMOOTH}" ./hybens_smoothinfo
fi

rc=0
Expand Down
4 changes: 2 additions & 2 deletions scripts/exgdas_enkf_select_obs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,8 @@ export err=$?; err_chk
################################################################################
# Postprocessing
cd $pwd
if [[ $mkdata = "YES" ]]; then
rm -rf $DATA
if [[ "${mkdata}" == "YES" ]]; then
rm -rf "${DATA}"
fi


Expand Down
4 changes: 2 additions & 2 deletions scripts/exgdas_enkf_sfc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,11 @@ LONB_CASE=$((res*4))
export FNTSFA=${FNTSFA:-' '}
export FNACNA=${FNACNA:-${COM_OBS}/${OPREFIX}seaice.5min.blend.grb}
export FNSNOA=${FNSNOA:-${COM_OBS}/${OPREFIX}snogrb_t${JCAP_CASE}.${LONB_CASE}.${LATB_CASE}}
if [[ ! -f $FNSNOA ]]; then
if [[ ! -f "${FNSNOA}" ]]; then
export FNSNOA="${COM_OBS}/${OPREFIX}snogrb_t1534.3072.1536"
fi
FNSNOG=${FNSNOG:-${COM_OBS_PREV}/${GPREFIX}snogrb_t${JCAP_CASE}.${LONB_CASE}.${LATB_CASE}}
if [[ ! -f $FNSNOG ]]; then
if [[ ! -f "${FNSNOG}" ]]; then
FNSNOG="${COM_OBS_PREV}/${GPREFIX}snogrb_t1534.3072.1536"
fi

Expand Down
14 changes: 7 additions & 7 deletions scripts/exgdas_enkf_update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ HYBENSINFO=${HYBENSINFO:-${FIXgfs}/gsi/global_hybens_info.l${LEVS_ENKF}.txt}
ANAVINFO=${ANAVINFO:-${FIXgfs}/gsi/global_anavinfo.l${LEVS_ENKF}.txt}
VLOCALEIG=${VLOCALEIG:-${FIXgfs}/gsi/vlocal_eig_l${LEVS_ENKF}.dat}
ENKF_SUFFIX="s"
if [[ $SMOOTH_ENKF = "NO" ]]; then
if [[ "${SMOOTH_ENKF}" == "NO" ]]; then
ENKF_SUFFIX=""
fi

Expand Down Expand Up @@ -149,13 +149,13 @@ ${NLN} "${COM_ATMOS_ANALYSIS_STAT}/${GBIASe}" "satbias_in"
################################################################################

if [ $USE_CFP = "YES" ]; then
if [[ -f $DATA/untar.sh ]]; then
rm $DATA/untar.sh
if [[ -f "${DATA}/untar.sh" ]]; then
rm "${DATA}/untar.sh"
fi
if [[ -f $DATA/mp_untar.sh ]]; then
rm $DATA/mp_untar.sh
if [[ -f "${DATA}/mp_untar.sh" ]]; then
rm "${DATA}/mp_untar.sh"
fi
cat > $DATA/untar.sh << EOFuntar
cat > "${DATA}/untar.sh" << EOFuntar
#!/bin/sh
memchar=\$1
COM_ATMOS_ANALYSIS=\$2
Expand Down Expand Up @@ -423,7 +423,7 @@ cat stdout stderr > "${COM_ATMOS_ANALYSIS_STAT}/${ENKFSTAT}"
################################################################################
# Postprocessing
cd "$pwd"
if [[ $mkdata = "YES" ]]; then
if [[ "${mkdata}" == "YES" ]]; then
rm -rf "${DATA}"
fi

Expand Down
56 changes: 28 additions & 28 deletions scripts/exglobal_atmos_analysis.sh
Original file line number Diff line number Diff line change
Expand Up @@ -500,8 +500,8 @@ ${NLN} ${ABIBF} abibufr
${NLN} ${HDOB} hdobbufr
${NLN} ${SSTVIIRS} sstviirs

if [[ ${DONST} = "YES" ]]; then
${NLN} ${NSSTBF} nsstbufr
if [[ "${DONST}" == "YES" ]]; then
${NLN} "${NSSTBF}" nsstbufr
fi

##############################################################
Expand All @@ -521,39 +521,39 @@ ${NLN} ${SFCG03} sfcf03
${NLN} ${SFCGES} sfcf06
${NLN} ${SFCG09} sfcf09

if [[ -f ${ATMG04} ]]; then
${NLN} ${ATMG04} sigf04
if [[ -f "${ATMG04}" ]]; then
${NLN} "${ATMG04}" sigf04
fi
if [[ -f ${ATMG05} ]]; then
${NLN} ${ATMG05} sigf05
if [[ -f "${ATMG05}" ]]; then
${NLN} "${ATMG05}" sigf05
fi
if [[ -f ${ATMG07} ]]; then
${NLN} ${ATMG07} sigf07
if [[ -f "${ATMG07}" ]]; then
${NLN} "${ATMG07}" sigf07
fi
if [[ -f ${ATMG08} ]]; then
${NLN} ${ATMG08} sigf08
if [[ -f "${ATMG08}" ]]; then
${NLN} "${ATMG08}" sigf08
fi

if [[ -f ${SFCG04} ]]; then
${NLN} ${SFCG04} sfcf04
if [[ -f "${SFCG04}" ]]; then
${NLN} "${SFCG04}" sfcf04
fi
if [[ -f ${SFCG05} ]]; then
${NLN} ${SFCG05} sfcf05
if [[ -f "${SFCG05}" ]]; then
${NLN} "${SFCG05}" sfcf05
fi
if [[ -f ${SFCG07} ]]; then
${NLN} ${SFCG07} sfcf07
if [[ -f "${SFCG07}" ]]; then
${NLN} "${SFCG07}" sfcf07
fi
if [[ -f ${SFCG08} ]]; then
${NLN} ${SFCG08} sfcf08
if [[ -f "${SFCG08}" ]]; then
${NLN} "${SFCG08}" sfcf08
fi

if [ ${DOHYBVAR} = "YES" ]; then
if [ "${DOHYBVAR}" == "YES" ]; then

# Link ensemble members
mkdir -p ensemble_data

ENKF_SUFFIX="s"
if [[ ${SMOOTH_ENKF} = "NO" ]]; then
if [[ "${SMOOTH_ENKF}" == "NO" ]]; then
ENKF_SUFFIX=""
fi

Expand Down Expand Up @@ -658,15 +658,15 @@ fi

##############################################################
# If requested, copy and de-tar guess radstat file
if [ ${USE_RADSTAT} = "YES" ]; then
if [ ${USE_CFP} = "YES" ]; then
if [[ -f ${DATA}/unzip.sh ]]; then
rm ${DATA}/unzip.sh
if [[ "${USE_RADSTAT}" == "YES" ]]; then
if [[ "${USE_CFP}" == "YES" ]]; then
if [[ -f "${DATA}/unzip.sh" ]]; then
rm "${DATA}/unzip.sh"
fi
if [[ -f ${DATA}/mp_unzip.sh ]]; then
rm ${DATA}/mp_unzip.sh
if [[ -f "${DATA}/mp_unzip.sh" ]]; then
rm "${DATA}/mp_unzip.sh"
fi
cat > ${DATA}/unzip.sh << EOFunzip
cat > "${DATA}/unzip.sh" << EOFunzip
#!/bin/sh
diag_file=\$1
diag_suffix=\$2
Expand Down Expand Up @@ -1007,7 +1007,7 @@ fi
################################################################################
# Postprocessing
cd ${pwd}
if [[ ${mkdata} = "YES" ]]; then
if [[ "${mkdata}" == "YES" ]]; then
rm -rf ${DATA}
fi

Expand Down
20 changes: 10 additions & 10 deletions scripts/exglobal_atmos_analysis_calc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -155,17 +155,17 @@ if [ $DO_CALC_ANALYSIS == "YES" ]; then
$NLN $ATMGES sigf06
$NLN $ATMG09 sigf09

if [[ -f $ATMG04 ]]; then
$NLN $ATMG04 sigf04
if [[ -f "${ATMG04}" ]]; then
$NLN "${ATMG04}" sigf04
fi
if [[ -f $ATMG05 ]]; then
$NLN $ATMG05 sigf05
if [[ -f "${ATMG05}" ]]; then
$NLN "${ATMG05}" sigf05
fi
if [[ -f $ATMG07 ]]; then
$NLN $ATMG07 sigf07
if [[ -f "${ATMG07}" ]]; then
$NLN "${ATMG07}" sigf07
fi
if [[ -f $ATMG08 ]]; then
$NLN $ATMG08 sigf08
if [[ -f "${ATMG08}" ]]; then
$NLN "${ATMG08}" sigf08
fi

# Link hourly backgrounds (if present)
Expand Down Expand Up @@ -194,8 +194,8 @@ echo "${rCDUMP} ${PDY}${cyc} atmanl and sfcanl done at $(date)" > "${COMOUT_ATMO
################################################################################
# Postprocessing
cd $pwd
if [[ $mkdata = "YES" ]]; then
rm -rf $DATA
if [[ "${mkdata}" == "YES" ]]; then
rm -rf "${DATA}"
fi


Expand Down
4 changes: 2 additions & 2 deletions scripts/exglobal_atmos_sfcanl.sh
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,11 @@ LONB_CASE=$((res*4))
export FNTSFA=${FNTSFA:-${COMIN_OBS}/${OPREFIX}rtgssthr.grb}
export FNACNA=${FNACNA:-${COMIN_OBS}/${OPREFIX}seaice.5min.blend.grb}
export FNSNOA=${FNSNOA:-${COMIN_OBS}/${OPREFIX}snogrb_t${JCAP_CASE}.${LONB_CASE}.${LATB_CASE}}
if [[ ! -f ${FNSNOA} ]]; then
if [[ ! -f "${FNSNOA}" ]]; then
export FNSNOA="${COMIN_OBS}/${OPREFIX}snogrb_t1534.3072.1536"
fi
FNSNOG=${FNSNOG:-${COMIN_OBS_PREV}/${GPREFIX}snogrb_t${JCAP_CASE}.${LONB_CASE}.${LATB_CASE}}
if [[ ! -f ${FNSNOG} ]]; then
if [[ ! -f "${FNSNOG}" ]]; then
FNSNOG="${COMIN_OBS_PREV}/${GPREFIX}snogrb_t1534.3072.1536"
fi

Expand Down
4 changes: 2 additions & 2 deletions scripts/exglobal_cleanup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ if [[ "${RUN}" == "gfs" ]]; then
fhmax=$((FHMAX_FITS + 36))
RDATE=$(date --utc +%Y%m%d%H -d "${PDY} ${cyc} -${fhmax} hours")
verify_dir="${ROTDIR}/vrfyarch/${RUN}.${RDATE:0:8}"
if [[ -d ${verify_dir} ]]; then
if [[ -d "${verify_dir}" ]]; then
rm -rf "${verify_dir}"
fi

Expand All @@ -94,7 +94,7 @@ if [[ "${RUN}" == "gfs" ]]; then
touch_PDY="${touch_date:0:8}"
touch_cyc="${touch_date:8:2}"
touch_dir="${ROTDIR}/vrfyarch/${RUN}.${touch_PDY}/${touch_cyc}"
if [[ -d ${touch_dir} ]]; then
if [[ -d "${touch_dir}" ]]; then
touch "${touch_dir}"/*
fi
touch_date=$(date --utc +%Y%m%d%H -d "${touch_PDY} ${touch_cyc} +6 hours")
Expand Down
30 changes: 15 additions & 15 deletions scripts/exglobal_diag.sh
Original file line number Diff line number Diff line change
Expand Up @@ -55,17 +55,17 @@ CNVSTAT=${CNVSTAT:-${COMOUT_ATMOS_ANALYSIS}/${APREFIX}cnvstat}
OZNSTAT=${OZNSTAT:-${COMOUT_ATMOS_ANALYSIS}/${APREFIX}oznstat}

# Remove stat file if file already exists
if [[ -s $RADSTAT ]]; then
rm -f $RADSTAT
if [[ -s "${RADSTAT}" ]]; then
rm -f "${RADSTAT}"
fi
if [[ -s $PCPSTAT ]]; then
rm -f $PCPSTAT
if [[ -s "${PCPSTAT}" ]]; then
rm -f "${PCPSTAT}"
fi
if [[ -s $CNVSTAT ]]; then
rm -f $CNVSTAT
if [[ -s "${CNVSTAT}" ]]; then
rm -f "${CNVSTAT}"
fi
if [[ -s $OZNSTAT ]]; then
rm -f $OZNSTAT
if [[ -s "${OZNSTAT}" ]]; then
rm -f "${OZNSTAT}"
fi

# Obs diag
Expand Down Expand Up @@ -132,13 +132,13 @@ if [ $GENDIAG = "YES" ] ; then
fi

if [ $USE_CFP = "YES" ]; then
if [[ -f $DATA/diag.sh ]]; then
rm $DATA/diag.sh
if [[ -f "${DATA}/diag.sh" ]]; then
rm "${DATA}/diag.sh"
fi
if [[ -f $DATA/mp_diag.sh ]]; then
rm $DATA/mp_diag.sh
if [[ -f "${DATA}/mp_diag.sh" ]]; then
rm "${DATA}/mp_diag.sh"
fi
cat > $DATA/diag.sh << EOFdiag
cat > "${DATA}/diag.sh" << EOFdiag
#!/bin/sh
lrun_subdirs=\$1
binary_diag=\$2
Expand Down Expand Up @@ -285,8 +285,8 @@ if [[ "$REMOVE_DIAG_DIR" = "YES" && "$err" = "0" ]]; then
fi

cd $pwd
if [[ "${mkdata:-YES}" = "YES" ]]; then
rm -rf $DATA
if [[ "${mkdata:-YES}" == "YES" ]]; then
rm -rf "${DATA}"
fi


Expand Down
Loading

0 comments on commit 440ad19

Please sign in to comment.