00001
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #include <stdio.h>
00024 #include <stdlib.h>
00025
00026 #include "grib_api.h"
00027
00028 int main(int argc, char** argv) {
00029 int err = 0;
00030 long parameterCategory=0,parameterNumber=0,discipline=0;
00031 FILE* in = NULL;
00032 char* filename = "../../data/multi.grib2";
00033 grib_handle *h = NULL;
00034
00035
00036 grib_multi_support_on(0);
00037
00038
00039
00040
00041 in = fopen(filename,"r");
00042 if(!in) {
00043 printf("ERROR: unable to open file %s\n",filename);
00044 return 1;
00045 }
00046
00047
00048 while ((h = grib_handle_new_from_file(0,in,&err)) != NULL ) {
00049
00050 GRIB_CHECK(err,0);
00051
00052 GRIB_CHECK(grib_get_long(h,"discipline",&discipline),0);
00053 printf("discipline=%ld\n",discipline);
00054
00055 GRIB_CHECK(grib_get_long(h,"parameterCategory",¶meterCategory),0);
00056 printf("parameterCategory=%ld\n",parameterCategory);
00057
00058 GRIB_CHECK(grib_get_long(h,"parameterNumber",¶meterNumber),0);
00059 printf("parameterNumber=%ld\n",parameterNumber);
00060
00061 if ( discipline == 0 && parameterCategory==2) {
00062 if (parameterNumber == 2) printf("-------- u -------\n");
00063 if (parameterNumber == 3) printf("-------- v -------\n");
00064 }
00065 }
00066
00067 grib_handle_delete(h);
00068
00069 fclose(in);
00070 return 0;
00071 }