Skip to content

Commit

Permalink
modifed ush\wave_grib2_sbs.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
AntonMFernando-NOAA committed Dec 12, 2024
1 parent 4424330 commit 7328021
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions ush/wave_grib2_sbs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ if [[ -n ${waveMEMB} ]]; then ENSTAG=".${membTAG}${waveMEMB}" ; fi
outfile="${WAV_MOD_TAG}.${cycle}${ENSTAG}.${grdnam}.${grdres}.f${FH3}.grib2"

# Only create file if not present in COM
if [[ ! -s "${COMOUT_WAVE_GRID}/${outfile}.idx" ]]; then
if [[ ! -s "${COMOUT_WAVE_GRID}/${grdID}/${outfile}.idx" ]]; then

set +x
echo ' '
Expand All @@ -83,7 +83,7 @@ if [[ ! -s "${COMOUT_WAVE_GRID}/${outfile}.idx" ]]; then
set_trace

if [[ -z "${PDY}" ]] || [[ -z ${cyc} ]] || [[ -z "${cycle}" ]] || [[ -z "${EXECgfs}" ]] || \
[[ -z "${COMOUT_WAVE_GRID}" ]] || [[ -z "${WAV_MOD_TAG}" ]] || [[ -z "${gribflags}" ]] || \
[[ -z "${COMOUT_WAVE_GRID}/${grdID}" ]] || [[ -z "${WAV_MOD_TAG}" ]] || [[ -z "${gribflags}" ]] || \

Check failure

Code scanning / shellcheck

Argument to -z is always false due to literal strings. Error

Argument to -z is always false due to literal strings.
[[ -z "${GRIDNR}" ]] || [[ -z "${MODNR}" ]] || \
[[ -z "${SENDDBN}" ]]; then
set +x
Expand Down Expand Up @@ -157,11 +157,11 @@ if [[ ! -s "${COMOUT_WAVE_GRID}/${outfile}.idx" ]]; then
fi

if (( fhr > 0 )); then
${WGRIB2} gribfile -set_date "${PDY}${cyc}" -set_ftime "${fhr} hour fcst" -grib "${COMOUT_WAVE_GRID}/${outfile}"
${WGRIB2} gribfile -set_date "${PDY}${cyc}" -set_ftime "${fhr} hour fcst" -grib "${COMOUT_WAVE_GRID}/${grdID}/${outfile}"
err=$?
else
${WGRIB2} gribfile -set_date "${PDY}${cyc}" -set_ftime "${fhr} hour fcst" \
-set table_1.4 1 -set table_1.2 1 -grib "${COMOUT_WAVE_GRID}/${outfile}"
-set table_1.4 1 -set table_1.2 1 -grib "${COMOUT_WAVE_GRID}/${grdID}/${outfile}"
err=$?
fi

Expand All @@ -177,7 +177,7 @@ if [[ ! -s "${COMOUT_WAVE_GRID}/${outfile}.idx" ]]; then
fi

# Create index
${WGRIB2} -s "${COMOUT_WAVE_GRID}/${outfile}" > "${COMOUT_WAVE_GRID}/${outfile}.idx"
${WGRIB2} -s "${COMOUT_WAVE_GRID}/${grdID}/${outfile}" > "${COMOUT_WAVE_GRID}/${grdID}/${outfile}.idx"

# Create grib2 subgrid is this is the source grid
if [[ "${grdID}" = "${WAV_SUBGRBSRC}" ]]; then
Expand All @@ -186,8 +186,8 @@ if [[ ! -s "${COMOUT_WAVE_GRID}/${outfile}.idx" ]]; then
subgrbnam=$(echo ${!subgrb} | cut -d " " -f 21)
subgrbres=$(echo ${!subgrb} | cut -d " " -f 22)
subfnam="${WAV_MOD_TAG}.${cycle}${ENSTAG}.${subgrbnam}.${subgrbres}.f${FH3}.grib2"
${COPYGB2} -g "${subgrbref}" -i0 -x "${COMOUT_WAVE_GRID}/${outfile}" "${COMOUT_WAVE_GRID}/${subfnam}"
${WGRIB2} -s "${COMOUT_WAVE_GRID}/${subfnam}" > "${COMOUT_WAVE_GRID}/${subfnam}.idx"
${COPYGB2} -g "${subgrbref}" -i0 -x "${COMOUT_WAVE_GRID}/${grdID}/${outfile}" "${COMOUT_WAVE_GRID}/${grdID}/${subfnam}"
${WGRIB2} -s "${COMOUT_WAVE_GRID}/${grdID}/${subfnam}" > "${COMOUT_WAVE_GRID}/${grdID}/${subfnam}.idx"
done
fi

Expand All @@ -205,7 +205,7 @@ if [[ ! -s "${COMOUT_WAVE_GRID}/${outfile}.idx" ]]; then
set_trace
exit 4
fi
if [[ ! -s "${COMOUT_WAVE_GRID}/${outfile}.idx" ]]; then
if [[ ! -s "${COMOUT_WAVE_GRID}/${grdID}/${outfile}.idx" ]]; then
set +x
echo ' '
echo '*************************************************** '
Expand All @@ -220,11 +220,11 @@ if [[ ! -s "${COMOUT_WAVE_GRID}/${outfile}.idx" ]]; then

if [[ "${SENDDBN}" = 'YES' ]] && [[ ${outfile} != *global.0p50* ]]; then
set +x
echo " Alerting GRIB file as ${COMOUT_WAVE_GRID}/${outfile}"
echo " Alerting GRIB index file as ${COMOUT_WAVE_GRID}/${outfile}.idx"
echo " Alerting GRIB file as ${COMOUT_WAVE_GRID}/${grdID}/${outfile}"
echo " Alerting GRIB index file as ${COMOUT_WAVE_GRID}/${grdID}/${outfile}.idx"
set_trace
"${DBNROOT}/bin/dbn_alert" MODEL "${alertName}_WAVE_GB2" "${job}" "${COMOUT_WAVE_GRID}/${outfile}"
"${DBNROOT}/bin/dbn_alert" MODEL "${alertName}_WAVE_GB2_WIDX" "${job}" "${COMOUT_WAVE_GRID}/${outfile}.idx"
"${DBNROOT}/bin/dbn_alert" MODEL "${alertName}_WAVE_GB2" "${job}" "${COMOUT_WAVE_GRID}/${grdID}/${outfile}"
"${DBNROOT}/bin/dbn_alert" MODEL "${alertName}_WAVE_GB2_WIDX" "${job}" "${COMOUT_WAVE_GRID}/${grdID}/${outfile}.idx"
else
echo "${outfile} is global.0p50 or SENDDBN is NO, no alert sent"
fi
Expand All @@ -245,7 +245,7 @@ if [[ ! -s "${COMOUT_WAVE_GRID}/${outfile}.idx" ]]; then
else
set +x
echo ' '
echo " File ${COMOUT_WAVE_GRID}/${outfile} found, skipping generation process"
echo " File ${COMOUT_WAVE_GRID}/${grdID}/${outfile} found, skipping generation process"
echo ' '
set_trace
fi
Expand Down

0 comments on commit 7328021

Please sign in to comment.