Mapper
libraries
common
make_rsel.c
Go to the documentation of this file.
1
#include "
prototypes_new.h
"
2
3
void
make_rsel
(
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
].zuz[num] < 0 &&
45
map
[
ib
].zlz[num] < 0 &&
46
map
[
ib
].zmz[num] < 0 &&
47
map
[
ib
].zgz[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] < 0) {
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
].
zuz
[mnum]=uz;
122
map
[
ib
].
zlz
[mnum]=lz;
123
map
[
ib
].
zmz
[mnum]=mz;
124
map
[
ib
].
zgz
[mnum]=gz;
125
126
map
[
ib
].
zmaps_done
[mnum]=1;
127
128
}
129
130
return
;
131
132
}
133
134
fbuf
char fbuf[100]
Definition:
decode_HDP.c:2
read_file
void read_file(char *, int, struct pcp *)
Definition:
read_file.c:5
make_rsel
void make_rsel(int num, int mnum)
Definition:
make_rsel.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::hrap_data
struct hrap_data * hrap_data
Definition:
misc.h:245
map::hrap_points
int hrap_points
Definition:
misc.h:244
map::zgz
float * zgz
Definition:
misc_new.h:334
map::zuz
float * zuz
Definition:
misc_new.h:335
map::zlz
float * zlz
Definition:
misc_new.h:337
map::zmaps_done
int * zmaps_done
Definition:
misc_new.h:324
map::zmz
float * zmz
Definition:
misc_new.h:336
pcp
Definition:
misc.h:596
pcp::value
short int ** value
Definition:
misc.h:599
Generated by
1.9.1