mirror of https://github.com/ecmwf/eccodes.git
Tools: Error messages
This commit is contained in:
parent
8889b5229d
commit
d8c17620bb
|
@ -76,7 +76,7 @@ int grib_tool_init(grib_runtime_options* options)
|
||||||
if (options->latlon) {
|
if (options->latlon) {
|
||||||
lat = strtod(options->latlon, &theEnd);
|
lat = strtod(options->latlon, &theEnd);
|
||||||
if (*theEnd != ',') {
|
if (*theEnd != ',') {
|
||||||
fprintf(stderr, "Error %s: wrong latitude value. Please use 'latitude,longitude'\n", tool_name);
|
fprintf(stderr, "%s: Wrong latitude value. Please use 'latitude,longitude'\n", tool_name);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
lon = strtod(++theEnd, &end1);
|
lon = strtod(++theEnd, &end1);
|
||||||
|
@ -96,7 +96,7 @@ int grib_tool_init(grib_runtime_options* options)
|
||||||
options->latlon_mode = 1;
|
options->latlon_mode = 1;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
fprintf(stderr, "Error %s: wrong mode given in option -l\n", tool_name);
|
fprintf(stderr, "%s: Wrong mode given for the '-l' option (Please use 1 or 4)\n", tool_name);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -97,7 +97,7 @@ int grib_tool_init(grib_runtime_options* options)
|
||||||
if (options->latlon) {
|
if (options->latlon) {
|
||||||
lat = strtod(options->latlon, &theEnd);
|
lat = strtod(options->latlon, &theEnd);
|
||||||
if (*theEnd != ',') {
|
if (*theEnd != ',') {
|
||||||
fprintf(stderr, "Error %s: wrong latitude value. Please use 'latitude,longitude'\n", tool_name);
|
fprintf(stderr, "%s: Wrong latitude value. Please use 'latitude,longitude'\n", tool_name);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
lon = strtod(++theEnd, &end1);
|
lon = strtod(++theEnd, &end1);
|
||||||
|
@ -117,7 +117,7 @@ int grib_tool_init(grib_runtime_options* options)
|
||||||
options->latlon_mode = 1;
|
options->latlon_mode = 1;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
fprintf(stderr, "Error %s: wrong mode given in option -l\n", tool_name);
|
fprintf(stderr, "%s: Wrong mode given for the '-l' option (Please use 1 or 4)\n", tool_name);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -286,9 +286,9 @@ int grib_tool_new_handle_action(grib_runtime_options* options, grib_handle* h)
|
||||||
size_t g_len = sizeof(grid_desc);
|
size_t g_len = sizeof(grid_desc);
|
||||||
err1 = grib_get_string(h, "gridDefinitionDescription", grid_desc, &g_len);
|
err1 = grib_get_string(h, "gridDefinitionDescription", grid_desc, &g_len);
|
||||||
if (!err1) {
|
if (!err1) {
|
||||||
fprintf(stderr, "Nearest neighbour functionality is not supported for grid: %s\n", grid_desc);
|
fprintf(stderr, "%s: Nearest neighbour functionality is not supported for grid: %s\n", tool_name, grid_desc);
|
||||||
} else {
|
} else {
|
||||||
fprintf(stderr, "Nearest neighbour functionality is not supported for this grid type\n");
|
fprintf(stderr, "%s: Nearest neighbour functionality is not supported for this grid type\n", tool_name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
GRIB_CHECK_NOLINE(err, 0);
|
GRIB_CHECK_NOLINE(err, 0);
|
||||||
|
|
|
@ -65,7 +65,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)
|
||||||
{
|
{
|
||||||
if (options->set_values_count == 0 && !options->repack && !options->constant) {
|
if (options->set_values_count == 0 && !options->repack && !options->constant) {
|
||||||
fprintf(stderr, "ERROR: Please provide some keys to set through the -s option or use the -r/-d options\n");
|
fprintf(stderr, "%s: Please provide some keys to set through the -s option or use the -r/-d options\n", tool_name);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
if (options->verbose)
|
if (options->verbose)
|
||||||
|
@ -114,7 +114,7 @@ int grib_tool_new_handle_action(grib_runtime_options* options, grib_handle* h)
|
||||||
|
|
||||||
v = (double*)calloc(size, sizeof(double));
|
v = (double*)calloc(size, sizeof(double));
|
||||||
if (!v) {
|
if (!v) {
|
||||||
fprintf(stderr, "failed to allocate %d bytes\n", (int)(size * sizeof(double)));
|
fprintf(stderr, "%s: Failed to allocate %zu bytes\n", tool_name, size * sizeof(double));
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -296,7 +296,7 @@ static int grib_tool_with_orderby(grib_runtime_options* options)
|
||||||
grib_handle_delete(h);
|
grib_handle_delete(h);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (set->size==0) fprintf(stderr, "No messages found in fieldset\n");
|
if (set->size==0) fprintf(stderr, "%s: No messages found in fieldset\n", tool_name);
|
||||||
grib_tool_finalise_action(options);
|
grib_tool_finalise_action(options);
|
||||||
|
|
||||||
grib_fieldset_delete(set);
|
grib_fieldset_delete(set);
|
||||||
|
@ -417,7 +417,7 @@ static int grib_tool_without_orderby(grib_runtime_options* options)
|
||||||
fclose(infile->file);
|
fclose(infile->file);
|
||||||
|
|
||||||
if (infile->handle_count == 0) {
|
if (infile->handle_count == 0) {
|
||||||
fprintf(stderr, "no messages found in %s\n", infile->name);
|
fprintf(stderr, "%s: No messages found in %s\n", tool_name, infile->name);
|
||||||
if (options->fail)
|
if (options->fail)
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
@ -735,7 +735,7 @@ static void grib_tools_set_print_keys(grib_runtime_options* options, grib_handle
|
||||||
if (ns) {
|
if (ns) {
|
||||||
kiter = grib_keys_iterator_new(h, 0, ns);
|
kiter = grib_keys_iterator_new(h, 0, ns);
|
||||||
if (!kiter) {
|
if (!kiter) {
|
||||||
fprintf(stderr, "ERROR: Unable to create keys iterator\n");
|
fprintf(stderr, "%s: Unable to create keys iterator\n", tool_name);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -743,8 +743,8 @@ static void grib_tools_set_print_keys(grib_runtime_options* options, grib_handle
|
||||||
const char* name = grib_keys_iterator_get_name(kiter);
|
const char* name = grib_keys_iterator_get_name(kiter);
|
||||||
|
|
||||||
if (options->print_keys_count >= MAX_KEYS) {
|
if (options->print_keys_count >= MAX_KEYS) {
|
||||||
fprintf(stderr, "ERROR: keys list too long (more than %d keys)\n",
|
fprintf(stderr, "%s: Keys list too long (more than %d keys)\n",
|
||||||
options->print_keys_count);
|
tool_name, options->print_keys_count);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
if (options->print_keys[options->print_keys_count].name) {
|
if (options->print_keys[options->print_keys_count].name) {
|
||||||
|
@ -1273,8 +1273,8 @@ void grib_print_key_values(grib_runtime_options* options, grib_handle* h)
|
||||||
the_index = options->index;
|
the_index = options->index;
|
||||||
if (the_index >= size) {
|
if (the_index >= size) {
|
||||||
fprintf(dump_file, "\n");
|
fprintf(dump_file, "\n");
|
||||||
fprintf(stderr, "ERROR: Invalid index value %d (should be between 0 and %d)\n",
|
fprintf(stderr, "%s: Invalid index value %d (should be between 0 and %d)\n",
|
||||||
options->index, (int)(size - 1));
|
tool_name, options->index, (int)(size - 1));
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
v = values[options->index];
|
v = values[options->index];
|
||||||
|
|
Loading…
Reference in New Issue