From 350d8e6747819cc4792a20ee1ef916f3c8bd228c Mon Sep 17 00:00:00 2001 From: Shahram Najm Date: Wed, 4 Jan 2023 21:16:24 +0000 Subject: [PATCH 01/17] ECC-1500: Tools: Print the online help page URL --- tools/bufr_compare.c | 5 +++-- tools/bufr_copy.c | 5 +++-- tools/bufr_dump.c | 1 + tools/bufr_filter.c | 8 ++++---- tools/bufr_get.c | 5 +++-- tools/bufr_index_build.c | 5 +++-- tools/bufr_ls.c | 1 + tools/bufr_set.c | 5 +++-- tools/grib_compare.c | 1 + tools/grib_copy.c | 1 + tools/grib_dump.c | 1 + tools/grib_filter.c | 6 +++--- tools/grib_get.c | 1 + tools/grib_get_data.c | 1 + tools/grib_histogram.c | 1 + tools/grib_index_build.c | 1 + tools/grib_ls.c | 5 +++-- tools/grib_merge.c | 1 + tools/grib_options.c | 5 ++++- tools/grib_set.c | 5 +++-- tools/grib_to_netcdf.c | 1 + tools/grib_tools.h | 1 + tools/gts_compare.c | 1 + tools/gts_copy.c | 1 + tools/gts_dump.c | 1 + tools/gts_filter.c | 1 + tools/gts_get.c | 1 + tools/gts_ls.c | 1 + tools/metar_compare.c | 1 + tools/metar_copy.c | 1 + tools/metar_dump.c | 1 + tools/metar_filter.c | 1 + tools/metar_get.c | 1 + tools/metar_ls.c | 1 + tools/taf_dump.c | 1 + tools/taf_filter.c | 1 + tools/taf_get.c | 1 + tools/taf_ls.c | 1 + 38 files changed, 60 insertions(+), 22 deletions(-) diff --git a/tools/bufr_compare.c b/tools/bufr_compare.c index d1c4f6074..fd332aa94 100644 --- a/tools/bufr_compare.c +++ b/tools/bufr_compare.c @@ -45,8 +45,9 @@ const char* tool_description = "\n\tFloating-point values are compared exactly by default, different tolerances can be defined (see -A -R)." "\n\tDefault behaviour: absolute error=0, bit-by-bit compare, same order in files."; -const char* tool_name = "bufr_compare"; -const char* tool_usage = "[options] bufr_file1 bufr_file2"; +const char* tool_name = "bufr_compare"; +const char* tool_online_doc = "https://confluence.ecmwf.int/display/ECC/bufr_compare"; +const char* tool_usage = "[options] bufr_file1 bufr_file2"; GRIB_INLINE static int grib_inline_strcmp(const char* a, const char* b) { diff --git a/tools/bufr_copy.c b/tools/bufr_copy.c index cc8dedc19..392b02fa3 100644 --- a/tools/bufr_copy.c +++ b/tools/bufr_copy.c @@ -19,8 +19,9 @@ 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* tool_name = "bufr_copy"; -const char* tool_usage = "[options] bufr_file bufr_file ... output_bufr_file"; +const char* tool_name = "bufr_copy"; +const char* tool_online_doc = "https://confluence.ecmwf.int/display/ECC/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 */ diff --git a/tools/bufr_dump.c b/tools/bufr_dump.c index 0e0ecbcb0..2e84177ac 100644 --- a/tools/bufr_dump.c +++ b/tools/bufr_dump.c @@ -64,6 +64,7 @@ grib_option grib_options[] = { const char* tool_description = "Dump the content of a BUFR file in different formats."; const char* tool_name = "bufr_dump"; +const char* tool_online_doc = "https://confluence.ecmwf.int/display/ECC/bufr_dump"; const char* tool_usage = "[options] bufr_file bufr_file ..."; static int json = 0; static int dump_descriptors = 0; diff --git a/tools/bufr_filter.c b/tools/bufr_filter.c index cd0f9b428..0ad9870ed 100644 --- a/tools/bufr_filter.c +++ b/tools/bufr_filter.c @@ -34,10 +34,10 @@ 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* tool_name = "bufr_filter"; -const char* tool_usage = - "[options] rules_file " - "bufr_file bufr_file ..."; +const char* tool_name = "bufr_filter"; +const char* tool_online_doc = "https://confluence.ecmwf.int/display/ECC/bufr_filter"; +const char* tool_usage = "[options] rules_file " + "bufr_file bufr_file ..."; int grib_options_count = sizeof(grib_options) / sizeof(grib_option); diff --git a/tools/bufr_get.c b/tools/bufr_get.c index cb4b360b0..3da7a0069 100644 --- a/tools/bufr_get.c +++ b/tools/bufr_get.c @@ -39,8 +39,9 @@ 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* tool_name = "bufr_get"; -const char* tool_usage = "[options] file file ..."; +const char* tool_name = "bufr_get"; +const char* tool_online_doc = "https://confluence.ecmwf.int/display/ECC/bufr_get"; +const char* tool_usage = "[options] file file ..."; int grib_options_count = sizeof(grib_options) / sizeof(grib_option); diff --git a/tools/bufr_index_build.c b/tools/bufr_index_build.c index aa5041f2d..973f89d82 100644 --- a/tools/bufr_index_build.c +++ b/tools/bufr_index_build.c @@ -18,8 +18,9 @@ const char* tool_description = "Build an index file for a set of input BUFR files.\n" "\tWarning: THIS TOOL IS STILL EXPERIMENTAL"; -const char* tool_name = "bufr_index_build"; -const char* tool_usage = "[options] file file ... "; +const char* tool_name = "bufr_index_build"; +const char* tool_online_doc = NULL; +const char* tool_usage = "[options] file file ... "; grib_index* idx = NULL; char* keys; char* default_keys = "mars"; diff --git a/tools/bufr_ls.c b/tools/bufr_ls.c index 461f69f25..bdbbb06e9 100644 --- a/tools/bufr_ls.c +++ b/tools/bufr_ls.c @@ -42,6 +42,7 @@ const char* tool_description = "some header keys.\n\tOnly scalar keys can be printed." "\n\tIt does not fail when a key is not found."; const char* tool_name = "bufr_ls"; +const char* tool_online_doc = "https://confluence.ecmwf.int/display/ECC/bufr_ls"; const char* tool_usage = "[options] bufr_file bufr_file ..."; static int first_handle = 1; diff --git a/tools/bufr_set.c b/tools/bufr_set.c index 78dc8e959..e1efd6f75 100644 --- a/tools/bufr_set.c +++ b/tools/bufr_set.c @@ -45,8 +45,9 @@ 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* tool_name = "bufr_set"; -const char* tool_usage = "[options] file file ... output_file"; +const char* tool_name = "bufr_set"; +const char* tool_online_doc = "https://confluence.ecmwf.int/display/ECC/bufr_set"; +const char* tool_usage = "[options] file file ... output_file"; int grib_options_count = sizeof(grib_options) / sizeof(grib_option); diff --git a/tools/grib_compare.c b/tools/grib_compare.c index 92ebea613..9149e7420 100644 --- a/tools/grib_compare.c +++ b/tools/grib_compare.c @@ -44,6 +44,7 @@ const char* tool_description = "\n\tDefault behaviour: absolute error=0, bit-by-bit compare, same order in files."; const char* tool_name = "grib_compare"; +const char* tool_online_doc = "https://confluence.ecmwf.int/display/ECC/grib_compare"; const char* tool_usage = "[options] grib_file1 grib_file2"; typedef double (*compare_double_proc)(const double*, const double*, double); diff --git a/tools/grib_copy.c b/tools/grib_copy.c index 974bb4550..7eb8a5516 100644 --- a/tools/grib_copy.c +++ b/tools/grib_copy.c @@ -20,6 +20,7 @@ const char* tool_description = " 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* tool_name = "grib_copy"; +const char* tool_online_doc = "https://confluence.ecmwf.int/display/ECC/grib_copy"; const char* tool_usage = "[options] grib_file grib_file ... output_grib_file"; grib_option grib_options[] = { diff --git a/tools/grib_dump.c b/tools/grib_dump.c index 9dd9f0052..09b7cc6be 100644 --- a/tools/grib_dump.c +++ b/tools/grib_dump.c @@ -41,6 +41,7 @@ grib_option grib_options[] = { const char* tool_description = "Dump the content of a GRIB file in different formats."; const char* tool_name = "grib_dump"; +const char* tool_online_doc = "https://confluence.ecmwf.int/display/ECC/grib_dump"; const char* tool_usage = "[options] grib_file grib_file ..."; static int json = 0; static int first_handle = 1; diff --git a/tools/grib_filter.c b/tools/grib_filter.c index a8683702e..8ed7ff296 100644 --- a/tools/grib_filter.c +++ b/tools/grib_filter.c @@ -31,9 +31,9 @@ const char* tool_description = "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* tool_name = "grib_filter"; -const char* tool_usage = - "[options] rules_file " - "grib_file grib_file ..."; +const char* tool_online_doc = "https://confluence.ecmwf.int/display/ECC/grib_filter"; +const char* tool_usage = "[options] rules_file " + "grib_file grib_file ..."; int grib_options_count = sizeof(grib_options) / sizeof(grib_option); diff --git a/tools/grib_get.c b/tools/grib_get.c index cd79b2e86..4d5040bfa 100644 --- a/tools/grib_get.c +++ b/tools/grib_get.c @@ -40,6 +40,7 @@ const char* tool_description = "\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* tool_name = "grib_get"; +const char* tool_online_doc = "https://confluence.ecmwf.int/display/ECC/grib_get"; const char* tool_usage = "[options] grib_file grib_file ..."; int grib_options_count = sizeof(grib_options) / sizeof(grib_option); diff --git a/tools/grib_get_data.c b/tools/grib_get_data.c index e00cd696d..76d2ac0f6 100644 --- a/tools/grib_get_data.c +++ b/tools/grib_get_data.c @@ -39,6 +39,7 @@ const char* tool_description = "Print a latitude, longitude, data values list.\n" "\tNote: Rotated grids are first unrotated"; const char* tool_name = "grib_get_data"; +const char* tool_online_doc = "https://confluence.ecmwf.int/display/ECC/grib_get_data"; const char* tool_usage = "[options] grib_file grib_file ..."; extern FILE* dump_file; diff --git a/tools/grib_histogram.c b/tools/grib_histogram.c index 755907b2a..a41105c74 100644 --- a/tools/grib_histogram.c +++ b/tools/grib_histogram.c @@ -21,6 +21,7 @@ int grib_options_count = sizeof(grib_options) / sizeof(grib_option); const char* tool_description = "Histogram of GRIB files"; const char* tool_name = "grib_histogram"; +const char* tool_online_doc = NULL; const char* tool_usage = "[options] grib_file grib_file ..."; int main(int argc, char* argv[]) diff --git a/tools/grib_index_build.c b/tools/grib_index_build.c index d8c0add78..664575844 100644 --- a/tools/grib_index_build.c +++ b/tools/grib_index_build.c @@ -17,6 +17,7 @@ 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_online_doc = "https://confluence.ecmwf.int/display/ECC/grib_index_build"; const char* tool_usage = "[options] grib_file grib_file ... "; static grib_index* idx = NULL; static const char* keys; diff --git a/tools/grib_ls.c b/tools/grib_ls.c index 1828d0357..c13e61210 100644 --- a/tools/grib_ls.c +++ b/tools/grib_ls.c @@ -45,8 +45,9 @@ grib_option grib_options[] = { 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* tool_name = "grib_ls"; -const char* tool_usage = "[options] grib_file grib_file ..."; +const char* tool_name = "grib_ls"; +const char* tool_online_doc = "https://confluence.ecmwf.int/display/ECC/grib_ls"; +const char* tool_usage = "[options] grib_file grib_file ..."; static const char* new_handle = ""; int grib_options_count = sizeof(grib_options) / sizeof(grib_option); diff --git a/tools/grib_merge.c b/tools/grib_merge.c index ce47666ed..7c09956f7 100644 --- a/tools/grib_merge.c +++ b/tools/grib_merge.c @@ -36,6 +36,7 @@ static const char* md5Key = "md5Product"; const char* tool_description = "Merge two fields with identical parameters and different geographical area"; const char* tool_name = "grib_merge"; +const char* tool_online_doc = NULL; const char* tool_usage = "[options] file file ... output_file"; grib_option grib_options[] = { diff --git a/tools/grib_options.c b/tools/grib_options.c index 94a1a4c15..9374f519e 100644 --- a/tools/grib_options.c +++ b/tools/grib_options.c @@ -131,7 +131,10 @@ void usage(void) grib_options_get_help(grib_options[i].id)); } } - printf("\n\n"); + printf("\n"); + if (tool_online_doc) + printf("SEE ALSO\n\t%s\n\n", tool_online_doc); + printf("\n"); exit(1); } diff --git a/tools/grib_set.c b/tools/grib_set.c index 149b9f2d1..e50585573 100644 --- a/tools/grib_set.c +++ b/tools/grib_set.c @@ -50,8 +50,9 @@ 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* tool_name = "grib_set"; -const char* tool_usage = "[options] grib_file grib_file ... output_grib_file"; +const char* tool_name = "grib_set"; +const char* tool_online_doc = "https://confluence.ecmwf.int/display/ECC/grib_set"; +const char* tool_usage = "[options] grib_file grib_file ... output_grib_file"; int grib_options_count = sizeof(grib_options) / sizeof(grib_option); diff --git a/tools/grib_to_netcdf.c b/tools/grib_to_netcdf.c index 491af6930..b88124dcc 100644 --- a/tools/grib_to_netcdf.c +++ b/tools/grib_to_netcdf.c @@ -33,6 +33,7 @@ const char* tool_description = "\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* tool_name = "grib_to_netcdf"; +const char* tool_online_doc = "https://confluence.ecmwf.int/display/ECC/grib_to_netcdf"; const char* tool_usage = "[options] -o output_file grib_file grib_file ... "; static char argvString[2048] = {0,}; diff --git a/tools/grib_tools.h b/tools/grib_tools.h index e877aa52c..08d9377a5 100644 --- a/tools/grib_tools.h +++ b/tools/grib_tools.h @@ -181,6 +181,7 @@ extern int grib_options_count; extern const char* tool_name; extern const char* tool_description; extern const char* tool_usage; +extern const char* tool_online_doc; /* Can be NULL */ extern FILE* dump_file; diff --git a/tools/gts_compare.c b/tools/gts_compare.c index 9064c51b6..de430d13e 100644 --- a/tools/gts_compare.c +++ b/tools/gts_compare.c @@ -41,6 +41,7 @@ const char* tool_description = "\n\tDefault behaviour: bit-by-bit compare, same order in files."; const char* tool_name = "gts_compare"; +const char* tool_online_doc = NULL; const char* tool_usage = "[options] " "file file"; diff --git a/tools/gts_copy.c b/tools/gts_copy.c index 2edc55bd5..eba1bc438 100644 --- a/tools/gts_copy.c +++ b/tools/gts_copy.c @@ -14,6 +14,7 @@ const char* tool_description = "Copies the content of GTS files printing" " values of some keys."; const char* tool_name = "gts_copy"; +const char* tool_online_doc = NULL; const char* tool_usage = "[options] file file ... output_file"; grib_option grib_options[] = { diff --git a/tools/gts_dump.c b/tools/gts_dump.c index 4eac49809..b33831ef0 100644 --- a/tools/gts_dump.c +++ b/tools/gts_dump.c @@ -35,6 +35,7 @@ grib_option grib_options[] = { const char* tool_description = "Dump the content of a GTS file in different formats."; const char* tool_name = "gts_dump"; +const char* tool_online_doc = NULL; const char* tool_usage = "[options] file file ..."; int grib_options_count = sizeof(grib_options) / sizeof(grib_option); diff --git a/tools/gts_filter.c b/tools/gts_filter.c index 8c5223e79..c57dc7dce 100644 --- a/tools/gts_filter.c +++ b/tools/gts_filter.c @@ -31,6 +31,7 @@ const char* tool_description = "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* tool_name = "gts_filter"; +const char* tool_online_doc = NULL; const char* tool_usage = "[options] rules_file " "file file ..."; diff --git a/tools/gts_get.c b/tools/gts_get.c index e7a1db6fd..39c1d2731 100644 --- a/tools/gts_get.c +++ b/tools/gts_get.c @@ -33,6 +33,7 @@ const char* tool_description = "\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* tool_name = "gts_get"; +const char* tool_online_doc = NULL; const char* tool_usage = "[options] file file ..."; int grib_options_count = sizeof(grib_options) / sizeof(grib_option); diff --git a/tools/gts_ls.c b/tools/gts_ls.c index c5ffba134..b6a8a6666 100644 --- a/tools/gts_ls.c +++ b/tools/gts_ls.c @@ -36,6 +36,7 @@ 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* tool_name = "gts_ls"; +const char* tool_online_doc = NULL; const char* tool_usage = "[options] file file ..."; int grib_options_count = sizeof(grib_options) / sizeof(grib_option); diff --git a/tools/metar_compare.c b/tools/metar_compare.c index 7ff472a54..96a9abf5b 100644 --- a/tools/metar_compare.c +++ b/tools/metar_compare.c @@ -44,6 +44,7 @@ const char* tool_description = "\n\tDefault behaviour: absolute error=0, bit-by-bit compare, same order in files."; const char* tool_name = "metar_compare"; +const char* tool_online_doc = NULL; const char* tool_usage = "[options] " "file file"; diff --git a/tools/metar_copy.c b/tools/metar_copy.c index a8bed2211..c9835eeb2 100644 --- a/tools/metar_copy.c +++ b/tools/metar_copy.c @@ -14,6 +14,7 @@ const char* tool_description = "Copies the content of METAR files printing" " values of some keys."; const char* tool_name = "metar_copy"; +const char* tool_online_doc = NULL; const char* tool_usage = "[options] file file ... output_file"; grib_option grib_options[] = { diff --git a/tools/metar_dump.c b/tools/metar_dump.c index 869159297..080ec8ea3 100644 --- a/tools/metar_dump.c +++ b/tools/metar_dump.c @@ -38,6 +38,7 @@ grib_option grib_options[] = { const char* tool_description = "Dump the content of a METAR file in different formats."; const char* tool_name = "metar_dump"; +const char* tool_online_doc = NULL; const char* tool_usage = "[options] file file ..."; int grib_options_count = sizeof(grib_options) / sizeof(grib_option); diff --git a/tools/metar_filter.c b/tools/metar_filter.c index bbf3306c0..e0e0fe131 100644 --- a/tools/metar_filter.c +++ b/tools/metar_filter.c @@ -28,6 +28,7 @@ const char* tool_description = "Apply the rules defined in rules_file to each METAR " "message\n\tin the files provided as arguments."; const char* tool_name = "metar_filter"; +const char* tool_online_doc = NULL; const char* tool_usage = "[options] rules_file " "file file ..."; diff --git a/tools/metar_get.c b/tools/metar_get.c index 2508034ba..122dbf92a 100644 --- a/tools/metar_get.c +++ b/tools/metar_get.c @@ -34,6 +34,7 @@ const char* tool_description = "\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* tool_name = "metar_get"; +const char* tool_online_doc = NULL; const char* tool_usage = "[options] file file ..."; int grib_options_count = sizeof(grib_options) / sizeof(grib_option); diff --git a/tools/metar_ls.c b/tools/metar_ls.c index 0ac5e8a51..ebb160c80 100644 --- a/tools/metar_ls.c +++ b/tools/metar_ls.c @@ -48,6 +48,7 @@ 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* tool_name = "metar_ls"; +const char* tool_online_doc = NULL; const char* tool_usage = "[options] file file ..."; int grib_options_count = sizeof(grib_options) / sizeof(grib_option); diff --git a/tools/taf_dump.c b/tools/taf_dump.c index 346a6b1cc..fa5636509 100644 --- a/tools/taf_dump.c +++ b/tools/taf_dump.c @@ -31,6 +31,7 @@ grib_option grib_options[] = { const char* tool_description = "Dump the content of a TAF file in different formats."; const char* tool_name = "taf_dump"; +const char* tool_online_doc = NULL; const char* tool_usage = "[options] file file ..."; int grib_options_count = sizeof(grib_options) / sizeof(grib_option); diff --git a/tools/taf_filter.c b/tools/taf_filter.c index 148d5b1c9..7851f1ca6 100644 --- a/tools/taf_filter.c +++ b/tools/taf_filter.c @@ -30,6 +30,7 @@ const char* tool_description = "Apply the rules defined in rules_file to each TAF " "message\n\tin the files provided as arguments."; const char* tool_name = "taf_filter"; +const char* tool_online_doc = NULL; const char* tool_usage = "[options] rules_file " "file file ..."; diff --git a/tools/taf_get.c b/tools/taf_get.c index de1c66078..9e873f957 100644 --- a/tools/taf_get.c +++ b/tools/taf_get.c @@ -38,6 +38,7 @@ const char* tool_description = "\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* tool_name = "taf_get"; +const char* tool_online_doc = NULL; const char* tool_usage = "[options] file file ..."; int grib_options_count = sizeof(grib_options) / sizeof(grib_option); diff --git a/tools/taf_ls.c b/tools/taf_ls.c index ad0a2ff92..1c1ad049d 100644 --- a/tools/taf_ls.c +++ b/tools/taf_ls.c @@ -41,6 +41,7 @@ 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* tool_name = "taf_ls"; +const char* tool_online_doc = NULL; const char* tool_usage = "[options] file file ..."; int grib_options_count = sizeof(grib_options) / sizeof(grib_option); From 6d6fae0c669bf12cc4e7cf6a12430c8de79a1bae Mon Sep 17 00:00:00 2001 From: Shahram Najm Date: Thu, 5 Jan 2023 14:08:21 +0000 Subject: [PATCH 02/17] ECC-1501: Adding missing local code for source/sink table 4.238 --- definitions/grib2/tables/local/ecmf/1/4.238.table | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 definitions/grib2/tables/local/ecmf/1/4.238.table diff --git a/definitions/grib2/tables/local/ecmf/1/4.238.table b/definitions/grib2/tables/local/ecmf/1/4.238.table new file mode 100644 index 000000000..36b20e9a2 --- /dev/null +++ b/definitions/grib2/tables/local/ecmf/1/4.238.table @@ -0,0 +1,5 @@ +# Code table 4.238 - Source or sink for ECMWF +192 192 Vegetation +193 193 Biomass burning +194 194 Settlements + From f529885d61051b79bda07b2c063332a0fb05e373 Mon Sep 17 00:00:00 2001 From: Shahram Najm Date: Thu, 5 Jan 2023 16:41:09 +0000 Subject: [PATCH 03/17] Improved error message --- src/action_class_set.c | 2 +- tests/bufr_ecc-1259.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/action_class_set.c b/src/action_class_set.c index 07d5bc431..8febce99d 100644 --- a/src/action_class_set.c +++ b/src/action_class_set.c @@ -110,7 +110,7 @@ static int execute(grib_action* a, grib_handle* h) if (self->nofail) return 0; if (ret != GRIB_SUCCESS) { - grib_context_log(h->context, GRIB_LOG_ERROR, "Error while setting key %s (%s)", + grib_context_log(h->context, GRIB_LOG_ERROR, "Error while setting key '%s' (%s)", self->name, grib_get_error_message(ret)); } return ret; diff --git a/tests/bufr_ecc-1259.sh b/tests/bufr_ecc-1259.sh index 5cca062ae..a65e65be5 100755 --- a/tests/bufr_ecc-1259.sh +++ b/tests/bufr_ecc-1259.sh @@ -34,7 +34,7 @@ EOF ${tools_dir}/bufr_filter -f $tempFilt $sample_bufr4 2>$tempOut # Check the right error message came out -grep -q "ECCODES ERROR.*Error while setting key pack (Encoding invalid)" $tempOut +grep -q "ECCODES ERROR.*Error while setting key 'pack' (Encoding invalid)" $tempOut # Now fix the order of keys and rerun From e874f7c9c74c39a7a14ba1e3bd1d496a63776675 Mon Sep 17 00:00:00 2001 From: Shahram Najm Date: Fri, 6 Jan 2023 11:52:00 +0000 Subject: [PATCH 04/17] ECC-1500: Tools: Print the online help page URL --- tools/grib_options.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/grib_options.c b/tools/grib_options.c index 9374f519e..84bc2a08d 100644 --- a/tools/grib_options.c +++ b/tools/grib_options.c @@ -133,7 +133,7 @@ void usage(void) } printf("\n"); if (tool_online_doc) - printf("SEE ALSO\n\t%s\n\n", tool_online_doc); + printf("SEE ALSO\n\tFull documentation and examples at:\n\t<%s>\n\n", tool_online_doc); printf("\n"); exit(1); } From 99ad2752655d438c091f85a79e29852c6ae88114 Mon Sep 17 00:00:00 2001 From: Shahram Najm Date: Fri, 6 Jan 2023 11:58:43 +0000 Subject: [PATCH 05/17] Testing --- tests/grib_ecc-1406.sh | 1 - tests/grib_ls.sh | 5 ++++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/grib_ecc-1406.sh b/tests/grib_ecc-1406.sh index ace8e0031..38d9d34c8 100755 --- a/tests/grib_ecc-1406.sh +++ b/tests/grib_ecc-1406.sh @@ -41,7 +41,6 @@ ${tools_dir}/grib_filter -o $tempGrib $tempFilt $sample2 ${tools_dir}/grib_ls -l 37.5,16.0,1 $tempGrib > $tempOut grep -q "Grid Point chosen #1 index=5016590" $tempOut -grep -q "grid_simple 42" $tempOut ${tools_dir}/grib_ls -j -l 37.5,16.0,1 $tempGrib > $tempOut grep -q 'latitude" : 37.5, "longitude" : 16, "distance" : 0,.*"value" : 42 ,' $tempOut diff --git a/tests/grib_ls.sh b/tests/grib_ls.sh index 1bb18ca3b..88036b633 100755 --- a/tests/grib_ls.sh +++ b/tests/grib_ls.sh @@ -21,10 +21,13 @@ infile=regular_gaussian_model_level.grib1 # Basic test of man page set +e -${tools_dir}/grib_ls > /dev/null +${tools_dir}/grib_ls > $tempLog status=$? set -e [ $status -eq 1 ] +grep -q "Full documentation and examples at" $tempLog +grep -q "https://confluence.ecmwf.int/display/ECC/grib_ls" $tempLog + ${tools_dir}/grib_ls -P count $infile > $tempLog ${tools_dir}/grib_ls -p count,step $infile >> $tempLog From f4cd4b274da9eea6440293830a38852950a3f66d Mon Sep 17 00:00:00 2001 From: Shahram Najm Date: Fri, 6 Jan 2023 12:03:59 +0000 Subject: [PATCH 06/17] Testing --- tests/grib_set_force.sh | 2 -- tests/wrap.sh | 3 --- 2 files changed, 5 deletions(-) diff --git a/tests/grib_set_force.sh b/tests/grib_set_force.sh index 9153eb86e..3fe85d458 100755 --- a/tests/grib_set_force.sh +++ b/tests/grib_set_force.sh @@ -10,8 +10,6 @@ . ./include.ctest.sh -REDIRECT=/dev/null - label="grib_set_force_test" tempInput=temp.$label.input.grib2 diff --git a/tests/wrap.sh b/tests/wrap.sh index 6f8caa1a6..9f9221e9c 100755 --- a/tests/wrap.sh +++ b/tests/wrap.sh @@ -16,14 +16,11 @@ tempOut=temp.${label}.out tempTxt=temp.${label}.txt tempRef=temp.${label}.ref -REDIRECT=/dev/null - input=$ECCODES_SAMPLES_PATH/wrap.tmpl ${tools_dir}/grib_dump -TA -O $input id=`${tools_dir}/grib_get -TA -p identifier $input` [ "$id" = "WRAP" ] - # Clean up rm -f $tempOut $tempRef $tempTxt From ff34d78837475de873ab1393bffbccbfdd5a0ff5 Mon Sep 17 00:00:00 2001 From: Shahram Najm Date: Fri, 6 Jan 2023 12:27:07 +0000 Subject: [PATCH 07/17] C++ compilation --- tests/CMakeLists.txt | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 86f450af7..8ac3058ec 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -49,6 +49,14 @@ list(APPEND test_c_bins grib_lam_bf grib_lam_gp) +if( HAVE_EXPERIMENTAL_BUILD_WITH_CXX ) + foreach( _bin ${test_c_bins} ) + SET( _src ${_bin}.c ) + set_source_files_properties( ${_src} PROPERTIES LANGUAGE CXX ) + endforeach() +endif() + + foreach( tool ${test_c_bins} ) # here we use the fact that each tool has only one C file that matches its name ecbuild_add_executable( TARGET ${tool} From cf5c9c04a5f9dae38869fa4c788fe9173bdb58af Mon Sep 17 00:00:00 2001 From: Shahram Najm Date: Fri, 6 Jan 2023 12:30:05 +0000 Subject: [PATCH 08/17] C++ compilation: warning re initialization of subobject --- tests/unit_tests.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/unit_tests.c b/tests/unit_tests.c index 5ff5352c4..7f910cd71 100644 --- a/tests/unit_tests.c +++ b/tests/unit_tests.c @@ -1607,9 +1607,9 @@ static void test_parse_keyval_string() int err = 0; int values_required = 1; int count = 0; - grib_values values1[128] = {0,}; - grib_values values2[128] = {0,}; - grib_values values3[128] = {0,}; + grib_values values1[128] = {{0},}; + grib_values values2[128] = {{0},}; + grib_values values3[128] = {{0},}; const int max_count = 128; char input1[] = "key1=value1,key2!=value2"; char input2[] = "x=14"; From 66f73fd6ff789283f4ba12396467892b9f1847bc Mon Sep 17 00:00:00 2001 From: Shahram Najm Date: Fri, 6 Jan 2023 13:02:12 +0000 Subject: [PATCH 09/17] Testing --- tests/grib_lam_bf.c | 2 +- tests/grib_lam_gp.c | 2 +- tests/grib_optimize_scaling.c | 2 +- tests/grib_optimize_scaling_sh.c | 2 +- tests/grib_sh_ieee64.c | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/grib_lam_bf.c b/tests/grib_lam_bf.c index 6771deedd..c7170a192 100644 --- a/tests/grib_lam_bf.c +++ b/tests/grib_lam_bf.c @@ -12,7 +12,7 @@ #include #include -#include "grib_api.h" +#include "grib_api_internal.h" /* * Test encoding of LAM spectral fields diff --git a/tests/grib_lam_gp.c b/tests/grib_lam_gp.c index 13825f9e1..38b2178ed 100644 --- a/tests/grib_lam_gp.c +++ b/tests/grib_lam_gp.c @@ -12,7 +12,7 @@ #include #include -#include "grib_api.h" +#include "grib_api_internal.h" /* * Test encoding of grid-point LAM fields diff --git a/tests/grib_optimize_scaling.c b/tests/grib_optimize_scaling.c index 192840e4c..fac0fdb62 100644 --- a/tests/grib_optimize_scaling.c +++ b/tests/grib_optimize_scaling.c @@ -8,7 +8,7 @@ * virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. */ -#include "grib_api.h" +#include "grib_api_internal.h" /* * Test the use of optimizeScaleFactor; on the following field, the packing error diff --git a/tests/grib_optimize_scaling_sh.c b/tests/grib_optimize_scaling_sh.c index 6cb1b3afd..053fcd1f3 100644 --- a/tests/grib_optimize_scaling_sh.c +++ b/tests/grib_optimize_scaling_sh.c @@ -8,7 +8,7 @@ * virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. */ -#include "grib_api.h" +#include "grib_api_internal.h" /* * Check that optimizeScaleFactor=1 reduces the error on spherical harmonics encoding. Check that sub-truncation is preserved in IEEE-32 precision. diff --git a/tests/grib_sh_ieee64.c b/tests/grib_sh_ieee64.c index e9f32e2ce..15209cdab 100644 --- a/tests/grib_sh_ieee64.c +++ b/tests/grib_sh_ieee64.c @@ -11,7 +11,7 @@ #include #include -#include "grib_api.h" +#include "grib_api_internal.h" /* * Check that encoding of sub-truncation using IEEE64 works. From 062c4fd31c82f9839e73cc34e1b45caada835515 Mon Sep 17 00:00:00 2001 From: Shahram Najm Date: Fri, 6 Jan 2023 14:57:30 +0000 Subject: [PATCH 10/17] Warnings: implicit conversion changes signedness --- src/grib_nearest.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/grib_nearest.c b/src/grib_nearest.c index a7ae6c7e6..ae07d598d 100644 --- a/src/grib_nearest.c +++ b/src/grib_nearest.c @@ -168,7 +168,7 @@ int grib_nearest_find_multiple( int ret = 0; long i = 0; size_t len = 4; - int flags = GRIB_NEAREST_SAME_GRID | GRIB_NEAREST_SAME_DATA; + const unsigned long flags = GRIB_NEAREST_SAME_GRID | GRIB_NEAREST_SAME_DATA; if (values) rvalues = qvalues; @@ -306,8 +306,8 @@ int grib_nearest_find_generic( double* outlats, double* outlons, double* values, double* distances, int* indexes, size_t* len) { - int ret = 0, i = 0; - size_t nvalues = 0, nneighbours = 0; + int ret = 0; + size_t i = 0, nvalues = 0, nneighbours = 0; double radiusInKm; grib_iterator* iter = NULL; double lat = 0, lon = 0; @@ -399,7 +399,7 @@ int grib_nearest_find_generic( /*printf("Candidate: lat=%.5f lon=%.5f dist=%f Idx=%ld Val=%f\n",lat,lon,dist,the_index,the_value);*/ /* store this candidate point */ neighbours[i].m_dist = dist; - neighbours[i].m_index = the_index; + neighbours[i].m_index = (int)the_index; neighbours[i].m_lat = lat; neighbours[i].m_lon = lon; neighbours[i].m_value = the_value; From c82373ee7c71361ce84fa185034b3f6620996d11 Mon Sep 17 00:00:00 2001 From: Shahram Najm Date: Fri, 6 Jan 2023 15:10:38 +0000 Subject: [PATCH 11/17] Warnings: implicit conversion loses integer precision --- src/grib_iterator_class_gaussian.c | 2 +- src/grib_iterator_class_gaussian_reduced.c | 2 +- src/grib_iterator_class_gen.c | 6 +++--- src/grib_iterator_class_lambert_azimuthal_equal_area.c | 2 +- src/grib_iterator_class_lambert_conformal.c | 2 +- src/grib_iterator_class_latlon.c | 2 +- src/grib_iterator_class_latlon_reduced.c | 2 +- src/grib_iterator_class_mercator.c | 2 +- src/grib_iterator_class_polar_stereographic.c | 2 +- src/grib_iterator_class_regular.c | 2 +- src/grib_iterator_class_space_view.c | 2 +- 11 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/grib_iterator_class_gaussian.c b/src/grib_iterator_class_gaussian.c index 9b1fb9722..11b9d6641 100644 --- a/src/grib_iterator_class_gaussian.c +++ b/src/grib_iterator_class_gaussian.c @@ -42,7 +42,7 @@ static int init (grib_iterator* i,grib_handle*,grib_arguments*); typedef struct grib_iterator_gaussian{ grib_iterator it; /* Members defined in gen */ - long carg; + int carg; const char* missingValue; /* Members defined in regular */ double *las; diff --git a/src/grib_iterator_class_gaussian_reduced.c b/src/grib_iterator_class_gaussian_reduced.c index ace37923c..fd934d686 100644 --- a/src/grib_iterator_class_gaussian_reduced.c +++ b/src/grib_iterator_class_gaussian_reduced.c @@ -52,7 +52,7 @@ static int destroy (grib_iterator* i); typedef struct grib_iterator_gaussian_reduced{ grib_iterator it; /* Members defined in gen */ - long carg; + int carg; const char* missingValue; /* Members defined in gaussian_reduced */ double *las; diff --git a/src/grib_iterator_class_gen.c b/src/grib_iterator_class_gen.c index eaba5a623..cea90181b 100644 --- a/src/grib_iterator_class_gen.c +++ b/src/grib_iterator_class_gen.c @@ -19,8 +19,8 @@ IMPLEMENTS = has_next IMPLEMENTS = init IMPLEMENTS = reset - MEMBERS = long carg - MEMBERS = const char* missingValue; + MEMBERS = int carg + MEMBERS = const char* missingValue; END_CLASS_DEF */ @@ -47,7 +47,7 @@ static long has_next (grib_iterator* i); typedef struct grib_iterator_gen{ grib_iterator it; /* Members defined in gen */ - long carg; + int carg; const char* missingValue; } grib_iterator_gen; diff --git a/src/grib_iterator_class_lambert_azimuthal_equal_area.c b/src/grib_iterator_class_lambert_azimuthal_equal_area.c index 8998e7017..5d54aee88 100644 --- a/src/grib_iterator_class_lambert_azimuthal_equal_area.c +++ b/src/grib_iterator_class_lambert_azimuthal_equal_area.c @@ -46,7 +46,7 @@ static int destroy (grib_iterator* i); typedef struct grib_iterator_lambert_azimuthal_equal_area{ grib_iterator it; /* Members defined in gen */ - long carg; + int carg; const char* missingValue; /* Members defined in lambert_azimuthal_equal_area */ double *lats; diff --git a/src/grib_iterator_class_lambert_conformal.c b/src/grib_iterator_class_lambert_conformal.c index 4fd681cdb..a39b314ab 100644 --- a/src/grib_iterator_class_lambert_conformal.c +++ b/src/grib_iterator_class_lambert_conformal.c @@ -46,7 +46,7 @@ static int destroy (grib_iterator* i); typedef struct grib_iterator_lambert_conformal{ grib_iterator it; /* Members defined in gen */ - long carg; + int carg; const char* missingValue; /* Members defined in lambert_conformal */ double *lats; diff --git a/src/grib_iterator_class_latlon.c b/src/grib_iterator_class_latlon.c index a3ea502b5..444aa594c 100644 --- a/src/grib_iterator_class_latlon.c +++ b/src/grib_iterator_class_latlon.c @@ -39,7 +39,7 @@ static int next (grib_iterator* i, double *lat, double *lon, double *val typedef struct grib_iterator_latlon{ grib_iterator it; /* Members defined in gen */ - long carg; + int carg; const char* missingValue; /* Members defined in regular */ double *las; diff --git a/src/grib_iterator_class_latlon_reduced.c b/src/grib_iterator_class_latlon_reduced.c index d6efd546b..03f0d5e04 100644 --- a/src/grib_iterator_class_latlon_reduced.c +++ b/src/grib_iterator_class_latlon_reduced.c @@ -51,7 +51,7 @@ static int destroy (grib_iterator* i); typedef struct grib_iterator_latlon_reduced{ grib_iterator it; /* Members defined in gen */ - long carg; + int carg; const char* missingValue; /* Members defined in latlon_reduced */ double *las; diff --git a/src/grib_iterator_class_mercator.c b/src/grib_iterator_class_mercator.c index 01cf6c925..1690792d6 100644 --- a/src/grib_iterator_class_mercator.c +++ b/src/grib_iterator_class_mercator.c @@ -46,7 +46,7 @@ static int destroy (grib_iterator* i); typedef struct grib_iterator_mercator{ grib_iterator it; /* Members defined in gen */ - long carg; + int carg; const char* missingValue; /* Members defined in mercator */ double *lats; diff --git a/src/grib_iterator_class_polar_stereographic.c b/src/grib_iterator_class_polar_stereographic.c index 542e9c155..0e3988030 100644 --- a/src/grib_iterator_class_polar_stereographic.c +++ b/src/grib_iterator_class_polar_stereographic.c @@ -46,7 +46,7 @@ static int destroy (grib_iterator* i); typedef struct grib_iterator_polar_stereographic{ grib_iterator it; /* Members defined in gen */ - long carg; + int carg; const char* missingValue; /* Members defined in polar_stereographic */ double *lats; diff --git a/src/grib_iterator_class_regular.c b/src/grib_iterator_class_regular.c index 499d16767..1078243c0 100644 --- a/src/grib_iterator_class_regular.c +++ b/src/grib_iterator_class_regular.c @@ -56,7 +56,7 @@ static int destroy (grib_iterator* i); typedef struct grib_iterator_regular{ grib_iterator it; /* Members defined in gen */ - long carg; + int carg; const char* missingValue; /* Members defined in regular */ double *las; diff --git a/src/grib_iterator_class_space_view.c b/src/grib_iterator_class_space_view.c index c42a2bbe1..355acfa13 100644 --- a/src/grib_iterator_class_space_view.c +++ b/src/grib_iterator_class_space_view.c @@ -46,7 +46,7 @@ static int destroy (grib_iterator* i); typedef struct grib_iterator_space_view{ grib_iterator it; /* Members defined in gen */ - long carg; + int carg; const char* missingValue; /* Members defined in space_view */ double *lats; From ab451310e5abcd49a8523ee8c1acbedfa7606525 Mon Sep 17 00:00:00 2001 From: Shahram Najm Date: Fri, 6 Jan 2023 16:41:34 +0000 Subject: [PATCH 12/17] Warnings: conversion --- src/grib_nearest_class.c | 2 +- src/grib_nearest_class_reduced.c | 3 ++- src/grib_nearest_class_sh.c | 6 +++--- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/grib_nearest_class.c b/src/grib_nearest_class.c index 2cd0937a0..edb4c74cc 100644 --- a/src/grib_nearest_class.c +++ b/src/grib_nearest_class.c @@ -33,7 +33,7 @@ static const struct table_entry table[] = { grib_nearest* grib_nearest_factory(grib_handle* h, grib_arguments* args) { - int i; + size_t i = 0; int ret = GRIB_SUCCESS; char* type = (char*)grib_arguments_get_name(h, args, 0); diff --git a/src/grib_nearest_class_reduced.c b/src/grib_nearest_class_reduced.c index 0b75b1167..084b63ab0 100644 --- a/src/grib_nearest_class_reduced.c +++ b/src/grib_nearest_class_reduced.c @@ -186,7 +186,8 @@ static int find_global(grib_nearest* nearest, grib_handle* h, double* distances, int* indexes, size_t* len) { grib_nearest_reduced* self = (grib_nearest_reduced*)nearest; - int ret = 0, kk = 0, ii = 0, jj = 0; + int ret = 0, kk = 0, ii = 0; + size_t jj = 0; long* pla = NULL; long* pl = NULL; size_t nvalues = 0; diff --git a/src/grib_nearest_class_sh.c b/src/grib_nearest_class_sh.c index e94e6244d..4cf28a474 100644 --- a/src/grib_nearest_class_sh.c +++ b/src/grib_nearest_class_sh.c @@ -100,7 +100,8 @@ static int find(grib_nearest* nearest, grib_handle* h, grib_nearest_sh* self = (grib_nearest_sh*)nearest; long J, K, M; double* values; - int size, i, ret; + int i, ret; + size_t size = 0; size_t vsize = 0; double val; @@ -116,8 +117,7 @@ static int find(grib_nearest* nearest, grib_handle* h, values = (double*)grib_context_malloc_clear(h->context, sizeof(double) * size); if (!values) { grib_context_log(h->context, GRIB_LOG_ERROR, - "nearest_sh: Error allocating %ld bytes", - sizeof(double) * size); + "nearest_sh: Error allocating %zu bytes", sizeof(double) * size); return GRIB_OUT_OF_MEMORY; } From fdb896edab409ff1d0db669de61ec5a37e9fb59d Mon Sep 17 00:00:00 2001 From: Shahram Najm Date: Fri, 6 Jan 2023 17:15:01 +0000 Subject: [PATCH 13/17] Testing: Fix working directory --- tests/grib2_version.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/grib2_version.sh b/tests/grib2_version.sh index 4f1661836..1f7cbe8b5 100755 --- a/tests/grib2_version.sh +++ b/tests/grib2_version.sh @@ -31,7 +31,7 @@ if [ "$latest" != "$highest_num" ]; then exit 1 fi - +cd $test_dir # Check table 1.0 # Check it has the latest with description matching "Version implemented on DD MM YYYY" tempText=temp.$label.txt From 0d7088b0961dcbe52daeed92fc6914bfca2d0e95 Mon Sep 17 00:00:00 2001 From: Shahram Najm Date: Fri, 6 Jan 2023 19:14:02 +0000 Subject: [PATCH 14/17] C++ compilation --- tools/CMakeLists.txt | 9 ++++++--- tools/grib2ppm.c | 5 ++--- tools/grib_to_netcdf.c | 10 +++++----- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt index 2a6bba7a7..5d97a110d 100644 --- a/tools/CMakeLists.txt +++ b/tools/CMakeLists.txt @@ -77,6 +77,12 @@ foreach( tool ${ecc_tools_binaries_extra} ) LIBS ecc_tools ) endforeach() +if( HAVE_EXPERIMENTAL_BUILD_WITH_CXX ) + set_source_files_properties(bufr_filter.c PROPERTIES LANGUAGE CXX) + set_source_files_properties(codes_count.c PROPERTIES LANGUAGE CXX) + set_source_files_properties(grib_to_netcdf.c PROPERTIES LANGUAGE CXX) +endif() + # grib_count/bufr_count etc. Same source code, different executable names ecbuild_add_executable( TARGET grib_count SOURCES codes_count.c @@ -100,9 +106,6 @@ ecbuild_add_executable( TARGET grib_list_keys CONDITION ECCODES_INSTALL_EXTRA_TOOLS LIBS ecc_tools ) -if( HAVE_EXPERIMENTAL_BUILD_WITH_CXX ) - set_source_files_properties(bufr_filter.c PROPERTIES LANGUAGE CXX) -endif() ecbuild_add_executable( TARGET codes_bufr_filter SOURCES bufr_filter.c LIBS ecc_tools ) diff --git a/tools/grib2ppm.c b/tools/grib2ppm.c index 0a20a72d4..cac306481 100644 --- a/tools/grib2ppm.c +++ b/tools/grib2ppm.c @@ -8,8 +8,7 @@ * virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. */ -#include "grib_api.h" -#include +#include "grib_api_internal.h" #define CMAP_MAX 20480 @@ -186,7 +185,7 @@ int main(int argc, char* argv[]) for (jj = 0; jj < height; jj++) { for (i = 0; i < width; i++) { int m = (i + width / 2) % width + jj * width; - assert(k < count); + Assert(k < count); indices[k++] = m; } } diff --git a/tools/grib_to_netcdf.c b/tools/grib_to_netcdf.c index b88124dcc..053d86dec 100644 --- a/tools/grib_to_netcdf.c +++ b/tools/grib_to_netcdf.c @@ -2945,10 +2945,10 @@ static int define_netcdf_dimensions(hypercube* h, fieldset* fs, int ncid, datase for (i = 0; i < naxis; ++i) { int nctype = NC_INT; const char* axis = get_axis(h, i); - char* units = NULL; + const char* units = NULL; char u[10240]; const char* lowaxis = (axis); - char* longname = (char*)lowaxis; + const char* longname = (char*)lowaxis; n = count_values(cube, axis); if (count_values(data_r, "levtype") > 1) { @@ -3049,7 +3049,7 @@ static int define_netcdf_dimensions(hypercube* h, fieldset* fs, int ncid, datase const char* cal = "gregorian"; if (setup.mmeans) { - char* period = "0000-01-00 00:00:00"; + const char* period = "0000-01-00 00:00:00"; stat = nc_put_att_text(ncid, var_id, "avg_period", strlen(period), period); check_err("nc_put_att_text", stat, __LINE__); } @@ -3179,7 +3179,7 @@ static int define_netcdf_dimensions(hypercube* h, fieldset* fs, int ncid, datase char timestamp[80]; time_t now; /* char *convention = "MARS;CF"; */ - char* convention = "CF-1.6"; + const char* convention = "CF-1.6"; char history[10240]; /* char *institution = "ECMWF Meteorological Archival and Retrieval System"; */ @@ -3936,7 +3936,7 @@ static int deflate_option = 0; /* Table of formats for legal -k values. Inspired by nccopy */ struct KindValue { - char* name; + const char* name; int kind; } legalkinds[] = { { "1", NC_FORMAT_CLASSIC }, From 4f9a51de1c8ebe5c69fd2d4f61c4f3d7a563b7dd Mon Sep 17 00:00:00 2001 From: Shahram Najm Date: Fri, 6 Jan 2023 19:52:58 +0000 Subject: [PATCH 15/17] AppVeyor: Fix broken Windows build --- tools/grib_to_netcdf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/grib_to_netcdf.c b/tools/grib_to_netcdf.c index 053d86dec..c09ca3427 100644 --- a/tools/grib_to_netcdf.c +++ b/tools/grib_to_netcdf.c @@ -1842,7 +1842,7 @@ typedef struct ncatt nc_type nctype; } ncatt_t; -typedef struct filter +typedef struct filter_type { fieldset* fset; hypercube* filter; From bed7e91e6ba20c2262d6cda31f8d2a1d4e5f90c3 Mon Sep 17 00:00:00 2001 From: Shahram Najm Date: Fri, 6 Jan 2023 20:25:57 +0000 Subject: [PATCH 16/17] C++ compilation --- tools/bufr_index_build.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/bufr_index_build.c b/tools/bufr_index_build.c index 973f89d82..03db9b6e9 100644 --- a/tools/bufr_index_build.c +++ b/tools/bufr_index_build.c @@ -22,8 +22,8 @@ const char* tool_name = "bufr_index_build"; const char* tool_online_doc = NULL; const char* tool_usage = "[options] file file ... "; grib_index* idx = NULL; -char* keys; -char* default_keys = "mars"; +const char* keys; +const char* default_keys = "mars"; grib_option grib_options[] = { /* {id, args, help}, on, command_line, value */ From 7468e8b15f66fd340ece373a9bacf6802a5ddd46 Mon Sep 17 00:00:00 2001 From: Shahram Najm Date: Fri, 6 Jan 2023 20:33:42 +0000 Subject: [PATCH 17/17] C++ compilation --- tools/grib_get_data.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/grib_get_data.c b/tools/grib_get_data.c index 76d2ac0f6..689d66c54 100644 --- a/tools/grib_get_data.c +++ b/tools/grib_get_data.c @@ -159,8 +159,8 @@ int grib_tool_new_handle_action(grib_runtime_options* options, grib_handle* h) num_bytes = (numberOfPoints + 1) * sizeof(double); data_values = (double*)calloc(numberOfPoints + 1, sizeof(double)); if (!data_values) { - fprintf(stderr, "ERROR: Failed to allocate %ld bytes for data values (number of points=%ld)\n", - (long)num_bytes, numberOfPoints); + fprintf(stderr, "ERROR: Failed to allocate %zu bytes for data values (number of points=%ld)\n", + num_bytes, numberOfPoints); exit(GRIB_OUT_OF_MEMORY); } @@ -183,7 +183,7 @@ int grib_tool_new_handle_action(grib_runtime_options* options, grib_handle* h) } if (size != (size_t)numberOfPoints) { if (!grib_options_on("q")) - fprintf(stderr, "ERROR: Wrong number of points %d\n", (int)numberOfPoints); + fprintf(stderr, "ERROR: Wrong number of points %ld\n", numberOfPoints); if (grib_options_on("f")) exit(1); }