Mapper
make_mat.c
Go to the documentation of this file.
1 #include "prototypes_new.h"
2 
3 void make_mat(int num,int mnum)
4 
5 {
6 
7 extern int render_all;
8 extern wfo_orig;
9 extern int wfo_in_use[20];
10 extern int pcp_in_use[500];
11 extern struct map map[1500];
12 extern struct pcp *pcp;
13 extern struct hrap_grid *hrap_grid;
14 int h;
15 char fbuf[100];
16 int x,y,ix,iy,l;
17 int minx,miny,totx,toty,uzpts,lzpts,mzpts,gzpts;
18 float lz,uz,mz,gz;
19 int ib;
20 
21 if(pcp_in_use[num]==-1)
22  return;
23 
24 strcpy(fbuf,"pcp");
25 
26 read_file(fbuf,num,pcp);
27 
28 minx=hrap_grid->hrap_minx;
29 miny=hrap_grid->hrap_miny;
30 totx=hrap_grid->maxi;
31 toty=hrap_grid->maxj;
32 
33 for(ib=0;map[ib].hb5[0]!=0;ib++) {
34 
35  if(render_all == 0) {
36 
37  /* skip if you are not the owner and there is no value */
38  /* should not affect daily_qc */
39  /* may affect verify */
40  /* should fix specify */
41  /* auto_specify ??? */
42 
43  if(map[ib].owner!=wfo_orig &&
44  map[ib].tuz[num] < 0 &&
45  map[ib].tlz[num] < 0 &&
46  map[ib].tmz[num] < 0 &&
47  map[ib].tgz[num] < 0)
48  continue;
49 
50  }
51 
52  mz=0;uz=0;lz=0;gz=0;uzpts=0;lzpts=0;mzpts=0;gzpts=0;
53 
54  for(l=0;l<map[ib].hrap_points;l++) {
55 
56  x=map[ib].hrap_data[l].x;
57  y=map[ib].hrap_data[l].y;
58 
59  ix=x-minx;
60  iy=y-miny;
61 
62  if(ix < 0 || iy < 0 || ix >= totx || iy >= toty ||
63  pcp->value[ix][iy] < -500) {
64 
65  continue;
66 
67  }
68 
69  if(map[ib].hrap_data[l].zone[3]==1) {
70 
71  gz=gz+(float)pcp->value[ix][iy]/100;
72  gzpts++;
73 
74  }
75 
76  if(map[ib].hrap_data[l].zone[2]==1) {
77 
78  uz=uz+(float)pcp->value[ix][iy]/100;
79  uzpts++;
80 
81  }
82 
83  if(map[ib].hrap_data[l].zone[1]==1) {
84 
85  mz=mz+(float)pcp->value[ix][iy]/100;
86  mzpts++;
87 
88  }
89 
90  if(map[ib].hrap_data[l].zone[0]==1){
91 
92  lz=lz+(float)pcp->value[ix][iy]/100;
93  lzpts++;
94 
95  }
96 
97 
98  }
99 
100  if(gzpts ==0)
101  gz=-1;
102  else
103  gz=gz/(float)uzpts;
104 
105  if(uzpts ==0)
106  uz=-1;
107  else
108  uz=uz/(float)uzpts;
109 
110  if(mzpts==0)
111  mz=-1;
112  else
113  mz=mz/(float)mzpts;
114 
115  if(lzpts==0)
116  lz=-1;
117 
118  else
119  lz=lz/(float)lzpts;
120 
121  map[ib].tuz[mnum]=uz;
122  map[ib].tlz[mnum]=lz;
123  map[ib].tmz[mnum]=mz;
124  map[ib].tgz[mnum]=gz;
125 
126  map[ib].tmaps_done[mnum]=1;
127 
128  }
129 
130 return;
131 
132 }
133 
134 
char fbuf[100]
Definition: decode_HDP.c:2
void read_file(char *, int, struct pcp *)
Definition: read_file.c:5
void make_mat(int num, int mnum)
Definition: make_mat.c:3
struct pcp * pcp
Definition: mapper.c:140
int pcp_in_use[50]
Definition: mapper.c:78
struct hrap_grid * hrap_grid
Definition: mapper.c:142
ib
Definition: shleap.cc:46
int x
Definition: misc.h:230
int y
Definition: misc.h:231
short int hrap_miny
Definition: misc.h:583
short int hrap_minx
Definition: misc.h:582
short int maxi
Definition: misc.h:580
short int maxj
Definition: misc.h:581
short int ** owner
Definition: misc_new.h:811
Definition: misc.h:236
char hb5[10]
Definition: misc.h:238
int * tmaps_done
Definition: misc_new.h:325
float * tgz
Definition: misc_new.h:338
struct hrap_data * hrap_data
Definition: misc.h:245
int hrap_points
Definition: misc.h:244
float * tuz
Definition: misc_new.h:339
float * tmz
Definition: misc_new.h:340
float * tlz
Definition: misc_new.h:341
Definition: misc.h:596
short int ** value
Definition: misc.h:599