Skip to content

Commit

Permalink
Address shellcheck SC2250 and SC2086
Browse files Browse the repository at this point in the history
Update verfozn and verfrad driver scripts for shellcheck

Refs NOAA-EMC#1925
  • Loading branch information
KateFriedman-NOAA committed Dec 1, 2023
1 parent 92b225f commit 5a7c5f9
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 30 deletions.
14 changes: 7 additions & 7 deletions scripts/exgdas_atmos_verfozn.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,24 +21,24 @@ if [[ -s ${oznstat} ]]; then
# Untar oznstat file.
#------------------------------------------------------------------

$NCP $oznstat ./oznstat.${PDY}${cyc}
${NCP} "${oznstat}" "./oznstat.${PDY}${cyc}"

tar -xvf oznstat.${PDY}${cyc}
rm oznstat.${PDY}${cyc}
tar -xvf "oznstat.${PDY}${cyc}"
rm "oznstat.${PDY}${cyc}"

netcdf=0
count=$(ls diag* | grep ".nc4" | wc -l)
if [ $count -gt 0 ] ; then
if [ "${count}" -gt 0 ] ; then
netcdf=1
for filenc4 in $(ls diag*nc4.gz); do
file=$(echo $filenc4 | cut -d'.' -f1-2).gz
mv $filenc4 $file
file=$(echo "${filenc4}" | cut -d'.' -f1-2).gz
mv "${filenc4}" "${file}"
done
fi

export OZNMON_NETCDF=${netcdf}

${USHgfs}/ozn_xtrct.sh
"${USHgfs}/ozn_xtrct.sh"
err=$?

else
Expand Down
46 changes: 23 additions & 23 deletions scripts/exgdas_atmos_verfrad.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ if [[ -s ${radstat} && -s ${biascr} ]]; then
# Untar radstat file.
#------------------------------------------------------------------

$NCP "${biascr}" "./biascr.${PDY}${cyc}"
$NCP "${radstat}" "./radstat.${PDY}${cyc}"
${NCP} "${biascr}" "./biascr.${PDY}${cyc}"
${NCP} "${radstat}" "./radstat.${PDY}${cyc}"

tar -xvf "radstat.${PDY}${cyc}"
rm "radstat.${PDY}${cyc}"
Expand All @@ -44,7 +44,7 @@ if [[ -s ${radstat} && -s ${biascr} ]]; then
#------------------------------------------------------------------

radstat_satype=$(ls d*ges* | awk -F_ '{ print $2 "_" $3 }')
if [[ "$VERBOSE" = "YES" ]]; then
if [[ "${VERBOSE}" = "YES" ]]; then
echo "${radstat_satype}"
fi

Expand All @@ -55,7 +55,7 @@ if [[ -s ${radstat} && -s ${biascr} ]]; then
# the previous cycle will get us the previous day's directory if
# the cycle being processed is 00z.
#------------------------------------------------------------------
if [[ $cyc = "00" ]]; then
if [[ ${cyc} = "00" ]]; then
use_tankdir=${TANKverf_radM1}
else
use_tankdir=${TANKverf_rad}
Expand All @@ -71,16 +71,16 @@ if [[ -s ${radstat} && -s ${biascr} ]]; then
# to $TANKverf/radmon.$PDY.
#-------------------------------------------------------------
satype_changes=0
new_satype=$SATYPE
new_satype=${SATYPE}
for type in ${radstat_satype}; do
type_count=$(echo "${SATYPE}" | grep "${type}" | wc -l)

if (( type_count == 0 )); then
if [[ "$VERBOSE" = "YES" ]]; then
echo "Found $type in radstat file but not in SATYPE list. Adding it now."
if [[ "${VERBOSE}" = "YES" ]]; then
echo "Found ${type} in radstat file but not in SATYPE list. Adding it now."
fi
satype_changes=1
new_satype="$new_satype $type"
new_satype="${new_satype} ${type}"
fi
done

Expand All @@ -97,23 +97,23 @@ if [[ -s ${radstat} && -s ${biascr} ]]; then
fi

if [[ $(find . -maxdepth 1 -type f -name "diag_${type}_ges.${PDY}${cyc}*.${Z}" | wc -l) -gt 0 ]]; then
mv diag_${type}_ges.${PDY}${cyc}*.${Z} "${type}.${Z}"
mv "diag_${type}_ges.${PDY}${cyc}"*".${Z}" "${type}.${Z}"
${UNCOMPRESS} "./${type}.${Z}"
else
echo "WARNING: diag_${type}_ges.${PDY}${cyc}*.${Z} not available, skipping"
fi

if [[ $USE_ANL -eq 1 ]]; then
if [[ ${USE_ANL} -eq 1 ]]; then
if [[ $(find . -maxdepth 1 -type f -name "diag_${type}_anl.${PDY}${cyc}*.${Z}" | wc -l) -gt 0 ]]; then
mv diag_${type}_anl.${PDY}${cyc}*.${Z} "${type}_anl.${Z}"
mv "diag_${type}_anl.${PDY}${cyc}"*".${Z}" "${type}_anl.${Z}"
${UNCOMPRESS} "./${type}_anl.${Z}"
else
echo "WARNING: diag_${type}_anl.${PDY}${cyc}*.${Z} not available, skipping"
fi
fi
done

export RADMON_NETCDF=$netcdf
export RADMON_NETCDF=${netcdf}


#------------------------------------------------------------------
Expand All @@ -137,7 +137,7 @@ if [[ -s ${radstat} && -s ${biascr} ]]; then
if [[ ${CLEAN_TANKVERF:-0} -eq 1 ]]; then
"${USHradmon}/clean_tankdir.sh" glb 60
rc_clean_tankdir=$?
echo "rc_clean_tankdir = $rc_clean_tankdir"
echo "rc_clean_tankdir = ${rc_clean_tankdir}"
fi

fi
Expand All @@ -150,22 +150,22 @@ fi
err=0
if [[ ${data_available} -ne 1 ]]; then
err=1
elif [[ $rc_angle -ne 0 ]]; then
err=$rc_angle
elif [[ $rc_bcoef -ne 0 ]]; then
err=$rc_bcoef
elif [[ $rc_bcor -ne 0 ]]; then
err=$rc_bcor
elif [[ $rc_time -ne 0 ]]; then
err=$rc_time
elif [[ ${rc_angle} -ne 0 ]]; then
err=${rc_angle}
elif [[ ${rc_bcoef} -ne 0 ]]; then
err=${rc_bcoef}
elif [[ ${rc_bcor} -ne 0 ]]; then
err=${rc_bcor}
elif [[ ${rc_time} -ne 0 ]]; then
err=${rc_time}
fi

#####################################################################
# Restrict select sensors and satellites
export CHGRP_CMD=${CHGRP_CMD:-"chgrp ${group_name:-rstprod}"}
rlist="saphir"
for rtype in $rlist; do
if compgen -G "$TANKverf_rad/*${rtype}*" > /dev/null; then
for rtype in ${rlist}; do
if compgen -G "${TANKverf_rad}/"*"${rtype}"* > /dev/null; then
${CHGRP_CMD} "${TANKverf_rad}/"*"${rtype}"*
fi
done
Expand Down

0 comments on commit 5a7c5f9

Please sign in to comment.