39 while ((c = getopt(argc, argv,
"vo:")) != -1)
47 if (!(fileout = malloc(
sizeof(
char) * strlen(optarg) + 1)))
49 strcpy(fileout, optarg);
53 fprintf(stderr,
"Unknown option `-%c'.\n", optopt);
55 fprintf(stderr,
"Unknown option character `\\x%x'.\n", optopt);
63 for (index = optind; index < argc; index++)
67 if (!(filein = malloc(
sizeof(
char) * strlen(argv[index]) + 1)))
69 strcpy(filein, argv[index]);
73 if (!(fileidx = malloc(
sizeof(
char) * strlen(argv[index]) + 1)))
75 strcpy(fileidx, argv[index]);
91 printf(
"g2c_degrib2 %s summarizing %s into %s.\n",
G2C_VERSION, filein, fileout);
96 fprintf(stderr,
"Could not read file %s.\n", filein);
103 printf(
"g2c_degrib2 %s summarizing %s, with index %s into %s.\n",
G2C_VERSION,
104 filein, fileidx, fileout);
109 fprintf(stderr,
"Could not read file %s with index %s.\n", filein, fileidx);
115 printf(
"One or two filenames must be provided, for input and (optionally) index.\n");
122 fprintf(stderr,
"Could not write degrib2 summary to %s.\n", fileout);
129 fprintf(stderr,
"Error closing the file.\n");
int main(int argc, char **argv)
Compare two GRIB2 files.
int g2c_degrib2(int g2cid, const char *fileout)
Write a summary file like the degrib2 utility.
int g2c_open(const char *path, int mode, int *g2cid)
Open an existing GRIB2 file.
int g2c_close(int g2cid)
Close a GRIB2 file, freeing resources.
int g2c_open_index(const char *data_file, const char *index_file, int mode, int *g2cid)
Open a GRIB2 file with the help of an index file.
Header file for NCEPLIBS-g2c library.
#define G2C_ENOMEM
Out of memory.
#define G2C_ERROR
General error code, returned for some test errors.
#define G2C_VERSION
Current version of NCEPLIBS-g2c library.
#define G2C_NOWRITE
Set read-only access for g2c_open().
int g2c_set_log_level(int new_level)
Use this to set the global log level.