ECC-923: Fix other tools too

This commit is contained in:
Shahram Najm 2019-05-10 14:11:01 +01:00
parent 5e0f600e0b
commit 7ec6123455
3 changed files with 30 additions and 28 deletions

View File

@ -422,7 +422,7 @@ static void print_index_key_values(grib_index* index,int icounter,const char* er
printf("\n");
}
static grib_handle* grib_handle_new_from_file_x(
static grib_handle* bufr_handle_new_from_file_x(
grib_context* c,FILE* f,int mode,int headers_only,int *err)
{
return codes_handle_new_from_file(c,f,PRODUCT_BUFR,err);
@ -478,7 +478,7 @@ int grib_tool_new_handle_action(grib_runtime_options* options, grib_handle* h)
} else if (options->random)
global_handle = grib_fieldset_next_handle(options->idx,&err);
else
global_handle=grib_handle_new_from_file_x(h->context,options->infile_extra->file,options->mode,0,&err);
global_handle=bufr_handle_new_from_file_x(h->context,options->infile_extra->file,options->mode,0,&err);
if (!global_handle || err!= GRIB_SUCCESS ) {
morein2++;
@ -517,7 +517,7 @@ int grib_tool_skip_handle(grib_runtime_options* options, grib_handle* h)
{
int err=0;
if (!options->through_index && !options->random) {
global_handle=grib_handle_new_from_file(h->context,options->infile_extra->file,&err);
global_handle=codes_bufr_handle_new_from_file(h->context,options->infile_extra->file,&err);
if (!global_handle || err!= GRIB_SUCCESS)
morein2++;
@ -541,17 +541,19 @@ int grib_tool_finalise_action(grib_runtime_options* options)
grib_error* e = error_summary;
int err=0;
grib_context* c=grib_context_get_default();
error += morein1+morein2;
/*if (grib_options_on("w:")) return 0;*/
if (error) {
printf("\n## ERRORS SUMMARY #######\n");
}
while ((global_handle=grib_handle_new_from_file(c,options->infile_extra->file,&err))) {
while ((global_handle=codes_bufr_handle_new_from_file(c,options->infile_extra->file,&err))) {
morein1++;
if (global_handle) grib_handle_delete(global_handle);
}
error += morein1+morein2;
if (error) {
printf("\n## ERRORS SUMMARY #######\n");
}
if (morein1>0) {
printf("##\n## Different number of messages \n");
printf("## %d more messages in %s than in %s\n",morein1,

View File

@ -274,7 +274,7 @@ static void print_index_key_values(grib_index* index,int cnt,const char* error_m
printf("\n");
}
static grib_handle* grib_handle_new_from_file_x(
static grib_handle* gts_handle_new_from_file_x(
grib_context* c,FILE* f,int mode,int headers_only,int *err)
{
return codes_handle_new_from_file(c,f,PRODUCT_GTS,err);
@ -330,7 +330,7 @@ int grib_tool_new_handle_action(grib_runtime_options* options, grib_handle* h)
} else if (options->random)
global_handle = grib_fieldset_next_handle(options->idx,&err);
else
global_handle=grib_handle_new_from_file_x(h->context,options->infile_extra->file,options->mode,0,&err);
global_handle=gts_handle_new_from_file_x(h->context,options->infile_extra->file,options->mode,0,&err);
if (!global_handle || err!= GRIB_SUCCESS ) {
morein2++;
@ -352,7 +352,7 @@ int grib_tool_skip_handle(grib_runtime_options* options, grib_handle* h)
{
int err=0;
if (!options->through_index && !options->random) {
global_handle=grib_handle_new_from_file(h->context,options->infile_extra->file,&err);
global_handle=gts_new_from_file(h->context,options->infile_extra->file,&err);
if (!global_handle || err!= GRIB_SUCCESS)
morein2++;
@ -376,17 +376,17 @@ int grib_tool_finalise_action(grib_runtime_options* options)
grib_error* e=error_summary;
int err=0;
grib_context* c=grib_context_get_default();
error+=morein1+morein2;
/*if (grib_options_on("w:")) return 0;*/
if (error) {
printf("\n## ERRORS SUMMARY #######\n");
}
while ((global_handle=grib_handle_new_from_file(c,options->infile_extra->file,&err))) {
while ((global_handle=gts_new_from_file(c,options->infile_extra->file,&err))) {
morein1++;
if (global_handle) grib_handle_delete(global_handle);
}
error+=morein1+morein2;
if (error) {
printf("\n## ERRORS SUMMARY #######\n");
}
if (morein1>0) {
printf("##\n## Different number of messages \n");
printf("## %d more messages in %s than in %s\n",morein1,

View File

@ -360,7 +360,7 @@ static void print_index_key_values(grib_index* index,int counter,const char* err
printf("\n");
}
static grib_handle* grib_handle_new_from_file_x(
static grib_handle* metar_handle_new_from_file_x(
grib_context* c,FILE* f,int mode,int headers_only,int *err)
{
return codes_handle_new_from_file(c,f,PRODUCT_METAR,err);
@ -416,7 +416,7 @@ int grib_tool_new_handle_action(grib_runtime_options* options, grib_handle* h)
} else if (options->random)
global_handle = grib_fieldset_next_handle(options->idx,&err);
else
global_handle=grib_handle_new_from_file_x(h->context,options->infile_extra->file,options->mode,0,&err);
global_handle=metar_handle_new_from_file_x(h->context,options->infile_extra->file,options->mode,0,&err);
if (!global_handle || err!= GRIB_SUCCESS ) {
morein2++;
@ -438,7 +438,7 @@ int grib_tool_skip_handle(grib_runtime_options* options, grib_handle* h)
{
int err=0;
if (!options->through_index && !options->random) {
global_handle=grib_handle_new_from_file(h->context,options->infile_extra->file,&err);
global_handle=metar_new_from_file(h->context,options->infile_extra->file,&err);
if (!global_handle || err!= GRIB_SUCCESS)
morein2++;
@ -462,17 +462,17 @@ int grib_tool_finalise_action(grib_runtime_options* options)
grib_error* e=error_summary;
int err=0;
grib_context* c=grib_context_get_default();
error+=morein1+morein2;
/*if (grib_options_on("w:")) return 0;*/
if (error) {
printf("\n## ERRORS SUMMARY #######\n");
}
while ((global_handle=grib_handle_new_from_file(c,options->infile_extra->file,&err))) {
while ((global_handle=metar_new_from_file(c,options->infile_extra->file,&err))) {
morein1++;
if (global_handle) grib_handle_delete(global_handle);
}
error+=morein1+morein2;
if (error) {
printf("\n## ERRORS SUMMARY #######\n");
}
if (morein1>0) {
printf("##\n## Different number of messages \n");
printf("## %d more messages in %s than in %s\n",morein1,