Skip to content

Unbound variable (RSTDIR_ATM) in forecast_det.sh (minor bug) #1140

@DavidHuber-NOAA

Description

@DavidHuber-NOAA

Your bug may already be reported!
Please search on the Issue tracker before creating one.

Expected behavior

FV3_GFS_det should run without error when called during gdasfcst jobs. RSTDIR_ATM is only a required variable for gfsfcst jobs (set in forecast_predet.sh:212) and should not be referenced.

Current behavior

RSTDIR_ATM is referenced during both gdas and gfs fcst steps, resulting in an unbound error at forecast_det.sh:43 during gdasfcst. It appears that this unbound error only affects the find command within the command substitution and so flow continues with filecount=0, which does not affect on the remainder of the function. I'm not sure if this is the usual/constant behavior when set -u is toggled.

Machines affected

Found on Google Cloud.

To Reproduce

Run a gdasfcst job and check the resulting log.

Possible Implementation

Replace
filecount=$(find $RSTDIR_ATM -type f | wc -l)
with
[[ $CDUMP = "gfs" ]] && filecount=$(find $RSTDIR_ATM -type f | wc -l)
or
remove $CDUMP = "gfs" from the proceeding if and move the filecount assignment and the proceeding if into a new if [ $CDUMP = "gfs" ]; then block.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions