Mapper
libraries
common
make_fmap.c
Go to the documentation of this file.
1
#include "
prototypes.h
"
2
3
void
make_fmap
(
int
k
)
4
5
{
6
7
extern
struct
map
map
[500];
8
extern
struct
pcp
*qpf;
9
extern
struct
hrap_grid
*
hrap_grid
;
10
int
m,
ib
,l;
11
int
x,y,ix,iy;
12
int
minx,miny,totx,toty,uzpts,lzpts,mzpts,gzpts;
13
float
lz,uz,mz,gz;
14
time_t
tim
;
15
struct
tm *gmtim;
16
17
tim
=time(NULL);
18
19
gmtim=gmtime(&
tim
);
20
21
minx=
hrap_grid
->
hrap_minx
;
22
miny=
hrap_grid
->
hrap_miny
;
23
totx=
hrap_grid
->
maxi
;
24
toty=
hrap_grid
->
maxj
;
25
26
read_file
(
"qpf"
,
k
,qpf);
27
28
for
(
ib
=0;
map
[
ib
].
hb5
[0]!=0;
ib
++) {
29
30
mz=0;uz=0;lz=0;gz=0;uzpts=0;lzpts=0;mzpts=0;gzpts=0;
31
32
33
for
(l=0;l<
map
[
ib
].
hrap_points
;l++) {
34
35
x=
map
[
ib
].
hrap_data
[l].
x
;
36
y=
map
[
ib
].
hrap_data
[l].
y
;
37
38
ix=x-minx;
39
iy=y-miny;
40
41
if
(ix < 0 || iy < 0 || ix > totx || iy > toty) {
42
43
continue
;
44
45
}
46
47
if
(
map
[
ib
].
hrap_data
[l].zone[3]==1) {
48
49
gz=gz+(float)qpf->
value
[ix][iy]/100;
50
gzpts++;
51
52
}
53
54
if
(
map
[
ib
].
hrap_data
[l].zone[2]==1) {
55
56
uz=uz+(float)qpf->
value
[ix][iy]/100;
57
uzpts++;
58
59
}
60
61
if
(
map
[
ib
].
hrap_data
[l].zone[1]==1) {
62
63
mz=mz+(float)qpf->
value
[ix][iy]/100;
64
mzpts++;
65
66
}
67
68
if
(
map
[
ib
].
hrap_data
[l].zone[0]==1) {
69
70
lz=lz+(float)qpf->
value
[ix][iy]/100;
71
lzpts++;
72
73
74
75
}
76
77
}
78
79
if
(uzpts ==0)
80
uz=-1;
81
else
82
uz=uz/(float)uzpts;
83
84
if
(mzpts==0)
85
mz=-1;
86
else
87
mz=mz/(float)mzpts;
88
89
if
(lzpts==0)
90
lz=-1;
91
else
92
lz=lz/(float)lzpts;
93
94
if
(gzpts==0)
95
gz=-1;
96
else
97
gz=gz/(float)gzpts;
98
99
100
map
[
ib
].
gz
[
k
]=gz;
101
map
[
ib
].
uz
[
k
]=uz;
102
map
[
ib
].
mz
[
k
]=mz;
103
map
[
ib
].
lz
[
k
]=lz;
104
map
[
ib
].
maps_done
[
k
]=1;
105
106
}
107
108
}
109
110
read_file
void read_file(char *, int, struct pcp *)
Definition:
read_file.c:5
make_fmap
void make_fmap(int k)
Definition:
make_fmap.c:3
k
int k
Definition:
mapp2h.h:48
hrap_grid
struct hrap_grid * hrap_grid
Definition:
mapper.c:142
prototypes.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
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
tim
tim()
Definition:
tim.c:4
Generated by
1.9.1