1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
|
program statistics;
uses
lowlevelunit, SysUtils, math;
type
tPosition = class
breite,laenge,hoehe: extended;
zeit: int64;
constructor create;
destructor destroy; override;
procedure load(s: ansiString);
function toString: ansiString;
procedure copyFrom(p: tPosition);
end;
tMesswert = class(tPosition)
wert: extended;
end;
constructor tPosition.create;
begin
inherited create;
end;
destructor tPosition.destroy;
begin
inherited destroy;
end;
procedure tPosition.load(s: ansiString);
begin
breite:=strToFloat(erstesArgument(s,#9));
laenge:=strToFloat(erstesArgument(s,#9));
hoehe:=strToFloat(erstesArgument(s,#9));
zeit:=round(strToDate(erstesArgument(s,'T')));
zeit:=round(24*60*60*(zeit + strToTime(erstesArgument(s,'Z'))));
end;
function tPosition.toString: ansiString;
begin
result:=
'"'+floatToStr(breite)+'" "'+
floatToStr(laenge)+'" "'+
floatToStr(hoehe)+'" "'+
floatToStr(zeit)+'"';
end;
procedure tPosition.copyFrom(p: tPosition);
begin
breite:=p.breite;
laenge:=p.laenge;
hoehe:=p.hoehe;
zeit:=p.zeit;
end;
function abstand(p1,p2: tPosition): extended;
begin
result:=sqrt(
sqr(p1.hoehe-p2.hoehe) +
sqr((12756320 + p1.hoehe + p2.hoehe)/2) * (
sqr((p1.breite-p2.breite)/180*pi) +
sqr(
sin((p1.breite+p2.breite)/2) *
(p1.laenge - p2.laenge)
)
)
)
end;
var
b: boolean;
s: ansiString;
i,x,y: int64;
ps: array[boolean] of tPosition;
ws: array of tMesswert;
minB,maxB,minL,maxL: extended;
zoom,w: extended;
wL,wU,wBr,wHo: int64;
anz: array of int64;
sum,qSum: array of extended;
begin
i:=0;
ShortDateFormat:='y-m-d';
zoom:=5000;
for b:=false to true do
ps[b]:=tPosition.create;
setLength(ws,0);
minB:=0;
maxB:=0;
minL:=0;
maxL:=0;
while not eof() do begin
readln(s);
ps[true].copyFrom(ps[false]);
ps[false].load(s);
if i>0 then begin
if ps[false].zeit<ps[true].zeit then
writeln(stderr, 'ERROR: ' + ps[false].toString + ' < ' + ps[true].toString);
if (ps[true].laenge < 11.47) or
(ps[true].laenge > 11.70) or
(ps[true].breite < 50.85) or
(ps[true].breite > 50.99) then
continue;
if ps[false].zeit-ps[true].zeit>=30 then
continue;
w:=abstand(ps[true],ps[false])/(ps[false].zeit-ps[true].zeit);
if w*3.6 > 100 then
continue;
setLength(ws,length(ws)+1);
ws[length(ws)-1]:=tMesswert.create;
with ws[length(ws)-1] do begin
copyFrom(ps[true]);
wert:=w;
if (length(ws)=1) or (minB>breite) then
minB:=breite;
if (length(ws)=1) or (maxB<breite) then
maxB:=breite;
if (length(ws)=1) or (minL>laenge) then
minL:=laenge;
if (length(ws)=1) or (maxL<laenge) then
maxL:=laenge;
end;
end;
inc(i);
// if i>100000 then
// break;
end;
for b:=false to true do
ps[b].free;
writeln(stderr,minL,' .. ',maxL,' x ',minB,' .. ',maxB);
wU:=round(floor(minB*zoom));
wHo:=round(floor(maxB*zoom)+1-wU);
wL:=round(floor(minL*cos(minB+maxB)*zoom));
wBr:=round(floor(maxL*cos(minB+maxB)*zoom)+1-wL);
writeln(stderr,wBr,' x ',wHo);
setLength(anz,wBr*wHo);
setLength(sum,wBr*wHo);
setLength(qSum,wBr*wHo);
fillchar(anz[0],sizeof(anz[0])*length(anz),0);
fillchar(sum[0],sizeof(sum[0])*length(sum),0);
fillchar(qSum[0],sizeof(qSum[0])*length(qSum),0);
for i:=0 to length(ws)-1 do begin
x:=round(ws[i].laenge*cos(minB+maxB)*zoom)-wL;
y:=round(ws[i].breite*zoom)-wU;
inc(anz[x+wBr*y]);
sum[x+wBr*y]:= sum[x+wBr*y] + ws[i].wert;
qSum[x+wBr*y]:= qSum[x+wBr*y] + sqr(ws[i].wert);
end;
for y:=0 to wHo-1 do begin
for x:=0 to wBr-1 do begin
if x>0 then
write(',');
write(intToStr(anz[x+y*wBr])+':');
if anz[x+y*wBr]>0 then begin
write(floatToStr(sum[x+y*wBr]/anz[x+y*wBr]));
write('±');
write(floatToStr(sqrt(qSum[x+y*wBr]/anz[x+y*wBr]-sqr(sum[x+y*wBr]/anz[x+y*wBr]))));
end
else
write('NaN±NaN');
end;
writeln;
end;
end.
|