/* ** Do not change these include commands. ** All necessary header files are included in "geminc.h". ** All macros and constants are in "gemprm.h" and "bridge.h". */ #include "geminc.h" #include "gemprm.h" #include "bridge.h" #include #include "decod_ut.h" /* contains prototype for ut_prvs */ #include "dccmn.h" /* contains prototype for dc_wclg */ main ( argc, argv ) int argc; char *argv[]; /************************************************************************ * DCGFFD * * * * This program decodes bulletins containing IGDR BUFR messages * * into NCEP BUFR format. * * * * Command line: * * dcgffd [options] [bufrta] [bufrtn] [bufrfn] * * * * bufrta = GFO FD BUFR tables file * * bufrtn = NCEP BUFR tables file * * bufrfn = GFO FD input data file * * * ** * * Log: * * C. Caruso Magee/NCEP 06/06 * * S. Guan/NCEP 01/09 Add circflg to dc_gopt call sequence * * M. Weiss/NCEP 02/19 Modified for DELL conversion. * * M. Weiss/NCEP 09/21 WCOSS2 install: #include "decod_ut.h" * * "dccmn.h" and void gf_dcod. * ***********************************************************************/ { #define NUMEXP 4 int nexp = NUMEXP; char *prgnam = "DCGFFD"; /* ** Define the standard decoder parameters. */ char stntbl[DCMXLN], stntb2[DCMXLN]; char prmfil[DCMXLN]; int iadstn; int maxtim; int nhours; int txtflg; int iwndht; int circflg; /* ** Define default values for the standard decoder parameters. */ char *defprm = " "; char *defstn = " "; char *dfstn2 = " "; int idfadd = 0; int idfmax = 0; int ndfhr1 = 240; int ndfhr2 = 240; int idfwdh = 0; /* ** Define the additional decoder parameters. */ const char *dvstr = DVSTR; /* DVSTR is a compile-time macro */ char bufrta[DCMXLN]; char bufrtn[DCMXLN]; char bufrfn[DCMXLN]; char message[80]; struct stat mybuffer; int filesize; /* ** Do not change these variables. These variables are used by all ** decoders for getting the command line parameters. */ char parms[NUMEXP][DCMXLN]; char curtim[DCMXLN]; int num; int iret; int ier; /*---------------------------------------------------------------------*/ /* ** Initialize the output logs, set the time out, and ** parse the command line parameters. */ dc_init ( prgnam, argc, argv, nexp, parms, &num, &iret ); /* ** Check for an initialization error. */ if ( iret < 0 ) { dc_exit ( &iret ); } /* ** Set each standard decoder parameter to the value from the ** command line options (if defined) or else to the default ** value. */ dc_gopt ( defprm, defstn, dfstn2, idfadd, idfmax, ndfhr1, ndfhr2, idfwdh, prmfil, stntbl, stntb2, &iadstn, &maxtim, curtim, &nhours, &txtflg, &circflg, &iwndht, &iret ); /* ** Set default values for the additional decoder parameters. */ strcpy ( bufrta, "bufrtab.GFO_FD" ); strcpy ( bufrtn, "bufrtab.031" ); strcpy ( bufrfn, "gfo.dat" ); /* ** Now, for each additional decoder parameter, if a value was ** defined on the command line, then use that value instead of ** the default value. */ if ( num > 0 ) { strcpy ( bufrta, parms[0] ); } if ( num > 1 ) { strcpy ( bufrtn, parms[1] ); } if ( num > 2 ) { strcpy ( bufrfn, parms[2] ); } iret = stat(bufrfn, &mybuffer); if (iret != 0) dc_exit ( &iret ); filesize = mybuffer.st_size; if ( filesize > 600000) { sprintf(message, "The size of file: %s is %d \n", bufrfn, filesize); dc_wclg ( 0, "DC", 2, message, &ier ); sprintf(message, "Which is greater than 600000, skip this file!!! \n"); dc_wclg ( 0, "DC", 2, message, &ier ); dc_exit ( &iret ); } /* ** Call the decoding routine. ** ** Change this function call and define command for the ** specific decoder. */ #ifdef UNDERSCORE #define gf_dcod gf_dcod_ #endif void gf_dcod ( char *, char *, char *, char *, int *, int *, size_t, size_t, size_t, size_t ); ut_prvs ( dvstr, strlen(dvstr) ); gf_dcod ( curtim, bufrta, bufrtn, bufrfn, &nhours, &iret, strlen(curtim), strlen(bufrta), strlen(bufrtn), strlen(bufrfn) ); /* ** Send shut down message and close the log files. */ dc_exit ( &iret ); }