Mapper
make_map_new.c
Go to the documentation of this file.
1 #include "prototypes_new.h"
2 
3 void make_map(int num)
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 printf("in make_map_new\n");
22 
23 if(pcp_in_use[num]==-1)
24  return;
25 
26 
27 strcpy(fbuf,"pcp");
28 
29 read_file(fbuf,num,pcp);
30 
31 minx=hrap_grid->hrap_minx;
32 miny=hrap_grid->hrap_miny;
33 totx=hrap_grid->maxi;
34 toty=hrap_grid->maxj;
35 
36 for(ib=0;map[ib].hb5[0]!=0;ib++) {
37 
38  if(render_all == 0) {
39 
40  /* skip if you are not the owner and there is no value */
41  /* should not affect daily_qc */
42  /* may affect verify */
43  /* should fix specify */
44  /* auto_specify ??? */
45 
46 
47 
48  if(map[ib].owner!=wfo_orig &&
49  map[ib].uz[num] < 0 &&
50  map[ib].lz[num] < 0 &&
51  map[ib].mz[num] < 0 &&
52  map[ib].gz[num] < 0)
53  continue;
54 
55  }
56 
57  mz=0;uz=0;lz=0;gz=0;uzpts=0;lzpts=0;mzpts=0;gzpts=0;
58 
59 
60  for(l=0;l<map[ib].hrap_points;l++) {
61 
62  x=map[ib].hrap_data[l].x;
63  y=map[ib].hrap_data[l].y;
64 
65  ix=x-minx;
66  iy=y-miny;
67 
68  if(ix < 0 || iy < 0 || ix >= totx || iy >= toty ||
69  pcp->value[ix][iy] ==-9999) {
70 
71  continue;
72 
73  }
74 
75  if(map[ib].hrap_data[l].zone[3]==1) {
76 
77  gz=gz+(float)pcp->value[ix][iy]/100;
78  gzpts++;
79 
80  }
81 
82  if(map[ib].hrap_data[l].zone[2]==1) {
83 
84  uz=uz+(float)pcp->value[ix][iy]/100;
85  uzpts++;
86 
87  }
88 
89  if(map[ib].hrap_data[l].zone[1]==1) {
90 
91  mz=mz+(float)pcp->value[ix][iy]/100;
92  mzpts++;
93 
94  }
95 
96  if(map[ib].hrap_data[l].zone[0]==1){
97 
98  lz=lz+(float)pcp->value[ix][iy]/100;
99  lzpts++;
100 
101  }
102 
103 
104  }
105 
106  if(gzpts ==0)
107  gz=-1;
108  else
109  gz=gz/(float)uzpts;
110 
111  if(uzpts ==0)
112  uz=-1;
113  else
114  uz=uz/(float)uzpts;
115 
116  if(mzpts==0)
117  mz=-1;
118  else
119  mz=mz/(float)mzpts;
120 
121  if(lzpts==0)
122  lz=-1;
123 
124  else
125  lz=lz/(float)lzpts;
126 
127  map[ib].uz[num]=uz;
128  map[ib].lz[num]=lz;
129  map[ib].mz[num]=mz;
130  map[ib].gz[num]=gz;
131 
132  map[ib].maps_done[num]=1;
133 
134  }
135 
136 return;
137 
138 }
139 
140 
char fbuf[100]
Definition: decode_HDP.c:2
void read_file(char *, int, struct pcp *)
Definition: read_file.c:5
printf("fbuf is %s\n", fbuf)
void make_map(int num)
Definition: make_map_new.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
float lz[200]
Definition: misc.h:250
float uz[200]
Definition: misc.h:248
struct hrap_data * hrap_data
Definition: misc.h:245
int hrap_points
Definition: misc.h:244
float gz[200]
Definition: misc.h:247
float mz[200]
Definition: misc.h:249
int maps_done[200]
Definition: misc.h:246
Definition: misc.h:596
short int ** value
Definition: misc.h:599