Mapper
calculate_NEXRAD.c
Go to the documentation of this file.
1 
2 #include "prototypes.h"
3 
4 void calculate_NEXRAD(int inex,int time_step)
5 
6 {
7 
8 extern struct nexrad *nexrad[240];
9 extern struct nexrad nexrad_final;
10 int i,j,k,kk;
11 double pw,tpw;
12 
13 if(time_step==1) {
14 
15  memcpy(&nexrad_final,nexrad[inex],sizeof(struct nexrad));
16  return;
17 
18  }
19 
20 strcpy(nexrad_final.date,nexrad[inex]->date);
21 strcat(nexrad_final.date," thru ");
22 strcat(nexrad_final.date,nexrad[inex+time_step]->date);
23 
24 for(i=0;i<131;i++) {
25 for(j=0;j<131;j++) {
26 
27  nexrad_final.value[i][j]=0;
28  tpw=0;
29 
30  for(k=inex;k<time_step+inex;k++) {
31 
32  if(nexrad[k]==NULL) {
33 
34  printf("error in allocation\n");
35  continue;
36 
37  }
38 
39  if(nexrad[k]->flag < 0)
40  continue;
41 
42  pw=(-170+((float)nexrad[k]->value[i][j]*5))/100.;
43  pw=.03937 * pow(10,pw);
44 
45  if(pw < .01)
46  continue;
47 
48  tpw=tpw+pw;
49 
50 
51  }
52 
53  if(tpw <= .01)
54  continue;
55 
56  tpw=tpw/.03937;
57 
58  pw=log10(tpw);
59 
60  kk=(int)(100*pw+170)/5;
61  nexrad_final.value[i][j]=kk;
62 
63  }
64 
65 }
66 
67 return;
68 
69 }
70 
void calculate_NEXRAD(int inex, int time_step)
static int i
printf("fbuf is %s\n", fbuf)
int j
Definition: mapp2h.h:48
int k
Definition: mapp2h.h:48
int time_step
Definition: mapper.c:85
float value
Definition: misc.h:487
unsigned char value[131][131]
Definition: misc.h:489
char date[100]
Definition: misc.h:490
int flag
Definition: misc.h:491