diff --git a/tools/grib_get_data.c b/tools/grib_get_data.c index c1d137fd9..be683343c 100644 --- a/tools/grib_get_data.c +++ b/tools/grib_get_data.c @@ -70,18 +70,6 @@ int grib_tool_new_file_action(grib_runtime_options* options,grib_tools_file* fil return 0; } -/* Return 1 if the GRIB message has missing values encoded in data section and not in bitmap */ -/* e.g. grid_complex_spatial_differencing with missingValueManagementUsed enabled */ -static int hasMissingValuesButNoBitmap(grib_handle* h) -{ - long missingValueManagementUsed = 0; - int err = grib_get_long(h, "missingValueManagementUsed", &missingValueManagementUsed); - if (!err) { - /* Key exists */ - return (missingValueManagementUsed!=0); - } - return 0; -} int grib_tool_new_handle_action(grib_runtime_options* options, grib_handle* h) { int err=0; @@ -102,9 +90,7 @@ int grib_tool_new_handle_action(grib_runtime_options* options, grib_handle* h) double *data_values=0,*lats=0,*lons=0; int n = 0; size_t size=0; - /* Cater for GRIBs which have missing values but no bitmap! */ - /* e.g. grid_complex_spatial_differencing with 'missingValueManagementUsed' enabled */ - const int missingValuesButNoBitmap = hasMissingValuesButNoBitmap(h); + long hasMissingValues = 0; if (grib_options_on("m:")) { /* User wants to see missing values */ @@ -171,6 +157,9 @@ int grib_tool_new_handle_action(grib_runtime_options* options, grib_handle* h) exit(err); } + /* Cater for GRIBs which have missing values but no bitmap */ + /* See ECC-511 */ + GRIB_CHECK(grib_get_long(h,"missingValuesPresent",&hasMissingValues),0); GRIB_CHECK(grib_get_long(h,"bitmapPresent",&bitmapPresent),0); if (bitmapPresent) { @@ -196,9 +185,10 @@ int grib_tool_new_handle_action(grib_runtime_options* options, grib_handle* h) if (skip_missing==0){ /* Show missing values in data */ for (i=0;i