Tools: Dead code removal

This commit is contained in:
shahramn 2024-03-01 12:10:27 +00:00
parent 16c99d7f36
commit 41ed4d12c8
4 changed files with 14 additions and 54 deletions

View File

@ -236,7 +236,7 @@ int grib_tool_before_getopt(grib_runtime_options* options)
int grib_tool_init(grib_runtime_options* options) int grib_tool_init(grib_runtime_options* options)
{ {
int ret = 0, i; int ret = 0;
grib_context* context = grib_context_get_default(); grib_context* context = grib_context_get_default();
options->strict = 1; options->strict = 1;
@ -315,16 +315,6 @@ int grib_tool_init(grib_runtime_options* options)
compare_double = &compare_double_absolute; compare_double = &compare_double_absolute;
if (grib_options_on("R:")) { if (grib_options_on("R:")) {
global_tolerance = 0; global_tolerance = 0;
for (i = 0; i < options->tolerance_count; i++) {
if (!strcmp((options->tolerance[i]).name, "all")) {
global_tolerance = (options->tolerance[i]).double_value;
break;
}
if (!strcmp((options->tolerance[i]).name, "global")) {
global_tolerance = (options->tolerance[i]).double_value;
break;
}
}
compare_double = &compare_double_relative; compare_double = &compare_double_relative;
compareAbsolute = 0; compareAbsolute = 0;
} }
@ -771,11 +761,10 @@ static int compare_values(grib_runtime_options* options, grib_handle* handle1, g
return GRIB_COUNT_MISMATCH; return GRIB_COUNT_MISMATCH;
} */ } */
if (options->mode != MODE_BUFR) { Assert(options->mode == MODE_BUFR);
/* TODO: Ignore missing values for keys in BUFR. Not yet implemented */ /* TODO: Ignore missing values for keys in BUFR. Not yet implemented */
//isMissing1 = ((grib_is_missing(handle1, name, &err1) == 1) && (err1 == 0)) ? 1 : 0; //isMissing1 = ((grib_is_missing(handle1, name, &err1) == 1) && (err1 == 0)) ? 1 : 0;
//isMissing2 = ((grib_is_missing(handle2, name, &err2) == 1) && (err2 == 0)) ? 1 : 0; //isMissing2 = ((grib_is_missing(handle2, name, &err2) == 1) && (err2 == 0)) ? 1 : 0;
}
if ((isMissing1 == 1) && (isMissing2 == 1)) { if ((isMissing1 == 1) && (isMissing2 == 1)) {
// if (verbose) printf(" is set to missing in both fields\n"); // if (verbose) printf(" is set to missing in both fields\n");
@ -1081,16 +1070,14 @@ static int compare_values(grib_runtime_options* options, grib_handle* handle1, g
break; break;
case GRIB_TYPE_BYTES: case GRIB_TYPE_BYTES:
if (options->mode == MODE_BUFR) return 0; // Not in BUFR
return 0;
break; break;
case GRIB_TYPE_LABEL: case GRIB_TYPE_LABEL:
break; break;
default: default:
if (verbose) if (verbose) printf("\n");
printf("\n");
printInfo(handle1); printInfo(handle1);
save_error(c, name); save_error(c, name);
printf("Cannot compare [%s], unsupported type %d\n", name, type1); printf("Cannot compare [%s], unsupported type %d\n", name, type1);

View File

@ -330,18 +330,7 @@ int grib_tool_init(grib_runtime_options* options)
global_tolerance = 0; global_tolerance = 0;
compare_double = &compare_double_absolute; compare_double = &compare_double_absolute;
if (grib_options_on("R:")) { if (grib_options_on("R:")) {
int i;
global_tolerance = 0; global_tolerance = 0;
for (i = 0; i < options->tolerance_count; i++) {
if (!strcmp((options->tolerance[i]).name, "all")) {
global_tolerance = (options->tolerance[i]).double_value;
break;
}
if (!strcmp((options->tolerance[i]).name, "global")) {
global_tolerance = (options->tolerance[i]).double_value;
break;
}
}
compare_double = &compare_double_relative; compare_double = &compare_double_relative;
compareAbsolute = 0; compareAbsolute = 0;
} }

View File

@ -439,12 +439,10 @@ static int compare_values(const grib_runtime_options* options, grib_handle* h1,
save_error(c, name); save_error(c, name);
return err; return err;
} }
Assert(options->mode == MODE_GTS);
//if (options->mode != MODE_GTS) {
/* TODO: Ignore missing values for keys in GTS. Not yet implemented */ /* TODO: Ignore missing values for keys in GTS. Not yet implemented */
//isMissing1 = ((grib_is_missing(h1, name, &err1) == 1) && (err1 == 0)) ? 1 : 0; //isMissing1 = ((grib_is_missing(h1, name, &err1) == 1) && (err1 == 0)) ? 1 : 0;
//isMissing2 = ((grib_is_missing(h2, name, &err2) == 1) && (err2 == 0)) ? 1 : 0; //isMissing2 = ((grib_is_missing(h2, name, &err2) == 1) && (err2 == 0)) ? 1 : 0;
//}
if ((isMissing1 == 1) && (isMissing2 == 1)) { if ((isMissing1 == 1) && (isMissing2 == 1)) {
if (verbose) if (verbose)
@ -573,10 +571,8 @@ static int compare_values(const grib_runtime_options* options, grib_handle* h1,
break; break;
case GRIB_TYPE_BYTES: case GRIB_TYPE_BYTES:
if (options->mode == MODE_GTS) {
// We do not want to compare the message itself // We do not want to compare the message itself
return 0; return 0;
}
break; break;
case GRIB_TYPE_LABEL: case GRIB_TYPE_LABEL:

View File

@ -249,16 +249,6 @@ int grib_tool_init(grib_runtime_options* options)
compare_double = &compare_double_absolute; compare_double = &compare_double_absolute;
if (grib_options_on("R:")) { if (grib_options_on("R:")) {
global_tolerance = 0; global_tolerance = 0;
for (int i = 0; i < options->tolerance_count; i++) {
if (!strcmp((options->tolerance[i]).name, "all")) {
global_tolerance = (options->tolerance[i]).double_value;
break;
}
if (!strcmp((options->tolerance[i]).name, "global")) {
global_tolerance = (options->tolerance[i]).double_value;
break;
}
}
compare_double = &compare_double_relative; compare_double = &compare_double_relative;
compareAbsolute = 0; compareAbsolute = 0;
} }
@ -514,11 +504,10 @@ static int compare_values(const grib_runtime_options* options, grib_handle* h1,
return err; return err;
} }
// if (options->mode != MODE_METAR) { Assert(options->mode == MODE_METAR);
// // TODO: Ignore missing values for keys in METAR. Not yet implemented // // TODO: Ignore missing values for keys in METAR. Not yet implemented
// isMissing1 = ((grib_is_missing(h1, name, &err1) == 1) && (err1 == 0)) ? 1 : 0; // isMissing1 = ((grib_is_missing(h1, name, &err1) == 1) && (err1 == 0)) ? 1 : 0;
// isMissing2 = ((grib_is_missing(h2, name, &err2) == 1) && (err2 == 0)) ? 1 : 0; // isMissing2 = ((grib_is_missing(h2, name, &err2) == 1) && (err2 == 0)) ? 1 : 0;
// }
if ((isMissing1 == 1) && (isMissing2 == 1)) { if ((isMissing1 == 1) && (isMissing2 == 1)) {
if (verbose) if (verbose)
@ -746,8 +735,7 @@ static int compare_values(const grib_runtime_options* options, grib_handle* h1,
break; break;
case GRIB_TYPE_BYTES: case GRIB_TYPE_BYTES:
if (options->mode == MODE_METAR) return 0; // No such type for METAR
return 0;
break; break;
case GRIB_TYPE_LABEL: case GRIB_TYPE_LABEL: