#include "dcshef.h" main ( argc, argv ) int argc; char *argv[]; /************************************************************************ * DCSHEF * * * * This program decodes SHEF bulletins into BUFR format. * * * * Command line: * * dcshef [options] [shefpm] [sheftb] * * [bufrt000] [bufrt001] [bufrt255] [pecodes] * * * * shefpm = SHEFPARM parameter file * * sheftb = SHEF station table * * bufrt000 = BUFR tables file for type 000 * * bufrt001 = BUFR tables file for type 001 * * bufrt255 = BUFR tables file for type 255 * * pecodes = string of concatenated two-character PE codes * * for which to additionally create ASCII text * * output, and where a "." as the second * * character of a PE code matches any single * * character * * * ** * * Log: * * J. Ator/NCEP 04/05 * * C. Caruso Magee/NCEP 02/06 Added new args to calling sequence of * * dc_gopt * * J. Ator/NCEP 10/06 Added pecodes argument * * J. Ator/NCEP 01/09 Add circflg to dc_gopt call sequence * * J. Ator/NCEP 12/09 Add input of multiple BUFR tables * * J. Ator/NCEP 01/19 Modify for Dell environment * * J. Ator/NCEP 09/21 Modify for WCOSS2 environment * ***********************************************************************/ { #define NUMEXP 5 int nexp = NUMEXP; char *prgnam = "DCSHEF"; /* ** 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 = 120; int ndfhr2 = 240; int idfwdh = 0; /* ** Define the additional decoder parameters. */ const char *dvstr = DVSTR; /* DVSTR is a compile-time macro */ char shefpm[DCMXLN]; char sheftb[DCMXLN]; char bufrt000[DCMXLN]; char bufrt001[DCMXLN]; char bufrt255[DCMXLN]; char pestr[DCMXLN]; size_t lpestr; int npe; char *pemsg = "Length of PE codes string not divisible by 2"; /* ** 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 ( shefpm, "SHEFPARM" ); strcpy ( sheftb, "shef.tbl" ); strcpy ( bufrt000, "bufrtab.000" ); strcpy ( bufrt001, "bufrtab.001" ); strcpy ( bufrt255, "bufrtab.255" ); /* ** 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 ( shefpm, parms[0] ); } if ( num > 1 ) { strcpy ( sheftb, parms[1] ); } if ( num > 2 ) { strcpy ( bufrt000, parms[2] ); } if ( num > 3 ) { strcpy ( bufrt001, parms[3] ); } if ( num > 4 ) { strcpy ( bufrt255, parms[4] ); } /* ** Check whether any pecodes were defined on the command line. */ if ( num > NUMEXP ) { strcpy( pestr, argv[argc-1] ); lpestr = strlen( pestr ); if ( G_NINT( fmod( (double) lpestr, (double) 2 ) != 0 ) ) { dc_wclg( 2, "DC", 2, pemsg, &ier); dc_exit( &iret ); } } else { pestr[0] = '\0'; lpestr = 0; } npe = lpestr / 2; /* ** Call the decoding routine. ** ** Change this function call and define command for the ** specific decoder. */ ut_prvs ( dvstr, strlen(dvstr) ); sf_dcod ( curtim, shefpm, sheftb, bufrt000, bufrt001, bufrt255, pestr, &npe, &nhours, &iret, strlen(curtim), strlen(shefpm), strlen(sheftb), strlen(bufrt000), strlen(bufrt001), strlen(bufrt255), lpestr ); /* ** Send shut down message and close the log files. */ dc_exit ( &iret ); }