mirror of https://github.com/ecmwf/eccodes.git
Fix compiler warnings (using INTEL)
This commit is contained in:
parent
7fe6a2490d
commit
dee9bd014b
|
@ -21,102 +21,102 @@
|
|||
|
||||
#include "grib_api.h"
|
||||
|
||||
void usage(char* prog) {
|
||||
printf("usage: %s filename\n",prog);
|
||||
exit(1);
|
||||
static void usage(char* prog) {
|
||||
printf("usage: %s filename\n",prog);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
int err = 0;
|
||||
int err = 0;
|
||||
|
||||
size_t i = 0;
|
||||
int nmsg = 0;
|
||||
size_t i = 0;
|
||||
int nmsg = 0;
|
||||
|
||||
double latitudeOfFirstGridPointInDegrees;
|
||||
double longitudeOfFirstGridPointInDegrees;
|
||||
double latitudeOfLastGridPointInDegrees;
|
||||
double longitudeOfLastGridPointInDegrees;
|
||||
double latitudeOfFirstGridPointInDegrees;
|
||||
double longitudeOfFirstGridPointInDegrees;
|
||||
double latitudeOfLastGridPointInDegrees;
|
||||
double longitudeOfLastGridPointInDegrees;
|
||||
|
||||
double jDirectionIncrementInDegrees;
|
||||
double iDirectionIncrementInDegrees;
|
||||
double jDirectionIncrementInDegrees;
|
||||
double iDirectionIncrementInDegrees;
|
||||
|
||||
long numberOfPointsAlongAParallel;
|
||||
long numberOfPointsAlongAMeridian;
|
||||
long numberOfPointsAlongAParallel;
|
||||
long numberOfPointsAlongAMeridian;
|
||||
|
||||
size_t values_len= 0;
|
||||
double average;
|
||||
double min;
|
||||
double max;
|
||||
size_t values_len= 0;
|
||||
double average;
|
||||
double min;
|
||||
double max;
|
||||
|
||||
FILE* in = NULL;
|
||||
char* filename;
|
||||
grib_handle *h = NULL;
|
||||
FILE* in = NULL;
|
||||
char* filename;
|
||||
grib_handle *h = NULL;
|
||||
|
||||
if (argc<2) usage(argv[0]);
|
||||
filename=argv[1];
|
||||
if (argc<2) usage(argv[0]);
|
||||
filename=argv[1];
|
||||
|
||||
in = fopen(filename,"r");
|
||||
if(!in) {
|
||||
printf("ERROR: unable to open file %s\n",filename);
|
||||
return 1;
|
||||
}
|
||||
in = fopen(filename,"r");
|
||||
if(!in) {
|
||||
printf("ERROR: unable to open file %s\n",filename);
|
||||
return 1;
|
||||
}
|
||||
|
||||
while((h = grib_handle_new_from_file(0,in,&err)) != NULL) {
|
||||
while((h = grib_handle_new_from_file(0,in,&err)) != NULL) {
|
||||
|
||||
GRIB_CHECK(err,0);
|
||||
GRIB_CHECK(err,0);
|
||||
|
||||
nmsg++;
|
||||
printf("processing message number %d\n",nmsg);
|
||||
nmsg++;
|
||||
printf("processing message number %d\n",nmsg);
|
||||
|
||||
/* get as a long*/
|
||||
GRIB_CHECK(grib_get_long(h,"Ni",&numberOfPointsAlongAParallel),0);
|
||||
printf("Ni=%ld\n",numberOfPointsAlongAParallel);
|
||||
/* get as a long*/
|
||||
GRIB_CHECK(grib_get_long(h,"Ni",&numberOfPointsAlongAParallel),0);
|
||||
printf("Ni=%ld\n",numberOfPointsAlongAParallel);
|
||||
|
||||
/* get as a long*/
|
||||
GRIB_CHECK(grib_get_long(h,"Nj",&numberOfPointsAlongAMeridian),0);
|
||||
printf("Nj=%ld\n",numberOfPointsAlongAMeridian);
|
||||
/* get as a long*/
|
||||
GRIB_CHECK(grib_get_long(h,"Nj",&numberOfPointsAlongAMeridian),0);
|
||||
printf("Nj=%ld\n",numberOfPointsAlongAMeridian);
|
||||
|
||||
/* get as a double*/
|
||||
GRIB_CHECK(grib_get_double(h,"latitudeOfFirstGridPointInDegrees",&latitudeOfFirstGridPointInDegrees),0);
|
||||
printf("latitudeOfFirstGridPointInDegrees=%g\n",latitudeOfFirstGridPointInDegrees);
|
||||
/* get as a double*/
|
||||
GRIB_CHECK(grib_get_double(h,"latitudeOfFirstGridPointInDegrees",&latitudeOfFirstGridPointInDegrees),0);
|
||||
printf("latitudeOfFirstGridPointInDegrees=%g\n",latitudeOfFirstGridPointInDegrees);
|
||||
|
||||
/* get as a double*/
|
||||
GRIB_CHECK(grib_get_double(h,"longitudeOfFirstGridPointInDegrees",&longitudeOfFirstGridPointInDegrees),0);
|
||||
printf("longitudeOfFirstGridPointInDegrees=%g\n",longitudeOfFirstGridPointInDegrees);
|
||||
/* get as a double*/
|
||||
GRIB_CHECK(grib_get_double(h,"longitudeOfFirstGridPointInDegrees",&longitudeOfFirstGridPointInDegrees),0);
|
||||
printf("longitudeOfFirstGridPointInDegrees=%g\n",longitudeOfFirstGridPointInDegrees);
|
||||
|
||||
/* get as a double*/
|
||||
GRIB_CHECK(grib_get_double(h,"latitudeOfLastGridPointInDegrees",&latitudeOfLastGridPointInDegrees),0);
|
||||
printf("latitudeOfLastGridPointInDegrees=%g\n",latitudeOfLastGridPointInDegrees);
|
||||
/* get as a double*/
|
||||
GRIB_CHECK(grib_get_double(h,"latitudeOfLastGridPointInDegrees",&latitudeOfLastGridPointInDegrees),0);
|
||||
printf("latitudeOfLastGridPointInDegrees=%g\n",latitudeOfLastGridPointInDegrees);
|
||||
|
||||
/* get as a double*/
|
||||
GRIB_CHECK(grib_get_double(h,"longitudeOfLastGridPointInDegrees",&longitudeOfLastGridPointInDegrees),0);
|
||||
printf("longitudeOfLastGridPointInDegrees=%g\n",longitudeOfLastGridPointInDegrees);
|
||||
/* get as a double*/
|
||||
GRIB_CHECK(grib_get_double(h,"longitudeOfLastGridPointInDegrees",&longitudeOfLastGridPointInDegrees),0);
|
||||
printf("longitudeOfLastGridPointInDegrees=%g\n",longitudeOfLastGridPointInDegrees);
|
||||
|
||||
/* get as a double*/
|
||||
GRIB_CHECK(grib_get_double(h,"jDirectionIncrementInDegrees",&jDirectionIncrementInDegrees),0);
|
||||
printf("jDirectionIncrementInDegrees=%g\n",jDirectionIncrementInDegrees);
|
||||
/* get as a double*/
|
||||
GRIB_CHECK(grib_get_double(h,"jDirectionIncrementInDegrees",&jDirectionIncrementInDegrees),0);
|
||||
printf("jDirectionIncrementInDegrees=%g\n",jDirectionIncrementInDegrees);
|
||||
|
||||
/* get as a double*/
|
||||
GRIB_CHECK(grib_get_double(h,"iDirectionIncrementInDegrees",&iDirectionIncrementInDegrees),0);
|
||||
printf("iDirectionIncrementInDegrees=%g\n",iDirectionIncrementInDegrees);
|
||||
/* get as a double*/
|
||||
GRIB_CHECK(grib_get_double(h,"iDirectionIncrementInDegrees",&iDirectionIncrementInDegrees),0);
|
||||
printf("iDirectionIncrementInDegrees=%g\n",iDirectionIncrementInDegrees);
|
||||
|
||||
/* get as a double*/
|
||||
GRIB_CHECK(grib_get_double(h,"average",&average),0);
|
||||
GRIB_CHECK(grib_get_double(h,"min",&min),0);
|
||||
GRIB_CHECK(grib_get_double(h,"max",&max),0);
|
||||
/* get as a double*/
|
||||
GRIB_CHECK(grib_get_double(h,"average",&average),0);
|
||||
GRIB_CHECK(grib_get_double(h,"min",&min),0);
|
||||
GRIB_CHECK(grib_get_double(h,"max",&max),0);
|
||||
|
||||
/* get the size of the values array*/
|
||||
GRIB_CHECK(grib_get_size(h,"values",&values_len),0);
|
||||
/* get the size of the values array*/
|
||||
GRIB_CHECK(grib_get_size(h,"values",&values_len),0);
|
||||
|
||||
printf("There are %d, average is %g, min is %g, max is %g\n",(int)values_len,average,min,max);
|
||||
printf("There are %d, average is %g, min is %g, max is %g\n",(int)values_len,average,min,max);
|
||||
|
||||
for (i=0;i<100;i++) printf("-");
|
||||
printf("\n");
|
||||
for (i=0;i<100;i++) printf("-");
|
||||
printf("\n");
|
||||
|
||||
grib_handle_delete(h);
|
||||
grib_handle_delete(h);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
fclose(in);
|
||||
return 0;
|
||||
fclose(in);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
#include "grib_api.h"
|
||||
|
||||
void usage(char* prog) {
|
||||
static void usage(const char* prog) {
|
||||
printf("Usage: %s grib_file\n",prog);
|
||||
exit(1);
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
|
||||
#include "grib_api.h"
|
||||
|
||||
void usage(char* prog) {
|
||||
static void usage(char* prog) {
|
||||
printf("usage: %s filename\n",prog);
|
||||
exit(1);
|
||||
}
|
||||
|
|
|
@ -171,12 +171,12 @@ grib_action* grib_action_create_concept( grib_context* context,
|
|||
|
||||
a->concept = concept;
|
||||
if (concept) {
|
||||
grib_concept_value* c=concept;
|
||||
grib_concept_value* conc_val=concept;
|
||||
grib_trie* index=grib_trie_new(context);
|
||||
while (c) {
|
||||
c->index=index;
|
||||
grib_trie_insert_no_replace(index,c->name,c);
|
||||
c=c->next;
|
||||
while (conc_val) {
|
||||
conc_val->index=index;
|
||||
grib_trie_insert_no_replace(index,conc_val->name,conc_val);
|
||||
conc_val=conc_val->next;
|
||||
}
|
||||
}
|
||||
act->name = grib_context_strdup_persistent(context,name);
|
||||
|
|
|
@ -396,8 +396,6 @@ static int unpack_long(grib_accessor* a, long* val, size_t *len)
|
|||
} else {
|
||||
return unpack_multiple_time_ranges(a,val,len);
|
||||
}
|
||||
|
||||
return GRIB_SUCCESS;
|
||||
}
|
||||
|
||||
#if 0
|
||||
|
|
|
@ -205,7 +205,6 @@ static int unpack_long(grib_accessor* a, long* val, size_t *len)
|
|||
long hours = 0, minutes=0, step_mins=0, tmp, tmp_hrs, tmp_mins;
|
||||
|
||||
if (self->hours) {
|
||||
long hours,minutes;
|
||||
if ((ret=grib_get_long_internal(grib_handle_of_accessor(a), self->hours,&hours))!=GRIB_SUCCESS) return ret;
|
||||
if ((ret=grib_get_long_internal(grib_handle_of_accessor(a), self->minutes,&minutes))!=GRIB_SUCCESS) return ret;
|
||||
*val=hours*100+minutes;
|
||||
|
|
|
@ -10,13 +10,10 @@
|
|||
|
||||
|
||||
/*
|
||||
|
||||
Author: B.Raoult
|
||||
Modified by Enrico Fucile
|
||||
|
||||
*/
|
||||
|
||||
|
||||
#include "grib_api_internal.h"
|
||||
#include <math.h>
|
||||
#include <errno.h>
|
||||
|
@ -127,7 +124,6 @@ typedef int err;
|
|||
typedef real (*fop1)(real);
|
||||
typedef real (*fop2)(real,real);
|
||||
|
||||
|
||||
static void advance(char** form)
|
||||
{
|
||||
(*form)++;
|
||||
|
@ -156,6 +152,7 @@ static grib_math *readatom(grib_context* c,char** form,int *err)
|
|||
p = (grib_math*)grib_context_malloc(c,sizeof(grib_math));
|
||||
p->arity = 1;
|
||||
p->name = strdup("neg");
|
||||
Assert(p->name);
|
||||
advance(form);
|
||||
p->left = readatom(c,form,err);
|
||||
break;
|
||||
|
@ -164,6 +161,7 @@ static grib_math *readatom(grib_context* c,char** form,int *err)
|
|||
p = (grib_math*)grib_context_malloc(c,sizeof(grib_math));
|
||||
p->arity = 1;
|
||||
p->name = strdup("neg");
|
||||
Assert(p->name);
|
||||
advance(form);
|
||||
p->left = readatom(c,form,err);
|
||||
break;
|
||||
|
@ -180,8 +178,8 @@ static grib_math *readatom(grib_context* c,char** form,int *err)
|
|||
|
||||
if(**form == '\'' || **form == '"')
|
||||
{
|
||||
char c = *((*form)++);
|
||||
while(**form && **form != c)
|
||||
char achar = *((*form)++);
|
||||
while(**form && **form != achar)
|
||||
buf[i++] = *((*form)++);
|
||||
if(**form) (*form)++;
|
||||
} else
|
||||
|
@ -194,6 +192,7 @@ static grib_math *readatom(grib_context* c,char** form,int *err)
|
|||
|
||||
p = (grib_math*)grib_context_malloc(c,sizeof(grib_math));
|
||||
p->name = strdup(buf);
|
||||
Assert(p->name);
|
||||
p->left=0;
|
||||
|
||||
switch(**form)
|
||||
|
@ -427,6 +426,7 @@ grib_math *grib_math_clone(grib_context* c,grib_math *m)
|
|||
n = (grib_math*)grib_context_malloc(c,sizeof(grib_math));
|
||||
n->arity = m->arity;
|
||||
n->name = strdup(m->name);
|
||||
Assert(n->name);
|
||||
n->left = grib_math_clone(c,m->left);
|
||||
n->right = grib_math_clone(c,m->right);
|
||||
}
|
||||
|
@ -455,6 +455,7 @@ grib_math *grib_math_new(grib_context* c,const char* formula,int *err)
|
|||
if (!formula) {*err=GRIB_INVALID_ARGUMENT;return NULL;}
|
||||
|
||||
f=strdup(formula);
|
||||
Assert(f);
|
||||
fsave=f;
|
||||
|
||||
x = reador(c,&f,err);
|
||||
|
|
|
@ -802,7 +802,6 @@ grib_index* grib_index_read(grib_context* c, const char* filename, int *err)
|
|||
|
||||
fh=fopen(filename,"r");
|
||||
if (!fh) {
|
||||
grib_context* c = grib_context_get_default();
|
||||
grib_context_log(c,(GRIB_LOG_ERROR)|(GRIB_LOG_PERROR),
|
||||
"Unable to write in file %s",filename);
|
||||
perror(filename);
|
||||
|
|
|
@ -96,7 +96,7 @@ const char* bad = NULL;
|
|||
FILE* fgood = NULL;
|
||||
FILE* fbad = NULL;
|
||||
|
||||
void check(const char* name,int a)
|
||||
static void check(const char* name,int a)
|
||||
{
|
||||
if(!a) {
|
||||
printf("%s, field %d [%s]: %s failed\n",file,field,param,name);
|
||||
|
@ -104,15 +104,17 @@ void check(const char* name,int a)
|
|||
}
|
||||
}
|
||||
|
||||
void warn(const char* name,int a)
|
||||
/*
|
||||
static void warn(const char* name,int a)
|
||||
{
|
||||
if(!a) {
|
||||
printf("%s, field %d [%s]: %s failed\n",file,field,param,name);
|
||||
warning++;
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
void save(grib_handle* h, const char *name,FILE* f)
|
||||
static void save(grib_handle* h, const char *name,FILE* f)
|
||||
{
|
||||
size_t size;
|
||||
const void *buffer;
|
||||
|
@ -133,7 +135,7 @@ void save(grib_handle* h, const char *name,FILE* f)
|
|||
}
|
||||
}
|
||||
|
||||
long get(grib_handle *h,const char* what)
|
||||
static long get(grib_handle *h,const char* what)
|
||||
{
|
||||
int e; long val;
|
||||
if((e = grib_get_long(h,what,&val)) != GRIB_SUCCESS)
|
||||
|
@ -145,7 +147,7 @@ long get(grib_handle *h,const char* what)
|
|||
return val;
|
||||
}
|
||||
|
||||
double dget(grib_handle *h,const char* what)
|
||||
static double dget(grib_handle *h,const char* what)
|
||||
{
|
||||
int e; double val;
|
||||
if((e = grib_get_double(h,what,&val)) != GRIB_SUCCESS)
|
||||
|
@ -157,28 +159,28 @@ double dget(grib_handle *h,const char* what)
|
|||
return val;
|
||||
}
|
||||
|
||||
int missing(grib_handle *h,const char* what)
|
||||
static int missing(grib_handle *h,const char* what)
|
||||
{
|
||||
int err=0;
|
||||
return grib_is_missing(h,what,&err);
|
||||
}
|
||||
|
||||
int eq(grib_handle *h,const char* what,long value)
|
||||
static int eq(grib_handle *h,const char* what,long value)
|
||||
{
|
||||
return get(h,what) == value;
|
||||
}
|
||||
|
||||
int ne(grib_handle *h,const char* what,long value)
|
||||
static int ne(grib_handle *h,const char* what,long value)
|
||||
{
|
||||
return get(h,what) != value;
|
||||
}
|
||||
|
||||
int ge(grib_handle *h,const char* what,long value)
|
||||
static int ge(grib_handle *h,const char* what,long value)
|
||||
{
|
||||
return get(h,what) >= value;
|
||||
}
|
||||
|
||||
int le(grib_handle *h,const char* what,long value)
|
||||
static int le(grib_handle *h,const char* what,long value)
|
||||
{
|
||||
return get(h,what) <= value;
|
||||
}
|
||||
|
@ -188,7 +190,7 @@ static int DBL_EQUAL(double d1, double d2, double tolerance)
|
|||
return fabs(d1-d2) <= tolerance;
|
||||
}
|
||||
|
||||
void gaussian_grid(grib_handle* h)
|
||||
static void gaussian_grid(grib_handle* h)
|
||||
{
|
||||
const double tolerance = 1.0/1000000.0; /* angular tolerance for grib2: micro degrees */
|
||||
long n = get(h,"numberOfParallelsBetweenAPoleAndTheEquator"); /* This is the key N */
|
||||
|
@ -249,8 +251,8 @@ void gaussian_grid(grib_handle* h)
|
|||
else
|
||||
{
|
||||
/* REGULAR gaussian grid */
|
||||
long west = get(h,"longitudeOfFirstGridPoint");
|
||||
long east = get(h,"longitudeOfLastGridPoint");
|
||||
long l_west = get(h,"longitudeOfFirstGridPoint");
|
||||
long l_east = get(h,"longitudeOfLastGridPoint");
|
||||
long parallel = get(h,"numberOfPointsAlongAParallel");
|
||||
long we = get(h,"iDirectionIncrement");
|
||||
double dwest = dget(h,"longitudeOfFirstGridPointInDegrees");
|
||||
|
@ -258,7 +260,7 @@ void gaussian_grid(grib_handle* h)
|
|||
double dwe = dget(h,"iDirectionIncrementInDegrees");
|
||||
/*printf("parallel=%ld east=%ld west=%ld we=%ld\n",parallel,east,west,we);*/
|
||||
|
||||
CHECK(parallel == (east-west)/we + 1);
|
||||
CHECK(parallel == (l_east-l_west)/we + 1);
|
||||
CHECK(fabs((deast-dwest)/dwe + 1 - parallel) < 1e-10);
|
||||
CHECK(!get(h,"PLPresent"));
|
||||
}
|
||||
|
@ -267,15 +269,15 @@ void gaussian_grid(grib_handle* h)
|
|||
|
||||
if(get(h,"PLPresent")) {
|
||||
size_t count, i, nPl;
|
||||
int e = grib_get_size(h,"pl",&count);
|
||||
int err_code = grib_get_size(h,"pl",&count);
|
||||
double *pl;
|
||||
double expected_lon2 = 0;
|
||||
long total, max_pl = 0;
|
||||
long numberOfValues = get(h,"numberOfValues");
|
||||
long numberOfDataPoints = get(h,"numberOfDataPoints");
|
||||
|
||||
if(e) {
|
||||
printf("%s, field %d [%s]: cannot number of pl: %s\n",file,field,param,grib_get_error_message(e));
|
||||
if(err_code) {
|
||||
printf("%s, field %d [%s]: cannot number of pl: %s\n",file,field,param,grib_get_error_message(err_code));
|
||||
error++;
|
||||
return;
|
||||
}
|
||||
|
@ -284,9 +286,9 @@ void gaussian_grid(grib_handle* h)
|
|||
CHECK(pl != NULL);
|
||||
|
||||
nPl = count;
|
||||
if((e = grib_get_double_array(h,"pl",pl,&count)))
|
||||
if((err_code = grib_get_double_array(h,"pl",pl,&count)))
|
||||
{
|
||||
printf("%s, field %d [%s]: cannot get pl: %s\n",file,field,param,grib_get_error_message(e));
|
||||
printf("%s, field %d [%s]: cannot get pl: %s\n",file,field,param,grib_get_error_message(err_code));
|
||||
free(pl);
|
||||
error++;
|
||||
return;
|
||||
|
@ -711,7 +713,7 @@ static void given_thickness(grib_handle* h,const parameter* p,double min,double
|
|||
CHECK(!missing(h,"scaledValueOfSecondFixedSurface"));
|
||||
}
|
||||
|
||||
void latlon_grid(grib_handle* h)
|
||||
static void latlon_grid(grib_handle* h)
|
||||
{
|
||||
const double tolerance = 1.0/1000000.0; /* angular tolerance for grib2: micro degrees */
|
||||
long data_points = get(h,"numberOfDataPoints");
|
||||
|
@ -824,7 +826,7 @@ void latlon_grid(grib_handle* h)
|
|||
|
||||
#define X(x) printf("%s=%ld ",#x,get(h,#x))
|
||||
|
||||
void check_parameter(grib_handle* h,double min,double max)
|
||||
static void check_parameter(grib_handle* h,double min,double max)
|
||||
{
|
||||
int err;
|
||||
int best = -1;
|
||||
|
@ -920,7 +922,7 @@ void check_parameter(grib_handle* h,double min,double max)
|
|||
}
|
||||
}
|
||||
|
||||
void verify(grib_handle* h)
|
||||
static void verify(grib_handle* h)
|
||||
{
|
||||
double min = 0,max = 0;
|
||||
|
||||
|
@ -1093,7 +1095,7 @@ void verify(grib_handle* h)
|
|||
|
||||
}
|
||||
|
||||
void validate(const char* path)
|
||||
static void validate(const char* path)
|
||||
{
|
||||
FILE *f = fopen(path,"r");
|
||||
grib_handle *h = 0;
|
||||
|
@ -1142,7 +1144,7 @@ void validate(const char* path)
|
|||
}
|
||||
}
|
||||
|
||||
void scan(const char* name)
|
||||
static void scan(const char* name)
|
||||
{
|
||||
DIR *dir;
|
||||
if((dir = opendir(name)) != NULL)
|
||||
|
@ -1162,7 +1164,7 @@ void scan(const char* name)
|
|||
validate(name);
|
||||
}
|
||||
|
||||
void usage()
|
||||
static void usage()
|
||||
{
|
||||
printf("tigge_check [options] grib_file grib_file ...\n");
|
||||
printf(" -l: check local area model fields\n");
|
||||
|
@ -1176,7 +1178,7 @@ void usage()
|
|||
exit(1);
|
||||
}
|
||||
|
||||
int main(int argc,const char** argv)
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
int i;
|
||||
int err = 0;
|
||||
|
|
|
@ -40,7 +40,7 @@ const char* param = "unknown";
|
|||
int print_names = 0;
|
||||
int unique = 0;
|
||||
|
||||
void check(const char* name,int a)
|
||||
static void check(const char* name,int a)
|
||||
{
|
||||
if(!a) {
|
||||
fprintf(stderr,"%s, field %d [%s]: %s failed\n",file,field,param,name);
|
||||
|
@ -48,10 +48,7 @@ void check(const char* name,int a)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
long get(grib_handle *h,const char* what)
|
||||
static long get(grib_handle *h,const char* what)
|
||||
{
|
||||
int e; long val;
|
||||
if((e = grib_get_long(h,what,&val)) != GRIB_SUCCESS)
|
||||
|
@ -63,7 +60,7 @@ long get(grib_handle *h,const char* what)
|
|||
return val;
|
||||
}
|
||||
|
||||
char* sget(grib_handle *h,const char* what,char* val,size_t size)
|
||||
static char* sget(grib_handle *h,const char* what,char* val,size_t size)
|
||||
{
|
||||
int e;
|
||||
if((e = grib_get_string(h,what,val,&size)) != GRIB_SUCCESS)
|
||||
|
@ -74,8 +71,8 @@ char* sget(grib_handle *h,const char* what,char* val,size_t size)
|
|||
return val;
|
||||
}
|
||||
|
||||
|
||||
double dget(grib_handle *h,const char* what)
|
||||
/*
|
||||
static double dget(grib_handle *h,const char* what)
|
||||
{
|
||||
int e; double val;
|
||||
if((e = grib_get_double(h,what,&val)) != GRIB_SUCCESS)
|
||||
|
@ -87,32 +84,29 @@ double dget(grib_handle *h,const char* what)
|
|||
return val;
|
||||
}
|
||||
|
||||
int missing(grib_handle *h,const char* what)
|
||||
static int missing(grib_handle *h,const char* what)
|
||||
{
|
||||
int err=0;
|
||||
return grib_is_missing(h,what,&err);
|
||||
}
|
||||
|
||||
int eq(grib_handle *h,const char* what,long value)
|
||||
static int eq(grib_handle *h,const char* what,long value)
|
||||
{
|
||||
return get(h,what) == value;
|
||||
}
|
||||
|
||||
int ne(grib_handle *h,const char* what,long value)
|
||||
static int ne(grib_handle *h,const char* what,long value)
|
||||
{
|
||||
return get(h,what) != value;
|
||||
}
|
||||
|
||||
int ge(grib_handle *h,const char* what,long value)
|
||||
static int ge(grib_handle *h,const char* what,long value)
|
||||
{
|
||||
return get(h,what) >= value;
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
*/
|
||||
|
||||
void split(grib_handle *h)
|
||||
static void split(grib_handle *h)
|
||||
{
|
||||
char wmo_name[1024];
|
||||
char origin[80];
|
||||
|
@ -177,12 +171,9 @@ void split(grib_handle *h)
|
|||
}
|
||||
|
||||
if(fclose(f)) { perror(wmo_name); exit(1); }
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
void validate(const char* path)
|
||||
static void validate(const char* path)
|
||||
{
|
||||
FILE *f = fopen(path,"r");
|
||||
grib_handle *h = 0;
|
||||
|
@ -213,10 +204,9 @@ void validate(const char* path)
|
|||
fprintf(stderr,"%s does not contain any GRIBs\n",path);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void usage()
|
||||
static void usage()
|
||||
{
|
||||
printf("tigge_split [-p] files ....\n");
|
||||
printf(" -p: print names of files created\n");
|
||||
|
|
|
@ -101,7 +101,6 @@ static int blacklisted(const char* name)
|
|||
static double relative_error(double a,double b,double err)
|
||||
{
|
||||
double relativeError;
|
||||
double maxAbsoluteError = 1e-19;
|
||||
|
||||
if(fabs(a) <= maxAbsoluteError || fabs(b) <= maxAbsoluteError)
|
||||
relativeError = fabs(a-b);
|
||||
|
@ -1041,7 +1040,7 @@ static int compare_handles(grib_handle* h1,grib_handle* h2,grib_runtime_options*
|
|||
if (options->compare[i].type == GRIB_NAMESPACE) {
|
||||
iter=grib_keys_iterator_new(h1, 0, options->compare[i].name);
|
||||
if (!iter) {
|
||||
printf("ERROR: unable to get iterator\n");
|
||||
printf("ERROR: unable to get keys iterator\n");
|
||||
exit(1);
|
||||
}
|
||||
while(grib_keys_iterator_next(iter))
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
#include "grib_api_internal.h"
|
||||
|
||||
void usage(char* prog)
|
||||
static void usage(const char* prog)
|
||||
{
|
||||
printf("usage: %s infile1 infile2 ... \n",prog);
|
||||
exit(1);
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
#include "grib_api.h"
|
||||
|
||||
void usage(const char *prog)
|
||||
static void usage(const char *prog)
|
||||
{
|
||||
fprintf(stderr,"%s: in1 [in2 ... ] out\n",prog);
|
||||
exit(1);
|
||||
|
|
|
@ -47,7 +47,7 @@ static int scan(grib_context* c,grib_runtime_options* options,const char* dir);
|
|||
|
||||
FILE* dump_file;
|
||||
|
||||
grib_runtime_options options={
|
||||
grib_runtime_options global_options={
|
||||
0, /* verbose */
|
||||
0, /* fail */
|
||||
0, /* skip */
|
||||
|
@ -143,7 +143,7 @@ int grib_tool(int argc, char **argv)
|
|||
{
|
||||
int ret=0;
|
||||
grib_context* c=grib_context_get_default();
|
||||
options.context=c;
|
||||
global_options.context=c;
|
||||
|
||||
#ifdef ENABLE_FLOATING_POINT_EXCEPTIONS
|
||||
feenableexcept(FE_ALL_EXCEPT & ~FE_INEXACT);
|
||||
|
@ -151,39 +151,39 @@ int grib_tool(int argc, char **argv)
|
|||
|
||||
if (getenv("DOXYGEN_USAGE") && argc==1 ) usage_doxygen();
|
||||
|
||||
grib_get_runtime_options(argc,argv,&options);
|
||||
grib_get_runtime_options(argc,argv,&global_options);
|
||||
|
||||
grib_tool_before_getopt(&options);
|
||||
grib_tool_before_getopt(&global_options);
|
||||
|
||||
grib_process_runtime_options(c,argc,argv,&options);
|
||||
grib_process_runtime_options(c,argc,argv,&global_options);
|
||||
|
||||
grib_tool_init(&options);
|
||||
if (options.dump_filename) {
|
||||
dump_file= fopen(options.dump_filename,"w");
|
||||
grib_tool_init(&global_options);
|
||||
if (global_options.dump_filename) {
|
||||
dump_file= fopen(global_options.dump_filename,"w");
|
||||
if(!dump_file) {
|
||||
perror(options.dump_filename);
|
||||
perror(global_options.dump_filename);
|
||||
exit(1);
|
||||
}
|
||||
} else {
|
||||
dump_file=stdout;
|
||||
}
|
||||
|
||||
if (is_index_file(options.infile->name) &&
|
||||
( options.infile_extra && is_index_file(options.infile_extra->name))) {
|
||||
options.through_index=1;
|
||||
return grib_tool_index(&options);
|
||||
if (is_index_file(global_options.infile->name) &&
|
||||
( global_options.infile_extra && is_index_file(global_options.infile_extra->name))) {
|
||||
global_options.through_index=1;
|
||||
return grib_tool_index(&global_options);
|
||||
}
|
||||
|
||||
if (options.onlyfiles)
|
||||
ret=grib_tool_onlyfiles(&options);
|
||||
if (global_options.onlyfiles)
|
||||
ret=grib_tool_onlyfiles(&global_options);
|
||||
else {
|
||||
if (options.orderby)
|
||||
ret=grib_tool_with_orderby(&options);
|
||||
if (global_options.orderby)
|
||||
ret=grib_tool_with_orderby(&global_options);
|
||||
else
|
||||
ret=grib_tool_without_orderby(&options);
|
||||
ret=grib_tool_without_orderby(&global_options);
|
||||
}
|
||||
|
||||
if (options.dump_filename) fclose(dump_file);
|
||||
if (global_options.dump_filename) fclose(dump_file);
|
||||
return ret;
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue