mirror of https://github.com/ecmwf/eccodes.git
Tools: Rename of common variables
This commit is contained in:
parent
2c0f6bc9da
commit
1f1a2cbe5b
|
@ -236,14 +236,14 @@ static int counter = 0;
|
|||
static int start = -1;
|
||||
static int end = -1;
|
||||
|
||||
const char* grib_tool_description =
|
||||
const char* tool_description =
|
||||
"Compare BUFR messages contained in two files."
|
||||
"\n\tIf some differences are found it fails returning an error code."
|
||||
"\n\tFloating-point values are compared exactly by default, different tolerance can be defined see -P -A -R."
|
||||
"\n\tDefault behaviour: absolute error=0, bit-by-bit compare, same order in files.";
|
||||
|
||||
const char* grib_tool_name = "bufr_compare";
|
||||
const char* grib_tool_usage = "[options] bufr_file1 bufr_file2";
|
||||
const char* tool_name = "bufr_compare";
|
||||
const char* tool_usage = "[options] bufr_file1 bufr_file2";
|
||||
|
||||
int grib_options_count = sizeof(grib_options) / sizeof(grib_option);
|
||||
|
||||
|
@ -326,7 +326,7 @@ int grib_tool_init(grib_runtime_options* options)
|
|||
}
|
||||
|
||||
/* Check 1st file is not a directory */
|
||||
exit_if_input_is_directory(grib_tool_name, options->infile_extra->name);
|
||||
exit_if_input_is_directory(tool_name, options->infile_extra->name);
|
||||
|
||||
if (grib_options_on("r")) {
|
||||
char* filename[1];
|
||||
|
@ -388,7 +388,7 @@ int grib_tool_init(grib_runtime_options* options)
|
|||
if (grib_options_on("R:")) {
|
||||
char* sarg = grib_options_get_option("R:");
|
||||
options->tolerance_count = MAX_KEYS;
|
||||
ret = parse_keyval_string(grib_tool_name, sarg, 1, GRIB_TYPE_DOUBLE, options->tolerance, &(options->tolerance_count));
|
||||
ret = parse_keyval_string(tool_name, sarg, 1, GRIB_TYPE_DOUBLE, options->tolerance, &(options->tolerance_count));
|
||||
if (ret == GRIB_INVALID_ARGUMENT) {
|
||||
usage();
|
||||
exit(1);
|
||||
|
@ -426,7 +426,7 @@ int grib_tool_new_filename_action(grib_runtime_options* options, const char* fil
|
|||
|
||||
int grib_tool_new_file_action(grib_runtime_options* options, grib_tools_file* file)
|
||||
{
|
||||
exit_if_input_is_directory(grib_tool_name, file->name);
|
||||
exit_if_input_is_directory(tool_name, file->name);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -15,12 +15,12 @@
|
|||
|
||||
#include "grib_tools.h"
|
||||
|
||||
const char* grib_tool_description =
|
||||
const char* tool_description =
|
||||
"Copies the content of BUFR files printing"
|
||||
" values of some keys."
|
||||
"\n\tIf the name of the output_bufr_file contains a key enclosed in square brackets, its value will be used.";
|
||||
const char* grib_tool_name = "bufr_copy";
|
||||
const char* grib_tool_usage = "[options] bufr_file bufr_file ... output_bufr_file";
|
||||
const char* tool_name = "bufr_copy";
|
||||
const char* tool_usage = "[options] bufr_file bufr_file ... output_bufr_file";
|
||||
|
||||
grib_option grib_options[] = {
|
||||
/* {id, args, help}, on, command_line, value */
|
||||
|
@ -90,7 +90,7 @@ int grib_tool_new_filename_action(grib_runtime_options* options, const char* fil
|
|||
|
||||
int grib_tool_new_file_action(grib_runtime_options* options, grib_tools_file* file)
|
||||
{
|
||||
exit_if_input_is_directory(grib_tool_name, file->name);
|
||||
exit_if_input_is_directory(tool_name, file->name);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -62,9 +62,9 @@ grib_option grib_options[] = {
|
|||
/* {"x",0,0,0,1,0} */
|
||||
};
|
||||
|
||||
const char* grib_tool_description = "Dump the content of a BUFR file in different formats.";
|
||||
const char* grib_tool_name = "bufr_dump";
|
||||
const char* grib_tool_usage = "[options] bufr_file bufr_file ...";
|
||||
const char* tool_description = "Dump the content of a BUFR file in different formats.";
|
||||
const char* tool_name = "bufr_dump";
|
||||
const char* tool_usage = "[options] bufr_file bufr_file ...";
|
||||
static int json = 0;
|
||||
static int dump_descriptors = 0;
|
||||
static char* json_option = 0;
|
||||
|
@ -108,7 +108,7 @@ int grib_tool_init(grib_runtime_options* options)
|
|||
options->strict = 1; /* Must set here as bufr_dump has its own -S option */
|
||||
|
||||
if (opt > 1) {
|
||||
printf("%s: simultaneous j/C/O options not allowed\n", grib_tool_name);
|
||||
printf("%s: simultaneous j/C/O options not allowed\n", tool_name);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
@ -116,7 +116,7 @@ int grib_tool_init(grib_runtime_options* options)
|
|||
options->dump_mode = "json";
|
||||
json_option = grib_options_get_option("j:");
|
||||
if (strlen(json_option) > 1 || (json_option[0] != 's' && json_option[0] != 'f' && json_option[0] != 'a')) {
|
||||
printf("%s: Invalid JSON option %s\n", grib_tool_name, json_option);
|
||||
printf("%s: Invalid JSON option %s\n", tool_name, json_option);
|
||||
exit(1);
|
||||
}
|
||||
json = 1;
|
||||
|
@ -188,7 +188,7 @@ int grib_tool_new_file_action(grib_runtime_options* options, grib_tools_file* fi
|
|||
return 0;
|
||||
|
||||
Assert(file);
|
||||
exit_if_input_is_directory(grib_tool_name, file->name);
|
||||
exit_if_input_is_directory(tool_name, file->name);
|
||||
|
||||
/*
|
||||
* Dumping of index files
|
||||
|
@ -201,7 +201,7 @@ int grib_tool_new_file_action(grib_runtime_options* options, grib_tools_file* fi
|
|||
err = grib_index_dump_file(stdout, filename);
|
||||
if (err) {
|
||||
grib_context_log(c, GRIB_LOG_ERROR, "%s: Could not dump index file \"%s\".\n%s\n",
|
||||
grib_tool_name,
|
||||
tool_name,
|
||||
filename,
|
||||
grib_get_error_message(err));
|
||||
exit(1);
|
||||
|
|
|
@ -30,12 +30,12 @@ grib_option grib_options[] = {
|
|||
{ "7", 0, 0, 0, 1, 0 },
|
||||
{ "v", 0, 0, 0, 1, 0 }
|
||||
};
|
||||
const char* grib_tool_description =
|
||||
const char* tool_description =
|
||||
"Apply the rules defined in rules_file to each BUFR "
|
||||
"message\n\tin the BUFR files provided as arguments.\n\t"
|
||||
"If you specify '-' (a single dash) for the rules_file, the rules will be read from standard input.";
|
||||
const char* grib_tool_name = "bufr_filter";
|
||||
const char* grib_tool_usage =
|
||||
const char* tool_name = "bufr_filter";
|
||||
const char* tool_usage =
|
||||
"[options] rules_file "
|
||||
"bufr_file bufr_file ...";
|
||||
|
||||
|
@ -75,7 +75,7 @@ int grib_tool_new_filename_action(grib_runtime_options* options, const char* fil
|
|||
|
||||
int grib_tool_new_file_action(grib_runtime_options* options, grib_tools_file* file)
|
||||
{
|
||||
exit_if_input_is_directory(grib_tool_name, file->name);
|
||||
exit_if_input_is_directory(tool_name, file->name);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -112,7 +112,7 @@ int grib_tool_finalise_action(grib_runtime_options* options)
|
|||
int err = 0;
|
||||
grib_file_close_all(&err);
|
||||
if (err != GRIB_SUCCESS) {
|
||||
perror(grib_tool_name);
|
||||
perror(tool_name);
|
||||
exit(err);
|
||||
}
|
||||
|
||||
|
|
|
@ -35,12 +35,12 @@ grib_option grib_options[] = {
|
|||
{ "v", 0, 0, 1, 0, 0 }
|
||||
};
|
||||
|
||||
const char* grib_tool_description =
|
||||
const char* tool_description =
|
||||
"Get values of some header keys from a BUFR file."
|
||||
"\n\tIt is similar to bufr_ls, but fails returning an error code "
|
||||
"\n\twhen an error occurs (e.g. key not found).";
|
||||
const char* grib_tool_name = "bufr_get";
|
||||
const char* grib_tool_usage = "[options] file file ...";
|
||||
const char* tool_name = "bufr_get";
|
||||
const char* tool_usage = "[options] file file ...";
|
||||
|
||||
int grib_options_count = sizeof(grib_options) / sizeof(grib_option);
|
||||
|
||||
|
@ -71,7 +71,7 @@ int grib_tool_new_filename_action(grib_runtime_options* options, const char* fil
|
|||
|
||||
int grib_tool_new_file_action(grib_runtime_options* options, grib_tools_file* file)
|
||||
{
|
||||
exit_if_input_is_directory(grib_tool_name, file->name);
|
||||
exit_if_input_is_directory(tool_name, file->name);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -15,11 +15,11 @@
|
|||
|
||||
#include "grib_tools.h"
|
||||
|
||||
const char* grib_tool_description =
|
||||
const char* tool_description =
|
||||
"Build an index file for a set of input BUFR files.\n"
|
||||
"\tWarning: THIS TOOL IS NOT YET IMPLEMENTED";
|
||||
const char* grib_tool_name = "bufr_index_build";
|
||||
const char* grib_tool_usage = "[options] file file ... ";
|
||||
const char* tool_name = "bufr_index_build";
|
||||
const char* tool_usage = "[options] file file ... ";
|
||||
grib_index* idx = NULL;
|
||||
char* keys;
|
||||
char* default_keys = "mars";
|
||||
|
@ -86,7 +86,7 @@ int grib_tool_init(grib_runtime_options* options)
|
|||
int grib_tool_new_filename_action(grib_runtime_options* options, const char* file)
|
||||
{
|
||||
int ret = 0;
|
||||
printf("--- %s: processing %s\n", grib_tool_name, file);
|
||||
printf("--- %s: processing %s\n", tool_name, file);
|
||||
ret = grib_index_add_file(idx, file);
|
||||
if (ret) {
|
||||
printf("error: %s\n", grib_get_error_message(ret));
|
||||
|
@ -124,7 +124,7 @@ int grib_tool_finalise_action(grib_runtime_options* options)
|
|||
grib_index_compress(idx);
|
||||
}
|
||||
printf("--- %s: keys included in the index file %s:\n",
|
||||
grib_tool_name, options->outfile->name);
|
||||
tool_name, options->outfile->name);
|
||||
printf("--- ");
|
||||
first = 1;
|
||||
the_keys = idx->keys;
|
||||
|
|
|
@ -37,12 +37,12 @@ grib_option grib_options[] = {
|
|||
{ "v", 0, 0, 1, 0, 0 }
|
||||
};
|
||||
|
||||
const char* grib_tool_description =
|
||||
const char* tool_description =
|
||||
"List content of BUFR files printing values of "
|
||||
"some header keys.\n\tOnly scalar keys can be printed."
|
||||
"\n\tIt does not fail when a key is not found.";
|
||||
const char* grib_tool_name = "bufr_ls";
|
||||
const char* grib_tool_usage = "[options] bufr_file bufr_file ...";
|
||||
const char* tool_name = "bufr_ls";
|
||||
const char* tool_usage = "[options] bufr_file bufr_file ...";
|
||||
static int first_handle = 1;
|
||||
|
||||
int grib_options_count = sizeof(grib_options) / sizeof(grib_option);
|
||||
|
@ -84,7 +84,7 @@ int grib_tool_new_filename_action(grib_runtime_options* options, const char* fil
|
|||
|
||||
int grib_tool_new_file_action(grib_runtime_options* options, grib_tools_file* file)
|
||||
{
|
||||
exit_if_input_is_directory(grib_tool_name, file->name);
|
||||
exit_if_input_is_directory(tool_name, file->name);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -42,12 +42,12 @@ grib_option grib_options[] = {
|
|||
{ "v", 0, 0, 0, 1, 0 }
|
||||
};
|
||||
|
||||
const char* grib_tool_description =
|
||||
const char* tool_description =
|
||||
"Sets key/value pairs in the input BUFR file and writes"
|
||||
"\n\teach message to the output_file."
|
||||
"\n\tIt fails when an error occurs (e.g. key not found).";
|
||||
const char* grib_tool_name = "bufr_set";
|
||||
const char* grib_tool_usage = "[options] file file ... output_file";
|
||||
const char* tool_name = "bufr_set";
|
||||
const char* tool_usage = "[options] file file ... output_file";
|
||||
|
||||
int grib_options_count = sizeof(grib_options) / sizeof(grib_option);
|
||||
|
||||
|
@ -166,7 +166,7 @@ int grib_tool_finalise_action(grib_runtime_options* options)
|
|||
int err = 0;
|
||||
grib_file_close_all(&err);
|
||||
if (err != GRIB_SUCCESS) {
|
||||
perror(grib_tool_name);
|
||||
perror(tool_name);
|
||||
exit(err);
|
||||
}
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
#include "grib_api_internal.h"
|
||||
|
||||
static int fail_on_error = 1;
|
||||
static const char* tool_name = NULL;
|
||||
static const char* toolname = NULL;
|
||||
|
||||
static void usage(const char* prog)
|
||||
{
|
||||
|
@ -81,15 +81,15 @@ int main(int argc, char* argv[])
|
|||
unsigned long count_total = 0, count_curr = 0;
|
||||
int message_type = 0; /* GRIB, BUFR etc */
|
||||
|
||||
tool_name = argv[0];
|
||||
toolname = argv[0];
|
||||
if (argc < 2)
|
||||
usage(tool_name);
|
||||
usage(toolname);
|
||||
|
||||
if (strstr(tool_name, "grib_count"))
|
||||
if (strstr(toolname, "grib_count"))
|
||||
message_type = CODES_GRIB;
|
||||
if (strstr(tool_name, "bufr_count"))
|
||||
if (strstr(toolname, "bufr_count"))
|
||||
message_type = CODES_BUFR;
|
||||
if (strstr(tool_name, "gts_count"))
|
||||
if (strstr(toolname, "gts_count"))
|
||||
message_type = CODES_GTS;
|
||||
|
||||
count_total = 0;
|
||||
|
@ -104,7 +104,7 @@ int main(int argc, char* argv[])
|
|||
}
|
||||
filename = argv[i];
|
||||
if (path_is_directory(filename)) {
|
||||
fprintf(stderr, "%s: ERROR: \"%s\": Is a directory\n", tool_name, filename);
|
||||
fprintf(stderr, "%s: ERROR: \"%s\": Is a directory\n", toolname, filename);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
@ -32,14 +32,14 @@ grib_option grib_options[]={
|
|||
{"v",0,0,0,1,0}
|
||||
};
|
||||
|
||||
char* grib_tool_description=
|
||||
char* tool_description=
|
||||
"It converts grib messages applying the rules from a conversion_rules file."
|
||||
"\n\tThe rules are of the type \"keyname = value;\" and if blocks are allowed as"
|
||||
"\n\tif ( keyname1 == value1 || keyname2 != value2 && keyname3 == value3 ) {"
|
||||
"\n\t keyname4 = value4;"
|
||||
"\n\t}";
|
||||
char* grib_tool_name="grib_convert";
|
||||
char* grib_tool_usage="[options] conversion_rules "
|
||||
char* tool_name="grib_convert";
|
||||
char* tool_usage="[options] conversion_rules "
|
||||
"grib_file grib_file ... output_grib_file";
|
||||
|
||||
int grib_options_count=sizeof(grib_options)/sizeof(grib_option);
|
||||
|
|
|
@ -29,9 +29,9 @@ grib_option grib_options[]={
|
|||
{"q",0,0,1,0,0}
|
||||
};
|
||||
|
||||
char* grib_tool_description="Dump the content of a grib file in debug mode.";
|
||||
char* grib_tool_name="grib_debug";
|
||||
char* grib_tool_usage="[options] grib_file grib_file ...";
|
||||
char* tool_description="Dump the content of a grib file in debug mode.";
|
||||
char* tool_name="grib_debug";
|
||||
char* tool_usage="[options] grib_file grib_file ...";
|
||||
|
||||
int grib_options_count=sizeof(grib_options)/sizeof(grib_option);
|
||||
|
||||
|
|
|
@ -29,10 +29,10 @@ grib_option grib_options[]={
|
|||
{"a",0,0,0,1,0}
|
||||
};
|
||||
|
||||
char* grib_tool_description="Lists the keys available for a type of grib (-T option) or \n"
|
||||
char* tool_description="Lists the keys available for a type of grib (-T option) or \n"
|
||||
"\tin a grib message from a file (-F option).";
|
||||
char* grib_tool_name="grib_keys";
|
||||
char* grib_tool_usage="[options]";
|
||||
char* tool_name="grib_keys";
|
||||
char* tool_usage="[options]";
|
||||
char name[1024];
|
||||
|
||||
int grib_options_count=sizeof(grib_options)/sizeof(grib_option);
|
||||
|
|
|
@ -34,9 +34,9 @@ grib_option grib_options[]={
|
|||
{"v",0,0,1,0,0}
|
||||
};
|
||||
|
||||
char* grib_tool_description="Lat lon values list for given points list. ";
|
||||
char* grib_tool_name="grib_points";
|
||||
char* grib_tool_usage="file_list_of_points grib_file grib_file ...";
|
||||
char* tool_description="Lat lon values list for given points list. ";
|
||||
char* tool_name="grib_points";
|
||||
char* tool_usage="file_list_of_points grib_file grib_file ...";
|
||||
|
||||
int grib_options_count=sizeof(grib_options)/sizeof(grib_option);
|
||||
double lat=0;
|
||||
|
@ -79,7 +79,7 @@ int grib_tool_init(grib_runtime_options* options) {
|
|||
} else if (*end1 == '1') {
|
||||
options->latlon_mode=1;
|
||||
} else {
|
||||
printf("ERROR %s: wrong mode given in option -l\n",grib_tool_name);
|
||||
printf("ERROR %s: wrong mode given in option -l\n",tool_name);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -165,14 +165,14 @@ static int global_counter = 0;
|
|||
static int theStart = -1;
|
||||
static int theEnd = -1;
|
||||
|
||||
const char* grib_tool_description =
|
||||
const char* tool_description =
|
||||
"Compare GRIB messages contained in two files."
|
||||
"\n\tIf some differences are found it fails returning an error code."
|
||||
"\n\tFloating-point values are compared exactly by default, different tolerance can be defined see -P -A -R."
|
||||
"\n\tDefault behaviour: absolute error=0, bit-by-bit compare, same order in files.";
|
||||
|
||||
const char* grib_tool_name = "grib_compare";
|
||||
const char* grib_tool_usage = "[options] grib_file1 grib_file2";
|
||||
const char* tool_name = "grib_compare";
|
||||
const char* tool_usage = "[options] grib_file1 grib_file2";
|
||||
|
||||
int grib_options_count = sizeof(grib_options) / sizeof(grib_option);
|
||||
|
||||
|
@ -319,7 +319,7 @@ int grib_tool_init(grib_runtime_options* options)
|
|||
if (grib_options_on("R:")) {
|
||||
char* sarg = grib_options_get_option("R:");
|
||||
options->tolerance_count = MAX_KEYS;
|
||||
ret = parse_keyval_string(grib_tool_name, sarg, 1, GRIB_TYPE_DOUBLE, options->tolerance, &(options->tolerance_count));
|
||||
ret = parse_keyval_string(tool_name, sarg, 1, GRIB_TYPE_DOUBLE, options->tolerance, &(options->tolerance_count));
|
||||
if (ret == GRIB_INVALID_ARGUMENT) {
|
||||
usage();
|
||||
exit(1);
|
||||
|
|
|
@ -15,12 +15,12 @@
|
|||
|
||||
#include "grib_tools.h"
|
||||
|
||||
const char* grib_tool_description =
|
||||
const char* tool_description =
|
||||
"Copies the content of GRIB files printing"
|
||||
" values of some keys."
|
||||
"\n\tIf the name of the output_grib_file contains a key enclosed in square brackets, its value will be used.";
|
||||
const char* grib_tool_name = "grib_copy";
|
||||
const char* grib_tool_usage = "[options] grib_file grib_file ... output_grib_file";
|
||||
const char* tool_name = "grib_copy";
|
||||
const char* tool_usage = "[options] grib_file grib_file ... output_grib_file";
|
||||
|
||||
grib_option grib_options[] = {
|
||||
/* {id, args, help}, on, command_line, value */
|
||||
|
@ -94,7 +94,7 @@ int grib_tool_new_filename_action(grib_runtime_options* options, const char* fil
|
|||
|
||||
int grib_tool_new_file_action(grib_runtime_options* options, grib_tools_file* file)
|
||||
{
|
||||
exit_if_input_is_directory(grib_tool_name, file->name);
|
||||
exit_if_input_is_directory(tool_name, file->name);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -145,7 +145,7 @@ int grib_tool_finalise_action(grib_runtime_options* options)
|
|||
int err = 0;
|
||||
grib_file_close_all(&err);
|
||||
if (err != GRIB_SUCCESS) {
|
||||
perror(grib_tool_name);
|
||||
perror(tool_name);
|
||||
exit(err);
|
||||
}
|
||||
/* if (options->outfile->file)
|
||||
|
|
|
@ -39,9 +39,9 @@ grib_option grib_options[] = {
|
|||
{ "x", 0, 0, 0, 1, 0 }
|
||||
};
|
||||
|
||||
const char* grib_tool_description = "Dump the content of a GRIB file in different formats.";
|
||||
const char* grib_tool_name = "grib_dump";
|
||||
const char* grib_tool_usage = "[options] grib_file grib_file ...";
|
||||
const char* tool_description = "Dump the content of a GRIB file in different formats.";
|
||||
const char* tool_name = "grib_dump";
|
||||
const char* tool_usage = "[options] grib_file grib_file ...";
|
||||
static int json = 0;
|
||||
static int first_handle = 1;
|
||||
static int dump_keys = 0;
|
||||
|
@ -69,7 +69,7 @@ int grib_tool_init(grib_runtime_options* options)
|
|||
options->dump_mode = "default";
|
||||
|
||||
if (opt > 1) {
|
||||
printf("%s: simultaneous j/O/D options not allowed\n", grib_tool_name);
|
||||
printf("%s: simultaneous j/O/D options not allowed\n", tool_name);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
@ -130,7 +130,7 @@ int grib_tool_new_file_action(grib_runtime_options* options, grib_tools_file* fi
|
|||
return 0;
|
||||
|
||||
Assert(file);
|
||||
exit_if_input_is_directory(grib_tool_name, file->name);
|
||||
exit_if_input_is_directory(tool_name, file->name);
|
||||
|
||||
sprintf(tmp, "FILE: %s ", options->current_infile->name);
|
||||
if (!grib_options_on("C"))
|
||||
|
@ -147,7 +147,7 @@ int grib_tool_new_file_action(grib_runtime_options* options, grib_tools_file* fi
|
|||
err = grib_index_dump_file(stdout, filename);
|
||||
if (err) {
|
||||
grib_context_log(c, GRIB_LOG_ERROR, "%s: Could not dump index file \"%s\".\n%s\n",
|
||||
grib_tool_name,
|
||||
tool_name,
|
||||
filename,
|
||||
grib_get_error_message(err));
|
||||
exit(1);
|
||||
|
|
|
@ -26,12 +26,12 @@ grib_option grib_options[] = {
|
|||
{ "7", 0, 0, 0, 1, 0 },
|
||||
{ "v", 0, 0, 0, 1, 0 }
|
||||
};
|
||||
const char* grib_tool_description =
|
||||
const char* tool_description =
|
||||
"Apply the rules defined in rules_file to each GRIB "
|
||||
"message\n\tin the GRIB files provided as arguments.\n\t"
|
||||
"If you specify '-' (a single dash) for the rules_file, the rules will be read from standard input.";
|
||||
const char* grib_tool_name = "grib_filter";
|
||||
const char* grib_tool_usage =
|
||||
const char* tool_name = "grib_filter";
|
||||
const char* tool_usage =
|
||||
"[options] rules_file "
|
||||
"grib_file grib_file ...";
|
||||
|
||||
|
@ -68,7 +68,7 @@ int grib_tool_new_filename_action(grib_runtime_options* options, const char* fil
|
|||
|
||||
int grib_tool_new_file_action(grib_runtime_options* options, grib_tools_file* file)
|
||||
{
|
||||
exit_if_input_is_directory(grib_tool_name, file->name);
|
||||
exit_if_input_is_directory(tool_name, file->name);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -105,7 +105,7 @@ int grib_tool_finalise_action(grib_runtime_options* options)
|
|||
int err = 0;
|
||||
grib_file_close_all(&err);
|
||||
if (err != GRIB_SUCCESS) {
|
||||
perror(grib_tool_name);
|
||||
perror(tool_name);
|
||||
exit(err);
|
||||
}
|
||||
|
||||
|
|
|
@ -35,12 +35,12 @@ grib_option grib_options[] = {
|
|||
{ "i:", 0, 0, 0, 1, 0 }
|
||||
};
|
||||
|
||||
const char* grib_tool_description =
|
||||
const char* tool_description =
|
||||
"Get values of some keys from a GRIB file."
|
||||
"\n\tIt is similar to grib_ls, but fails returning an error code "
|
||||
"\n\twhen an error occurs (e.g. key not found).";
|
||||
const char* grib_tool_name = "grib_get";
|
||||
const char* grib_tool_usage = "[options] grib_file grib_file ...";
|
||||
const char* tool_name = "grib_get";
|
||||
const char* tool_usage = "[options] grib_file grib_file ...";
|
||||
|
||||
int grib_options_count = sizeof(grib_options) / sizeof(grib_option);
|
||||
static double lat = 0;
|
||||
|
@ -75,7 +75,7 @@ int grib_tool_init(grib_runtime_options* options)
|
|||
if (options->latlon) {
|
||||
lat = strtod(options->latlon, &theEnd);
|
||||
if (*theEnd != ',') {
|
||||
fprintf(stderr, "Error %s: wrong latitude value. Please use 'latitude,longitude'\n",grib_tool_name);
|
||||
fprintf(stderr, "Error %s: wrong latitude value. Please use 'latitude,longitude'\n",tool_name);
|
||||
exit(1);
|
||||
}
|
||||
lon = strtod(++theEnd, &end1);
|
||||
|
@ -95,7 +95,7 @@ int grib_tool_init(grib_runtime_options* options)
|
|||
options->latlon_mode = 1;
|
||||
}
|
||||
else {
|
||||
fprintf(stderr, "Error %s: wrong mode given in option -l\n", grib_tool_name);
|
||||
fprintf(stderr, "Error %s: wrong mode given in option -l\n", tool_name);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
@ -162,7 +162,7 @@ int grib_tool_new_filename_action(grib_runtime_options* options, const char* fil
|
|||
|
||||
int grib_tool_new_file_action(grib_runtime_options* options, grib_tools_file* file)
|
||||
{
|
||||
exit_if_input_is_directory(grib_tool_name, file->name);
|
||||
exit_if_input_is_directory(tool_name, file->name);
|
||||
if (nearest)
|
||||
grib_nearest_delete(nearest);
|
||||
nearest = NULL;
|
||||
|
|
|
@ -39,11 +39,11 @@ grib_option grib_options[] = {
|
|||
{ "V", 0, 0, 0, 1, 0 }
|
||||
};
|
||||
|
||||
const char* grib_tool_description =
|
||||
const char* tool_description =
|
||||
"Print a latitude, longitude, data values list.\n"
|
||||
"\tNote: Rotated grids are first unrotated";
|
||||
const char* grib_tool_name = "grib_get_data";
|
||||
const char* grib_tool_usage = "[options] grib_file grib_file ...";
|
||||
const char* tool_name = "grib_get_data";
|
||||
const char* tool_usage = "[options] grib_file grib_file ...";
|
||||
|
||||
extern FILE* dump_file;
|
||||
|
||||
|
@ -71,7 +71,7 @@ int grib_tool_new_filename_action(grib_runtime_options* options, const char* fil
|
|||
|
||||
int grib_tool_new_file_action(grib_runtime_options* options, grib_tools_file* file)
|
||||
{
|
||||
exit_if_input_is_directory(grib_tool_name, file->name);
|
||||
exit_if_input_is_directory(tool_name, file->name);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -19,9 +19,9 @@ grib_option grib_options[] = {
|
|||
};
|
||||
int grib_options_count = sizeof(grib_options) / sizeof(grib_option);
|
||||
|
||||
const char* grib_tool_description = "Histogram of GRIB files";
|
||||
const char* grib_tool_name = "grib_histogram";
|
||||
const char* grib_tool_usage = "[options] grib_file grib_file ...";
|
||||
const char* tool_description = "Histogram of GRIB files";
|
||||
const char* tool_name = "grib_histogram";
|
||||
const char* tool_usage = "[options] grib_file grib_file ...";
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
|
@ -45,7 +45,7 @@ int grib_tool_new_filename_action(grib_runtime_options* options, const char* fil
|
|||
|
||||
int grib_tool_new_file_action(grib_runtime_options* options, grib_tools_file* file)
|
||||
{
|
||||
exit_if_input_is_directory(grib_tool_name, file->name);
|
||||
exit_if_input_is_directory(tool_name, file->name);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -15,9 +15,9 @@
|
|||
|
||||
#include "grib_tools.h"
|
||||
|
||||
const char* grib_tool_description = "Build an index file for a set of input GRIB files.";
|
||||
const char* grib_tool_name = "grib_index_build";
|
||||
const char* grib_tool_usage = "[options] grib_file grib_file ... ";
|
||||
const char* tool_description = "Build an index file for a set of input GRIB files.";
|
||||
const char* tool_name = "grib_index_build";
|
||||
const char* tool_usage = "[options] grib_file grib_file ... ";
|
||||
static grib_index* idx = NULL;
|
||||
static char* keys;
|
||||
static char* default_keys = "mars";
|
||||
|
@ -83,7 +83,7 @@ int grib_tool_init(grib_runtime_options* options)
|
|||
int grib_tool_new_filename_action(grib_runtime_options* options, const char* file)
|
||||
{
|
||||
int ret = 0;
|
||||
printf("--- %s: processing %s\n", grib_tool_name, file);
|
||||
printf("--- %s: processing %s\n", tool_name, file);
|
||||
ret = grib_index_add_file(idx, file);
|
||||
if (ret) {
|
||||
printf("error: %s\n", grib_get_error_message(ret));
|
||||
|
@ -121,7 +121,7 @@ int grib_tool_finalise_action(grib_runtime_options* options)
|
|||
grib_index_compress(idx);
|
||||
}
|
||||
printf("--- %s: keys included in the index file %s:\n",
|
||||
grib_tool_name, options->outfile->name);
|
||||
tool_name, options->outfile->name);
|
||||
printf("--- ");
|
||||
first = 1;
|
||||
the_keys = idx->keys;
|
||||
|
|
|
@ -42,11 +42,11 @@ grib_option grib_options[] = {
|
|||
{ "x", 0, 0, 0, 1, 0 }
|
||||
};
|
||||
|
||||
const char* grib_tool_description =
|
||||
const char* tool_description =
|
||||
"List content of GRIB files printing values of "
|
||||
"some keys.\n\tIt does not fail when a key is not found.";
|
||||
const char* grib_tool_name = "grib_ls";
|
||||
const char* grib_tool_usage = "[options] grib_file grib_file ...";
|
||||
const char* tool_name = "grib_ls";
|
||||
const char* tool_usage = "[options] grib_file grib_file ...";
|
||||
static char* new_handle = "";
|
||||
|
||||
int grib_options_count = sizeof(grib_options) / sizeof(grib_option);
|
||||
|
@ -100,7 +100,7 @@ int grib_tool_init(grib_runtime_options* options)
|
|||
if (options->latlon) {
|
||||
lat = strtod(options->latlon, &theEnd);
|
||||
if (*theEnd != ',') {
|
||||
fprintf(stderr, "Error %s: wrong latitude value. Please use 'latitude,longitude'\n",grib_tool_name);
|
||||
fprintf(stderr, "Error %s: wrong latitude value. Please use 'latitude,longitude'\n",tool_name);
|
||||
exit(1);
|
||||
}
|
||||
lon = strtod(++theEnd, &end1);
|
||||
|
@ -120,7 +120,7 @@ int grib_tool_init(grib_runtime_options* options)
|
|||
options->latlon_mode = 1;
|
||||
}
|
||||
else {
|
||||
fprintf(stderr, "Error %s: wrong mode given in option -l\n", grib_tool_name);
|
||||
fprintf(stderr, "Error %s: wrong mode given in option -l\n", tool_name);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
@ -208,7 +208,7 @@ int grib_tool_new_filename_action(grib_runtime_options* options, const char* fil
|
|||
|
||||
int grib_tool_new_file_action(grib_runtime_options* options, grib_tools_file* file)
|
||||
{
|
||||
exit_if_input_is_directory(grib_tool_name, file->name);
|
||||
exit_if_input_is_directory(tool_name, file->name);
|
||||
if (nearest)
|
||||
grib_nearest_delete(nearest);
|
||||
nearest = NULL;
|
||||
|
|
|
@ -34,9 +34,9 @@ int key_values_size = MAX_KEY_VALUES;
|
|||
* tool to identify the fields to be merged */
|
||||
static const char* md5Key = "md5Product";
|
||||
|
||||
const char* grib_tool_description = "Merge two fields with identical parameters and different geographical area";
|
||||
const char* grib_tool_name = "grib_merge";
|
||||
const char* grib_tool_usage = "[options] file file ... output_file";
|
||||
const char* tool_description = "Merge two fields with identical parameters and different geographical area";
|
||||
const char* tool_name = "grib_merge";
|
||||
const char* tool_usage = "[options] file file ... output_file";
|
||||
|
||||
grib_option grib_options[] = {
|
||||
/* {id, args, help}, on, command_line, value */
|
||||
|
|
|
@ -118,9 +118,9 @@ static int grib_options_help_count = sizeof(grib_options_help_list) / sizeof(gri
|
|||
void usage(void)
|
||||
{
|
||||
int i = 0;
|
||||
printf("\nNAME \t%s\n\n", grib_tool_name);
|
||||
printf("DESCRIPTION\n\t%s\n\n", grib_tool_description);
|
||||
printf("USAGE \n\t%s %s\n\n", grib_tool_name, grib_tool_usage);
|
||||
printf("\nNAME \t%s\n\n", tool_name);
|
||||
printf("DESCRIPTION\n\t%s\n\n", tool_description);
|
||||
printf("USAGE \n\t%s %s\n\n", tool_name, tool_usage);
|
||||
printf("OPTIONS\n");
|
||||
for (i = 0; i < grib_options_count; i++) {
|
||||
if (grib_options[i].command_line)
|
||||
|
@ -333,7 +333,7 @@ int grib_process_runtime_options(grib_context* context, int argc, char** argv, g
|
|||
}
|
||||
|
||||
options->requested_print_keys_count = MAX_KEYS;
|
||||
ret = parse_keyval_string(grib_tool_name, karg, 0, GRIB_TYPE_UNDEFINED,
|
||||
ret = parse_keyval_string(tool_name, karg, 0, GRIB_TYPE_UNDEFINED,
|
||||
options->requested_print_keys, &(options->requested_print_keys_count));
|
||||
if (ret == GRIB_INVALID_ARGUMENT)
|
||||
usage();
|
||||
|
@ -360,7 +360,7 @@ int grib_process_runtime_options(grib_context* context, int argc, char** argv, g
|
|||
if (grib_options_on("s:")) {
|
||||
sarg = grib_options_get_option("s:");
|
||||
options->set_values_count = MAX_KEYS;
|
||||
ret = parse_keyval_string(grib_tool_name, sarg, 1, GRIB_TYPE_UNDEFINED, options->set_values, &(options->set_values_count));
|
||||
ret = parse_keyval_string(tool_name, sarg, 1, GRIB_TYPE_UNDEFINED, options->set_values, &(options->set_values_count));
|
||||
if (ret == GRIB_INVALID_ARGUMENT)
|
||||
usage();
|
||||
}
|
||||
|
@ -368,7 +368,7 @@ int grib_process_runtime_options(grib_context* context, int argc, char** argv, g
|
|||
if (grib_options_on("b:")) {
|
||||
barg = grib_options_get_option("b:");
|
||||
options->set_values_count = MAX_KEYS;
|
||||
ret = parse_keyval_string(grib_tool_name, barg, 0, GRIB_TYPE_STRING, options->set_values, &(options->set_values_count));
|
||||
ret = parse_keyval_string(tool_name, barg, 0, GRIB_TYPE_STRING, options->set_values, &(options->set_values_count));
|
||||
if (ret == GRIB_INVALID_ARGUMENT)
|
||||
usage();
|
||||
}
|
||||
|
@ -376,7 +376,7 @@ int grib_process_runtime_options(grib_context* context, int argc, char** argv, g
|
|||
if (grib_options_on("c:")) {
|
||||
sarg = grib_options_get_option("c:");
|
||||
options->compare_count = MAX_KEYS;
|
||||
ret = parse_keyval_string(grib_tool_name, sarg, 0, GRIB_TYPE_UNDEFINED, options->compare,
|
||||
ret = parse_keyval_string(tool_name, sarg, 0, GRIB_TYPE_UNDEFINED, options->compare,
|
||||
&(options->compare_count));
|
||||
if (ret == GRIB_INVALID_ARGUMENT)
|
||||
usage();
|
||||
|
@ -392,7 +392,7 @@ int grib_process_runtime_options(grib_context* context, int argc, char** argv, g
|
|||
warg = grib_options_get_option("w:");
|
||||
|
||||
options->constraints_count = MAX_KEYS;
|
||||
ret = parse_keyval_string(grib_tool_name, warg, 1, GRIB_TYPE_UNDEFINED,
|
||||
ret = parse_keyval_string(tool_name, warg, 1, GRIB_TYPE_UNDEFINED,
|
||||
options->constraints, &(options->constraints_count));
|
||||
if (ret == GRIB_INVALID_ARGUMENT)
|
||||
usage();
|
||||
|
@ -458,9 +458,9 @@ char* grib_options_get_args(char* id)
|
|||
void usage_doxygen(void)
|
||||
{
|
||||
int i = 0;
|
||||
printf("/*! \\page %s %s\n", grib_tool_name, grib_tool_name);
|
||||
printf("\\section DESCRIPTION \n %s\n\n", grib_tool_description);
|
||||
printf("\\section USAGE \n %s \n %s\n\n", grib_tool_name, grib_tool_usage);
|
||||
printf("/*! \\page %s %s\n", tool_name, tool_name);
|
||||
printf("\\section DESCRIPTION \n %s\n\n", tool_description);
|
||||
printf("\\section USAGE \n %s \n %s\n\n", tool_name, tool_usage);
|
||||
printf("\\section OPTIONS \n");
|
||||
for (i = 0; i < grib_options_count; i++) {
|
||||
if (grib_options[i].command_line) {
|
||||
|
@ -477,9 +477,9 @@ void usage_doxygen(void)
|
|||
#if 0
|
||||
void usage_doxygen(void) {
|
||||
int i=0;
|
||||
printf("/*! \\page %s %s\n",grib_tool_name,grib_tool_name);
|
||||
printf("\\section DESCRIPTION \n%s\n\n",grib_tool_description);
|
||||
printf("\\section USAGE \n%s \n%s\n\n",grib_tool_name,grib_tool_usage);
|
||||
printf("/*! \\page %s %s\n",tool_name,tool_name);
|
||||
printf("\\section DESCRIPTION \n%s\n\n",tool_description);
|
||||
printf("\\section USAGE \n%s \n%s\n\n",tool_name,tool_usage);
|
||||
printf("\\section OPTIONS\n");
|
||||
printf("<table frame=void border=0>\n");
|
||||
for (i=0;i<grib_options_count;i++) {
|
||||
|
|
|
@ -46,12 +46,12 @@ grib_option grib_options[] = {
|
|||
{ "v", 0, 0, 0, 1, 0 }
|
||||
};
|
||||
|
||||
const char* grib_tool_description =
|
||||
const char* tool_description =
|
||||
"Sets key/value pairs in the input GRIB file and writes"
|
||||
"\n\teach message to the output_grib_file."
|
||||
"\n\tIt fails when an error occurs (e.g. key not found).";
|
||||
const char* grib_tool_name = "grib_set";
|
||||
const char* grib_tool_usage = "[options] grib_file grib_file ... output_grib_file";
|
||||
const char* tool_name = "grib_set";
|
||||
const char* tool_usage = "[options] grib_file grib_file ... output_grib_file";
|
||||
|
||||
int grib_options_count = sizeof(grib_options) / sizeof(grib_option);
|
||||
|
||||
|
@ -169,7 +169,7 @@ int grib_tool_finalise_action(grib_runtime_options* options)
|
|||
int err = 0;
|
||||
grib_file_close_all(&err);
|
||||
if (err != GRIB_SUCCESS) {
|
||||
perror(grib_tool_name);
|
||||
perror(tool_name);
|
||||
exit(err);
|
||||
}
|
||||
|
||||
|
|
|
@ -28,12 +28,12 @@
|
|||
#include <stdint.h>
|
||||
#endif
|
||||
|
||||
const char* grib_tool_description =
|
||||
const char* tool_description =
|
||||
"Convert a GRIB file to netCDF format."
|
||||
"\n\tNote: The GRIB geometry should be a regular lat/lon grid or a regular Gaussian grid"
|
||||
"\n\t(the key \"typeOfGrid\" should be \"regular_ll\" or \"regular_gg\")";
|
||||
const char* grib_tool_name = "grib_to_netcdf";
|
||||
const char* grib_tool_usage = "[options] grib_file grib_file ... ";
|
||||
const char* tool_name = "grib_to_netcdf";
|
||||
const char* tool_usage = "[options] grib_file grib_file ... ";
|
||||
static char argvString[2048] = {0,};
|
||||
|
||||
/*=====================================================================*/
|
||||
|
@ -2143,9 +2143,9 @@ static nc_type translate_nctype(const char* name)
|
|||
static void check_err(const char* function, const int stat, const int line)
|
||||
{
|
||||
if (stat != NC_NOERR) {
|
||||
/* (void) fprintf(stderr, "line %d of %s: %s\n", line, grib_tool_name, nc_strerror(stat)); */
|
||||
/* (void) fprintf(stderr, "line %d of %s: %s\n", line, tool_name, nc_strerror(stat)); */
|
||||
(void)fprintf(stderr, "\n%s ERROR: line %d, %s: %s\n",
|
||||
grib_tool_name, line, function, nc_strerror(stat));
|
||||
tool_name, line, function, nc_strerror(stat));
|
||||
if (stat == NC_EVARSIZE) {
|
||||
(void)fprintf(stderr,
|
||||
"\nCannot create netCDF classic format, dataset is too large!\n"
|
||||
|
@ -3062,7 +3062,7 @@ static int define_netcdf_dimensions(hypercube* h, fieldset* fs, int ncid, datase
|
|||
dims[i] = n - i - 1;
|
||||
|
||||
for (i = 0; i < subsetcnt; ++i) {
|
||||
printf("%s: Defining variable '%s'.\n", grib_tool_name, subsets[i].att.name);
|
||||
printf("%s: Defining variable '%s'.\n", tool_name, subsets[i].att.name);
|
||||
|
||||
stat = nc_def_var(ncid, subsets[i].att.name, subsets[i].att.nctype, n, dims, &var_id);
|
||||
check_err("nc_def_var", stat, __LINE__);
|
||||
|
@ -3351,7 +3351,7 @@ static void print_ignored_keys(FILE* f, request* data)
|
|||
int i = 0;
|
||||
while ((ignore = get_value(data, "ignore", i)) != NULL) {
|
||||
if (i == 0) {
|
||||
fprintf(f, "%s: Ignoring key(s): %s", grib_tool_name, ignore);
|
||||
fprintf(f, "%s: Ignoring key(s): %s", tool_name, ignore);
|
||||
}
|
||||
else {
|
||||
fprintf(f, ", %s", ignore);
|
||||
|
@ -3861,25 +3861,25 @@ static int get_creation_mode(int option_kind)
|
|||
int creation_mode = NC_CLOBBER;
|
||||
switch (option_kind) {
|
||||
case NC_FORMAT_CLASSIC:
|
||||
printf("%s: Creating classic file format.\n", grib_tool_name);
|
||||
printf("%s: Creating classic file format.\n", tool_name);
|
||||
break;
|
||||
case NC_FORMAT_64BIT:
|
||||
creation_mode |= NC_64BIT_OFFSET;
|
||||
printf("%s: Creating large (64 bit) file format.\n", grib_tool_name);
|
||||
printf("%s: Creating large (64 bit) file format.\n", tool_name);
|
||||
break;
|
||||
#ifdef NC_NETCDF4
|
||||
case NC_FORMAT_NETCDF4:
|
||||
creation_mode |= NC_NETCDF4;
|
||||
printf("%s: Creating netCDF-4/HDF5 format.\n", grib_tool_name);
|
||||
printf("%s: Creating netCDF-4/HDF5 format.\n", tool_name);
|
||||
break;
|
||||
case NC_FORMAT_NETCDF4_CLASSIC:
|
||||
creation_mode |= NC_NETCDF4 | NC_CLASSIC_MODEL;
|
||||
printf("%s: Creating netCDF-4 classic model file format.\n", grib_tool_name);
|
||||
printf("%s: Creating netCDF-4 classic model file format.\n", tool_name);
|
||||
break;
|
||||
#else
|
||||
case NC_FORMAT_NETCDF4:
|
||||
case NC_FORMAT_NETCDF4_CLASSIC:
|
||||
grib_context_log(ctx, GRIB_LOG_ERROR, "%s not built with netcdf4, cannot create netCDF-4 files.", grib_tool_name);
|
||||
grib_context_log(ctx, GRIB_LOG_ERROR, "%s not built with netcdf4, cannot create netCDF-4 files.", tool_name);
|
||||
exit(1);
|
||||
break;
|
||||
#endif
|
||||
|
@ -3993,7 +3993,7 @@ int grib_tool_init(grib_runtime_options* options)
|
|||
data_r = empty_request(0);
|
||||
user_r = empty_request(0);
|
||||
|
||||
printf("%s: Version ", grib_tool_name);
|
||||
printf("%s: Version ", tool_name);
|
||||
grib_print_api_version(stdout);
|
||||
printf("\n");
|
||||
|
||||
|
@ -4128,7 +4128,7 @@ int grib_tool_new_filename_action(grib_runtime_options* options, const char* fil
|
|||
grib_handle* h = NULL;
|
||||
grib_file* file = NULL;
|
||||
|
||||
printf("%s: Processing input file '%s'.\n", grib_tool_name, filename);
|
||||
printf("%s: Processing input file '%s'.\n", tool_name, filename);
|
||||
|
||||
file = grib_file_open(filename, "r", &e);
|
||||
if (!file || !file->handle)
|
||||
|
@ -4280,7 +4280,7 @@ int grib_tool_finalise_action(grib_runtime_options* options)
|
|||
return -1;
|
||||
}
|
||||
|
||||
printf("%s: Found %d GRIB field%s in %d file%s.\n", grib_tool_name, fs->count, fs->count > 1 ? "s" : "", files, files > 1 ? "s" : "");
|
||||
printf("%s: Found %d GRIB field%s in %d file%s.\n", tool_name, fs->count, fs->count > 1 ? "s" : "", files, files > 1 ? "s" : "");
|
||||
|
||||
if (ctx->debug) {
|
||||
grib_context_log(ctx, GRIB_LOG_INFO, "Request representing %d fields ", fs->count);
|
||||
|
@ -4304,8 +4304,8 @@ int grib_tool_finalise_action(grib_runtime_options* options)
|
|||
|
||||
/* Create netcdf file */
|
||||
|
||||
printf("%s: Creating netCDF file '%s'\n", grib_tool_name, options->outfile->name);
|
||||
printf("%s: NetCDF library version: %s\n", grib_tool_name, nc_inq_libvers());
|
||||
printf("%s: Creating netCDF file '%s'\n", tool_name, options->outfile->name);
|
||||
printf("%s: NetCDF library version: %s\n", tool_name, nc_inq_libvers());
|
||||
|
||||
creation_mode = get_creation_mode(option_kind);
|
||||
stat = nc_create(options->outfile->name, creation_mode, &ncid);
|
||||
|
@ -4354,7 +4354,7 @@ int grib_tool_finalise_action(grib_runtime_options* options)
|
|||
free_subsets(subsets, count);
|
||||
|
||||
free_nc_options();
|
||||
printf("%s: Done.\n", grib_tool_name);
|
||||
printf("%s: Done.\n", tool_name);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -1352,10 +1352,10 @@ void grib_tools_write_message(grib_runtime_options* options, grib_handle* h)
|
|||
}
|
||||
#endif
|
||||
}
|
||||
int exit_if_input_is_directory(const char* tool_name, const char* filename)
|
||||
int exit_if_input_is_directory(const char* toolname, const char* filename)
|
||||
{
|
||||
if (path_is_directory(filename)) {
|
||||
fprintf(stderr, "%s: ERROR: \"%s\": Is a directory\n", tool_name, filename);
|
||||
fprintf(stderr, "%s: ERROR: \"%s\": Is a directory\n", toolname, filename);
|
||||
exit(1);
|
||||
}
|
||||
return 0;
|
||||
|
|
|
@ -174,9 +174,9 @@ typedef struct grib_runtime_options
|
|||
|
||||
extern grib_option grib_options[];
|
||||
extern int grib_options_count;
|
||||
extern const char* grib_tool_name;
|
||||
extern const char* grib_tool_description;
|
||||
extern const char* grib_tool_usage;
|
||||
extern const char* tool_name;
|
||||
extern const char* tool_description;
|
||||
extern const char* tool_usage;
|
||||
|
||||
extern FILE* dump_file;
|
||||
|
||||
|
@ -206,6 +206,6 @@ int grib_process_runtime_options(grib_context* c, int argc, char** argv, grib_ru
|
|||
void grib_tools_write_message(grib_runtime_options* options, grib_handle* h);
|
||||
int grib_tool_new_filename_action(grib_runtime_options* options, const char* file);
|
||||
int grib_no_handle_action(grib_runtime_options* options, int err);
|
||||
int exit_if_input_is_directory(const char* tool_name, const char* filename);
|
||||
int exit_if_input_is_directory(const char* toolname, const char* filename);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -131,13 +131,13 @@ int counter = 0;
|
|||
int start = -1;
|
||||
int end = -1;
|
||||
|
||||
const char* grib_tool_description =
|
||||
const char* tool_description =
|
||||
"Compare GTS messages contained in two files."
|
||||
"\n\tIf some differences are found it fails returning an error code."
|
||||
"\n\tDefault behaviour: bit-by-bit compare, same order in files.";
|
||||
|
||||
const char* grib_tool_name = "gts_compare";
|
||||
const char* grib_tool_usage =
|
||||
const char* tool_name = "gts_compare";
|
||||
const char* tool_usage =
|
||||
"[options] "
|
||||
"file file";
|
||||
|
||||
|
|
|
@ -10,11 +10,11 @@
|
|||
|
||||
#include "grib_tools.h"
|
||||
|
||||
const char* grib_tool_description =
|
||||
const char* tool_description =
|
||||
"Copies the content of GTS files printing"
|
||||
" values of some keys.";
|
||||
const char* grib_tool_name = "gts_copy";
|
||||
const char* grib_tool_usage = "[options] file file ... output_file";
|
||||
const char* tool_name = "gts_copy";
|
||||
const char* tool_usage = "[options] file file ... output_file";
|
||||
|
||||
grib_option grib_options[] = {
|
||||
/* {id, args, help}, on, command_line, value */
|
||||
|
|
|
@ -33,9 +33,9 @@ grib_option grib_options[] = {
|
|||
{ "x", 0, 0, 0, 1, 0 }
|
||||
};
|
||||
|
||||
const char* grib_tool_description = "Dump the content of a GTS file in different formats.";
|
||||
const char* grib_tool_name = "gts_dump";
|
||||
const char* grib_tool_usage = "[options] file file ...";
|
||||
const char* tool_description = "Dump the content of a GTS file in different formats.";
|
||||
const char* tool_name = "gts_dump";
|
||||
const char* tool_usage = "[options] file file ...";
|
||||
|
||||
int grib_options_count = sizeof(grib_options) / sizeof(grib_option);
|
||||
|
||||
|
@ -62,7 +62,7 @@ int grib_tool_init(grib_runtime_options* options)
|
|||
|
||||
|
||||
if (opt > 1) {
|
||||
printf("%s: simultaneous O/D options not allowed\n", grib_tool_name);
|
||||
printf("%s: simultaneous O/D options not allowed\n", tool_name);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
|
|
@ -26,12 +26,12 @@ grib_option grib_options[] = {
|
|||
{ "7", 0, 0, 0, 1, 0 },
|
||||
{ "v", 0, 0, 0, 1, 0 }
|
||||
};
|
||||
const char* grib_tool_description =
|
||||
const char* tool_description =
|
||||
"Apply the rules defined in rules_file to each GTS "
|
||||
"message\n\tin the GTS files provided as arguments.\n\t"
|
||||
"If you specify '-' (a single dash) for the rules_file, the rules will be read from standard input.";
|
||||
const char* grib_tool_name = "gts_filter";
|
||||
const char* grib_tool_usage =
|
||||
const char* tool_name = "gts_filter";
|
||||
const char* tool_usage =
|
||||
"[options] rules_file "
|
||||
"file file ...";
|
||||
int fail = 0;
|
||||
|
|
|
@ -28,12 +28,12 @@ grib_option grib_options[] = {
|
|||
{ "v", 0, 0, 1, 0, 0 }
|
||||
};
|
||||
|
||||
const char* grib_tool_description =
|
||||
const char* tool_description =
|
||||
"Get values of some keys from a GTS file."
|
||||
"\n\tIt is similar to gts_ls, but fails returning an error code "
|
||||
"\n\twhen an error occurs (e.g. key not found).";
|
||||
const char* grib_tool_name = "gts_get";
|
||||
const char* grib_tool_usage = "[options] file file ...";
|
||||
const char* tool_name = "gts_get";
|
||||
const char* tool_usage = "[options] file file ...";
|
||||
|
||||
int grib_options_count = sizeof(grib_options) / sizeof(grib_option);
|
||||
int mode = 0;
|
||||
|
|
|
@ -32,11 +32,11 @@ grib_option grib_options[] = {
|
|||
{ "v", 0, 0, 1, 0, 0 }
|
||||
};
|
||||
|
||||
const char* grib_tool_description =
|
||||
const char* tool_description =
|
||||
"List content of GTS files printing values of "
|
||||
"some keys.\n\tIt does not fail when a key is not found.";
|
||||
const char* grib_tool_name = "gts_ls";
|
||||
const char* grib_tool_usage = "[options] file file ...";
|
||||
const char* tool_name = "gts_ls";
|
||||
const char* tool_usage = "[options] file file ...";
|
||||
|
||||
int grib_options_count = sizeof(grib_options) / sizeof(grib_option);
|
||||
int mode = 0;
|
||||
|
|
|
@ -194,14 +194,14 @@ int global_counter = 0;
|
|||
int start = -1;
|
||||
int end = -1;
|
||||
|
||||
const char* grib_tool_description =
|
||||
const char* tool_description =
|
||||
"Compare METAR messages contained in two files."
|
||||
"\n\tIf some differences are found it fails returning an error code."
|
||||
"\n\tFloating-point values are compared exactly by default, different tolerance can be defined see -P -A -R."
|
||||
"\n\tDefault behaviour: absolute error=0, bit-by-bit compare, same order in files.";
|
||||
|
||||
const char* grib_tool_name = "metar_compare";
|
||||
const char* grib_tool_usage =
|
||||
const char* tool_name = "metar_compare";
|
||||
const char* tool_usage =
|
||||
"[options] "
|
||||
"file file";
|
||||
|
||||
|
|
|
@ -10,11 +10,11 @@
|
|||
|
||||
#include "grib_tools.h"
|
||||
|
||||
const char* grib_tool_description =
|
||||
const char* tool_description =
|
||||
"Copies the content of METAR files printing"
|
||||
" values of some keys.";
|
||||
const char* grib_tool_name = "metar_copy";
|
||||
const char* grib_tool_usage = "[options] file file ... output_file";
|
||||
const char* tool_name = "metar_copy";
|
||||
const char* tool_usage = "[options] file file ... output_file";
|
||||
|
||||
grib_option grib_options[] = {
|
||||
/* {id, args, help}, on, command_line, value */
|
||||
|
|
|
@ -36,9 +36,9 @@ grib_option grib_options[] = {
|
|||
{ "x", 0, 0, 0, 1, 0 }
|
||||
};
|
||||
|
||||
const char* grib_tool_description = "Dump the content of a METAR file in different formats.";
|
||||
const char* grib_tool_name = "metar_dump";
|
||||
const char* grib_tool_usage = "[options] file file ...";
|
||||
const char* tool_description = "Dump the content of a METAR file in different formats.";
|
||||
const char* tool_name = "metar_dump";
|
||||
const char* tool_usage = "[options] file file ...";
|
||||
|
||||
int grib_options_count = sizeof(grib_options) / sizeof(grib_option);
|
||||
|
||||
|
@ -59,7 +59,7 @@ int grib_tool_init(grib_runtime_options* options)
|
|||
options->dump_mode = "default";
|
||||
|
||||
if (opt > 1) {
|
||||
printf("%s: simultaneous O/D options not allowed\n", grib_tool_name);
|
||||
printf("%s: simultaneous O/D options not allowed\n", tool_name);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
|
|
@ -24,11 +24,11 @@ grib_option grib_options[] = {
|
|||
{ "7", 0, 0, 0, 1, 0 },
|
||||
{ "v", 0, 0, 0, 1, 0 }
|
||||
};
|
||||
const char* grib_tool_description =
|
||||
const char* tool_description =
|
||||
"Apply the rules defined in rules_file to each METAR "
|
||||
"message\n\tin the files provided as arguments.";
|
||||
const char* grib_tool_name = "metar_filter";
|
||||
const char* grib_tool_usage =
|
||||
const char* tool_name = "metar_filter";
|
||||
const char* tool_usage =
|
||||
"[options] rules_file "
|
||||
"file file ...";
|
||||
int fail = 0;
|
||||
|
|
|
@ -29,12 +29,12 @@ grib_option grib_options[] = {
|
|||
{ "v", 0, 0, 1, 0, 0 }
|
||||
};
|
||||
|
||||
const char* grib_tool_description =
|
||||
const char* tool_description =
|
||||
"Get values of some keys from a METAR file."
|
||||
"\n\tIt is similar to metar_ls, but fails returning an error code "
|
||||
"\n\twhen an error occurs (e.g. key not found).";
|
||||
const char* grib_tool_name = "metar_get";
|
||||
const char* grib_tool_usage = "[options] file file ...";
|
||||
const char* tool_name = "metar_get";
|
||||
const char* tool_usage = "[options] file file ...";
|
||||
|
||||
int grib_options_count = sizeof(grib_options) / sizeof(grib_option);
|
||||
double lat = 0;
|
||||
|
|
|
@ -44,11 +44,11 @@ grib_option grib_options[] = {
|
|||
/*{"x",0,0,0,1,0}*/
|
||||
};
|
||||
|
||||
const char* grib_tool_description =
|
||||
const char* tool_description =
|
||||
"List content of METAR files printing values of "
|
||||
"some keys.\n\tIt does not fail when a key is not found.";
|
||||
const char* grib_tool_name = "metar_ls";
|
||||
const char* grib_tool_usage = "[options] file file ...";
|
||||
const char* tool_name = "metar_ls";
|
||||
const char* tool_usage = "[options] file file ...";
|
||||
|
||||
int grib_options_count = sizeof(grib_options) / sizeof(grib_option);
|
||||
double lat = 0;
|
||||
|
|
|
@ -29,9 +29,9 @@ grib_option grib_options[] = {
|
|||
{ "x", 0, 0, 0, 1, 0 }
|
||||
};
|
||||
|
||||
const char* grib_tool_description = "Dump the content of a TAF file in different formats.";
|
||||
const char* grib_tool_name = "taf_dump";
|
||||
const char* grib_tool_usage = "[options] file file ...";
|
||||
const char* tool_description = "Dump the content of a TAF file in different formats.";
|
||||
const char* tool_name = "taf_dump";
|
||||
const char* tool_usage = "[options] file file ...";
|
||||
|
||||
int grib_options_count = sizeof(grib_options) / sizeof(grib_option);
|
||||
|
||||
|
@ -53,7 +53,7 @@ int grib_tool_init(grib_runtime_options* options)
|
|||
|
||||
|
||||
if (opt > 1) {
|
||||
printf("%s: simultaneous C/O/D options not allowed\n", grib_tool_name);
|
||||
printf("%s: simultaneous C/O/D options not allowed\n", tool_name);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
|
|
@ -26,11 +26,11 @@ grib_option grib_options[] = {
|
|||
{ "7", 0, 0, 0, 1, 0 },
|
||||
{ "v", 0, 0, 0, 1, 0 }
|
||||
};
|
||||
const char* grib_tool_description =
|
||||
const char* tool_description =
|
||||
"Apply the rules defined in rules_file to each TAF "
|
||||
"message\n\tin the files provided as arguments.";
|
||||
const char* grib_tool_name = "taf_filter";
|
||||
const char* grib_tool_usage =
|
||||
const char* tool_name = "taf_filter";
|
||||
const char* tool_usage =
|
||||
"[options] rules_file "
|
||||
"file file ...";
|
||||
int fail = 0;
|
||||
|
|
|
@ -33,12 +33,12 @@ grib_option grib_options[] = {
|
|||
{ "i:", 0, 0, 0, 1, 0 }
|
||||
};
|
||||
|
||||
const char* grib_tool_description =
|
||||
const char* tool_description =
|
||||
"Get values of some keys from a TAF file."
|
||||
"\n\tIt is similar to taf_ls, but fails returning an error code "
|
||||
"\n\twhen an error occurs (e.g. key not found).";
|
||||
const char* grib_tool_name = "taf_get";
|
||||
const char* grib_tool_usage = "[options] file file ...";
|
||||
const char* tool_name = "taf_get";
|
||||
const char* tool_usage = "[options] file file ...";
|
||||
|
||||
int grib_options_count = sizeof(grib_options) / sizeof(grib_option);
|
||||
int mode = 0;
|
||||
|
|
|
@ -37,11 +37,11 @@ grib_option grib_options[] = {
|
|||
{ "x", 0, 0, 0, 1, 0 }
|
||||
};
|
||||
|
||||
const char* grib_tool_description =
|
||||
const char* tool_description =
|
||||
"List content of TAF files printing values of "
|
||||
"some keys.\n\tIt does not fail when a key is not found.";
|
||||
const char* grib_tool_name = "taf_ls";
|
||||
const char* grib_tool_usage = "[options] file file ...";
|
||||
const char* tool_name = "taf_ls";
|
||||
const char* tool_usage = "[options] file file ...";
|
||||
|
||||
int grib_options_count = sizeof(grib_options) / sizeof(grib_option);
|
||||
double lat = 0;
|
||||
|
|
Loading…
Reference in New Issue