Mapper
libraries
common
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
fbuf
char fbuf[100]
Definition:
decode_HDP.c:2
read_file
void read_file(char *, int, struct pcp *)
Definition:
read_file.c:5
printf
printf("fbuf is %s\n", fbuf)
make_map
void make_map(int num)
Definition:
make_map_new.c:3
pcp
struct pcp * pcp
Definition:
mapper.c:140
pcp_in_use
int pcp_in_use[50]
Definition:
mapper.c:78
hrap_grid
struct hrap_grid * hrap_grid
Definition:
mapper.c:142
prototypes_new.h
ib
ib
Definition:
shleap.cc:46
hrap_data
Definition:
misc.h:228
hrap_data::x
int x
Definition:
misc.h:230
hrap_data::y
int y
Definition:
misc.h:231
hrap_grid
Definition:
misc.h:578
hrap_grid::hrap_miny
short int hrap_miny
Definition:
misc.h:583
hrap_grid::hrap_minx
short int hrap_minx
Definition:
misc.h:582
hrap_grid::maxi
short int maxi
Definition:
misc.h:580
hrap_grid::maxj
short int maxj
Definition:
misc.h:581
hrap_grid::owner
short int ** owner
Definition:
misc_new.h:811
map
Definition:
misc.h:236
map::hb5
char hb5[10]
Definition:
misc.h:238
map::lz
float lz[200]
Definition:
misc.h:250
map::uz
float uz[200]
Definition:
misc.h:248
map::hrap_data
struct hrap_data * hrap_data
Definition:
misc.h:245
map::hrap_points
int hrap_points
Definition:
misc.h:244
map::gz
float gz[200]
Definition:
misc.h:247
map::mz
float mz[200]
Definition:
misc.h:249
map::maps_done
int maps_done[200]
Definition:
misc.h:246
pcp
Definition:
misc.h:596
pcp::value
short int ** value
Definition:
misc.h:599
Generated by
1.9.1