Refactoring: in preparation for ECC-822

This commit is contained in:
Shahram Najm 2021-02-03 13:59:27 +00:00
parent 2b98e8a40d
commit 053b68faf1
1 changed files with 5 additions and 5 deletions

View File

@ -85,7 +85,7 @@ int grib_tool_new_handle_action(grib_runtime_options* options, grib_handle* h)
int i = 0; int i = 0;
grib_values* values = NULL; grib_values* values = NULL;
grib_iterator* iter = NULL; grib_iterator* iter = NULL;
char* format = NULL; char* format_values = NULL;
char* default_format = "%.10e"; char* default_format = "%.10e";
int print_keys = grib_options_on("p:"); int print_keys = grib_options_on("p:");
long numberOfPoints = 0; long numberOfPoints = 0;
@ -128,9 +128,9 @@ int grib_tool_new_handle_action(grib_runtime_options* options, grib_handle* h)
} }
if (grib_options_on("F:")) if (grib_options_on("F:"))
format = grib_options_get_option("F:"); format_values = grib_options_get_option("F:");
else else
format = default_format; format_values = default_format;
if ((err = grib_get_long(h, "numberOfPoints", &numberOfPoints)) != GRIB_SUCCESS) { if ((err = grib_get_long(h, "numberOfPoints", &numberOfPoints)) != GRIB_SUCCESS) {
fprintf(dump_file, "ERROR: unable to get number of points\n"); fprintf(dump_file, "ERROR: unable to get number of points\n");
@ -217,7 +217,7 @@ int grib_tool_new_handle_action(grib_runtime_options* options, grib_handle* h)
if (is_missing_val) if (is_missing_val)
fprintf(dump_file, "%s", missing_string); fprintf(dump_file, "%s", missing_string);
else else
fprintf(dump_file, format, data_values[i]); fprintf(dump_file, format_values, data_values[i]);
if (print_keys) if (print_keys)
print_key_values(values, options->print_keys_count); print_key_values(values, options->print_keys_count);
@ -238,7 +238,7 @@ int grib_tool_new_handle_action(grib_runtime_options* options, grib_handle* h)
if (!is_missing_val) { if (!is_missing_val) {
if (iter) if (iter)
fprintf(dump_file, "%9.3f%9.3f ", lats[i], lons[i]); fprintf(dump_file, "%9.3f%9.3f ", lats[i], lons[i]);
fprintf(dump_file, format, data_values[i]); fprintf(dump_file, format_values, data_values[i]);
if (print_keys) if (print_keys)
print_key_values(values, options->print_keys_count); print_key_values(values, options->print_keys_count);
fprintf(dump_file, "\n"); fprintf(dump_file, "\n");