Tools: Improve error message

This commit is contained in:
Shahram Najm 2023-07-16 15:06:52 +01:00
parent 6aaf499d13
commit 0ef0fce941
2 changed files with 7 additions and 10 deletions

View File

@ -68,7 +68,7 @@ ${tools_dir}/grib_ls -l 0,0 $tempGrib > $tempText 2>&1
status=$?
set -e
[ $status -ne 0 ]
grep -q "Nearest neighbour functionality is not supported for grid type" $tempText
grep -q "Nearest neighbour functionality is not supported for grid: Variable resolution latitude/longitude" $tempText
# Clean up

View File

@ -281,15 +281,12 @@ int grib_tool_new_handle_action(grib_runtime_options* options, grib_handle* h)
if (!nearest)
nearest = grib_nearest_new(h, &err);
if (err == GRIB_NOT_IMPLEMENTED) {
char grid_type[100], grid_desc[200];
size_t g_len = sizeof(grid_type);
int err1 = 0, err2 = 0;
err1 = grib_get_string(h, "gridType", grid_type, &g_len);
g_len = sizeof(grid_desc);
err2 = grib_get_string(h, "gridDefinitionDescription", grid_desc, &g_len);
if (!err1 && !err2) {
fprintf(stderr, "Nearest neighbour functionality is not supported for grid type: %s (%s)\n",
grid_type, grid_desc);
char grid_desc[200];
int err1 = 0;
size_t g_len = sizeof(grid_desc);
err1 = grib_get_string(h, "gridDefinitionDescription", grid_desc, &g_len);
if (!err1) {
fprintf(stderr, "Nearest neighbour functionality is not supported for grid: %s\n", grid_desc);
} else {
fprintf(stderr, "Nearest neighbour functionality is not supported for this grid type\n");
}