Skip to content

Commit

Permalink
Fix mod_icec bug in atmos_prod (NOAA-EMC#3167)
Browse files Browse the repository at this point in the history
The purpose of this PR is to fix a bug that causes the ensstat task to
occasionally produce a segmentation fault error. This segmentation fault
error is due to undefined values not being skipped in the ensemble
spread and mean calculations in the ensstat program. The reason
undefined values were not being skipped is because variables with
undefined values were not using bitmap in the pgrb files. Ensstat
expects undefined variables to use bitmap, otherwise ensstat will not
skip those undefined values.

The undefined variables were not using bitmap because of a bug in the
atmos_prod task, where the mod_icec function was not being skipped for
grib2 files that did not contain the LAND and ICEC variables. In the
[offline
UPP](https://github.com/NOAA-EMC/UPP/blob/develop/ush/fv3gfs_dwn_nems.sh),
the mod_icec functionality was being executed when LAND and ICEC
variables existed in the grib2 file. This same condition has been
applied in this PR for mod_icec.

Resolves NOAA-EMC#3150
  • Loading branch information
EricSinsky-NOAA authored Dec 26, 2024
1 parent d85214d commit bdc0e29
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion ush/interp_atmos_master.sh
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,11 @@ export err=$?; err_chk
# trim and mask for all grids
for grid in "${grids[@]}"; do
trim_rh "${output_file_prefix}_${grid}"; export err=$?; err_chk
mod_icec "${output_file_prefix}_${grid}"; export err=$?; err_chk
# shellcheck disable=SC2312
var_count=$(${WGRIB2} "${output_file_prefix}_${grid}" -match "LAND|ICEC" |wc -l)
if [[ "${var_count}" -eq 2 ]]; then
mod_icec "${output_file_prefix}_${grid}"; export err=$?; err_chk
fi
done

exit 0

0 comments on commit bdc0e29

Please sign in to comment.