Skip to content

Commit bdc0e29

Browse files
Fix mod_icec bug in atmos_prod (NOAA-EMC#3167)
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
1 parent d85214d commit bdc0e29

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

ush/interp_atmos_master.sh

+5-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,11 @@ export err=$?; err_chk
5353
# trim and mask for all grids
5454
for grid in "${grids[@]}"; do
5555
trim_rh "${output_file_prefix}_${grid}"; export err=$?; err_chk
56-
mod_icec "${output_file_prefix}_${grid}"; export err=$?; err_chk
56+
# shellcheck disable=SC2312
57+
var_count=$(${WGRIB2} "${output_file_prefix}_${grid}" -match "LAND|ICEC" |wc -l)
58+
if [[ "${var_count}" -eq 2 ]]; then
59+
mod_icec "${output_file_prefix}_${grid}"; export err=$?; err_chk
60+
fi
5761
done
5862

5963
exit 0

0 commit comments

Comments
 (0)