90 struct tm current, start;
98 printf(
"\n begin stats_init");
104 strftime(buff_temp,
sizeof(buff_temp),
105 "/stats.%m%d.000000",
107 sprintf(buffer,
"%s%s",logname,buff_temp);
113 if ( stat(buffer, &
buf) != -1 )
116 if ( (
fp_postlog = fopen(buffer,
"r+w+")) == NULL )
118 fprintf(stdout,
"shef_decode:error on opening stats file->%s",
131 if ( (
fp_postlog = fopen(buffer,
"wr")) == NULL )
137 fprintf(stdout,
"shef_decode:error on opening stats file->%s",
160 char *
ts[40], *tsname[40];
164 char *tsname_default =
"UNKNWN";
167 struct tm current, start;
169 ts[0] =
"RM"; tsname[0] =
"SNOTEL";
170 ts[1] =
"RG"; tsname[1] =
"S.DOM";
171 ts[2] =
"RF"; tsname[2] =
"R.DOM";
172 ts[3] =
"RH"; tsname[3] =
"HADS";
173 ts[4] =
"RO"; tsname[4] =
"ASOS";
174 ts[5] =
"RV"; tsname[5] =
"MTR";
175 ts[6] =
"R4"; tsname[6] =
"ROSA";
176 ts[7] =
"RR"; tsname[7] =
"ALERT#1";
177 ts[8] =
"RP"; tsname[8] =
"LARCS";
178 ts[9] =
"R1"; tsname[9] =
"RR #";
179 ts[10]=
"FZ"; tsname[10]=
"FUTURE";
180 ts[11]=
"RZ"; tsname[11]=
"DEFAULT";
181 ts[12]=
"1M"; tsname[12]=
"P1SNOW";
182 ts[13]=
"2M"; tsname[13]=
"P2SNOW";
183 ts[14]=
"3M"; tsname[14]=
"P3SNOW";
184 ts[15]=
"1G"; tsname[15]=
"P1GOES";
185 ts[16]=
"2G"; tsname[16]=
"P2GOES";
186 ts[17]=
"3G"; tsname[17]=
"P3GOES";
187 ts[18]=
"FA"; tsname[18]=
"F ADDJ1";
188 ts[19]=
"FU"; tsname[19]=
"F UADJ1";
189 ts[20]=
"FE"; tsname[20]=
"F PUBL";
190 ts[21]=
"FW"; tsname[21]=
"F UADJ3";
191 ts[22]=
"RS"; tsname[22]=
"ALERT#2";
192 ts[23]=
"1Z"; tsname[23]=
"1DEFALT";
193 ts[24]=
"1P"; tsname[24]=
"lLARC";
194 ts[25]=
"1R"; tsname[25]=
"1ALERT";
195 ts[26]=
"PE"; tsname[26]=
"HIS SIM";
196 ts[27]=
"HE"; tsname[27]=
"HIS OBS";
197 ts[28]=
"FU"; tsname[28]=
"CON SIM";
221 strftime(buff_temp,
sizeof(buff_temp),
224 "\n LOG_START_TIME-------------> %s (%ld)",
229 strftime(buff_temp,
sizeof(buff_temp),
"%H:%M %D",
232 "\n LOG_START_TIME-------------> %s (%ld)",
235 strftime(buff_temp,
sizeof(buff_temp),
"%H:%M %D",
261 while (
ts[
k] != NULL )
342 fprintf(stdout,
"\n stats_updates:begin");
344 "\n kodp = %c kode = %c kodd = %c kodt = %c kods = %c", kodp,kode,kodd,kodt,kods);
401 strncpy(buff_ts,
"RZ",
sizeof(buff_ts));
427 char *c, *str1, *str2;
438 while ( fgets(buffer,
sizeof(buffer),
fp_postlog) != NULL )
441 if ( strstr(buffer,
"START_") != NULL )
443 if ( (c = strchr(buffer,
'(')) != NULL )
451 if ( strstr(buffer,
"#PROD") != NULL )
453 if ( fgets(buffer,
sizeof(buffer),
fp_postlog) == NULL )
457 sscanf(buffer,
"%ld %ld %ld %ld",
464 if ( strstr(buffer,
"#INSER") != NULL )
466 if ( fgets(buffer,
sizeof(buffer),
fp_postlog) == NULL )
470 sscanf(buffer,
"%ld %ld",
475 if ( strstr(buffer,
"PE ") != NULL )
483 str1=strtok(str2,
" \t\n\r");
492 memset(buffer,0,
sizeof(buffer));
501 str1 = strtok(str2,
" \t\n\r");
515 fprintf(stdout,
"\n stats_ts:begin");
516 fprintf(stdout,
"\n t = %c s = %c q = %c",*t,*s,*lwal);
535 if ( *t ==
'R' && *s ==
'G' )
637 if ( (c = strchr(
pets_.
pe,10)) != NULL )
639 if ( (c = strchr(
pets_.
ts,10)) != NULL )
647 else if ( flag == 2 )
673 else if ( flag == 3 )
sprintf(fbuf,"/usr/mapper/nexrad/ngrid.%02d-%02d-%02d-%02d", year, month, day, hour)
printf("fbuf is %s\n", fbuf)
fprintf(fp,"%d %d %d %d 1\n", iminx, iminy, maxi, maxj)
#define MAX_ACCEPTABLE_CATEGORIES
#define MAX_ACCEPTABLE_TS
#define MAX_ACCEPTABLE_PE
void stats_ts(char *t, char *s, char *lwal)
int stats_updates(char kodp, char kode, char kodd, char kodt, char kods)
void stats_init(char *logname)
strpat(char buffer[], char token[], int numtemp, int chartemp)
char ts[MAX_BUFF_CFG_LINE]
char pe[MAX_BUFF_CFG_LINE]
int parse_stats[MAX_ACCEPTABLE_CATEGORIES+1]
int post_stats[MAX_ACCEPTABLE_PE+1][MAX_ACCEPTABLE_TS+1]
char acceptable_ts[MAX_ACCEPTABLE_TS+1][TS_SIZE]
char ts_post_time[MAX_ACCEPTABLE_TS+1][8]
char acceptable_pe[MAX_ACCEPTABLE_PE+1][PE_SIZE]