1 | #!/usr/bin/env perl
|
---|
2 |
|
---|
3 | # ========================================================================
|
---|
4 | # pppPlot.pl - plot BNC's PPP results using gnuplot
|
---|
5 | # ========================================================================
|
---|
6 | #
|
---|
7 | # Plot metrics:
|
---|
8 | # - NEU displacements w.r.t. coordinates in Crd file
|
---|
9 | # - A-priori + correction values of tropospheric zenith delay in [m],
|
---|
10 | # - Receiver clock error and offsets in [m],
|
---|
11 | # - Elevations, given per satellite
|
---|
12 | # - Ambiguities, given per satellite
|
---|
13 | # - Ionosphere Delay [m],
|
---|
14 | # - Receiver Bias [m]
|
---|
15 | # - Code and phase residuals in [m],
|
---|
16 | #
|
---|
17 | # Author : Andrea Stuerze
|
---|
18 | # Revision: $Header: trunk/BNC/scripts/pppPlot.pl 10388 2024-03-12 14:10:17Z stuerze $
|
---|
19 | # Changes :
|
---|
20 | # ========================================================================
|
---|
21 |
|
---|
22 | # Uses
|
---|
23 | use strict;
|
---|
24 | use warnings;
|
---|
25 |
|
---|
26 | BEGIN {
|
---|
27 | use FindBin qw($Bin);
|
---|
28 | use lib "$Bin";
|
---|
29 | }
|
---|
30 |
|
---|
31 | use diagnostics;
|
---|
32 | use PDL;
|
---|
33 | use FindBin qw($Bin);
|
---|
34 | use Getopt::Long;
|
---|
35 | use Chart::Gnuplot;
|
---|
36 | use Data::Dumper qw(Dumper);
|
---|
37 | use File::Basename;
|
---|
38 | use Date::Manip;
|
---|
39 | use Log::Log4perl qw(:easy);
|
---|
40 | use PDF::API2;
|
---|
41 |
|
---|
42 | use Bnc;
|
---|
43 | use Common;
|
---|
44 |
|
---|
45 | use constant {
|
---|
46 | mm => 25.4 / 72,
|
---|
47 | inch => 1 / 72,
|
---|
48 | pt => 1,
|
---|
49 | }; # There are 72 postscript points in an inch and there are 25.4 millimeters in an inch.
|
---|
50 |
|
---|
51 |
|
---|
52 | # Logging
|
---|
53 | Log::Log4perl->easy_init(
|
---|
54 | {
|
---|
55 |
|
---|
56 | #file => "plotPPP.log",
|
---|
57 | layout => '%d [%c l%L] %p: %m%n',
|
---|
58 | level => $TRACE
|
---|
59 | }
|
---|
60 | );
|
---|
61 |
|
---|
62 | # Options
|
---|
63 | my ($prog) = fileparse($0);
|
---|
64 | my $help = 0;
|
---|
65 | my @plotTypes = ();
|
---|
66 | my @logFiles = ();
|
---|
67 | my $sampling = 1;
|
---|
68 |
|
---|
69 | GetOptions(
|
---|
70 | 'help' => \$help,
|
---|
71 | 'plotTypes=s' => \@plotTypes,
|
---|
72 | 'logFiles=s' => \@logFiles,
|
---|
73 | 'sampling=s' => \$sampling,
|
---|
74 | );
|
---|
75 |
|
---|
76 | HELP_MESSAGE() if $help;
|
---|
77 | @plotTypes = qw(NEU) unless (@plotTypes);
|
---|
78 | @plotTypes = map {uc} split ( /[, ]/, join ( ',', @plotTypes ) );
|
---|
79 | @logFiles = split ( /[, ]/, join ( ',', @logFiles ) );
|
---|
80 | unless (@logFiles) { ERROR "logfiles missing"; HELP_MESSAGE() }
|
---|
81 | DEBUG("\n plotTpes: @plotTypes\n logfiles: @logFiles\n sampling: $sampling");
|
---|
82 |
|
---|
83 | # -----------------------------------------------------------------------------
|
---|
84 | # Generate data sets for gnuplot
|
---|
85 | # -----------------------------------------------------------------------------
|
---|
86 | # for pdf gerneration
|
---|
87 | my ( $png, $page, $headline, $headline_text );
|
---|
88 | my $y0 = 180 / mm;
|
---|
89 | my ( $x, $y, $width, $height ) = ( 40 / mm, $y0, 130 / mm, 80 / mm );
|
---|
90 | my $dy = $height + 10 / mm;
|
---|
91 |
|
---|
92 | # Loop over logfiles
|
---|
93 | foreach my $file (@logFiles) {
|
---|
94 | DEBUG "Parse logfile $file";
|
---|
95 |
|
---|
96 | # -----------------------------------------------------------------------------
|
---|
97 | # Create pdf for plot results
|
---|
98 | # -----------------------------------------------------------------------------
|
---|
99 | my ( $inputFilename, $inputDir, $inputSuffix ) = fileparse( $file, '\..*' );
|
---|
100 | my $pdf_name = sprintf ( "%s.pdf", $inputFilename );
|
---|
101 | my $pdf = PDF::API2->new( -file => "$inputDir$pdf_name" );
|
---|
102 | my $font1 = $pdf->corefont('Helvetica-Bold');
|
---|
103 |
|
---|
104 | # -----------------------------------------------------------------------------
|
---|
105 | # Read logfile
|
---|
106 | # -----------------------------------------------------------------------------
|
---|
107 | my ( $station, $file ) = Bnc::parsePPPLogfile( $file, $sampling );
|
---|
108 | my $EPOCH = $file->{'EPOCH'};
|
---|
109 | my $EPOCH_OFF_GPS = $file->{'EPOCH_OFF_GPS'};
|
---|
110 | my $EPOCH_OFF_GLO = $file->{'EPOCH_OFF_GLO'};
|
---|
111 | my $EPOCH_OFF_GAL = $file->{'EPOCH_OFF_GAL'};
|
---|
112 | my $EPOCH_OFF_BDS = $file->{'EPOCH_OFF_BDS'};
|
---|
113 | my $EPOCH_CLK = $file->{'EPOCH_CLK'};
|
---|
114 | my %AMB = %{ $file->{'AMB'} };
|
---|
115 | my %RES = %{ $file->{'RES'} };
|
---|
116 | my %ELE = %{ $file->{'ELE'} };
|
---|
117 | my %ION = %{ $file->{'ION'} };
|
---|
118 | my %BIA = %{ $file->{'BIA'} };
|
---|
119 |
|
---|
120 | # -----------------------------------------------------------------------------
|
---|
121 | # RMS computation
|
---|
122 | # -----------------------------------------------------------------------------
|
---|
123 | my ( $mean, $prms, $median, $min, $max, $adev, $rms_n, $rms_e, $rms_u, $rms_trp );
|
---|
124 | my ( $n, $e, $u, $trp, $str_rms_n, $str_rms_e, $str_rms_u, $str_rms_trp );
|
---|
125 | $n = pdl( $file->{'N'} );
|
---|
126 | ( $mean, $prms, $median, $min, $max, $adev, $rms_n ) = stats($n);
|
---|
127 | $e = pdl( $file->{'E'} );
|
---|
128 | ( $mean, $prms, $median, $min, $max, $adev, $rms_e ) = stats($e);
|
---|
129 | $u = pdl( $file->{'U'} );
|
---|
130 | ( $mean, $prms, $median, $min, $max, $adev, $rms_u ) = stats($u);
|
---|
131 | $trp = pdl( $file->{'TRP'} );
|
---|
132 | ( $mean, $prms, $median, $min, $max, $adev, $rms_trp ) = stats($trp);
|
---|
133 | $str_rms_n = sprintf ( " %.2f ", $rms_n );
|
---|
134 | $str_rms_e = sprintf ( " %.2f ", $rms_e );
|
---|
135 | $str_rms_u = sprintf ( " %.2f ", $rms_u );
|
---|
136 | $str_rms_trp = sprintf ( " %.2f ", $rms_trp );
|
---|
137 | DEBUG("RMS: North: $str_rms_n, East: $str_rms_e, Up: $str_rms_u, TRP: $str_rms_trp");
|
---|
138 |
|
---|
139 | # -----------------------------------------------------------------------------
|
---|
140 | # Plot several data sets
|
---|
141 | # -----------------------------------------------------------------------------
|
---|
142 | my $dataset;
|
---|
143 | ######### NEU #####################
|
---|
144 | DEBUG "Plot NEU";
|
---|
145 | $page = $pdf->page();
|
---|
146 | $page->mediabox('A4');
|
---|
147 | $headline = sprintf ( "PPP results for station %s", $station );
|
---|
148 | $headline_text = $page->text;
|
---|
149 | $headline_text->font( $font1, 11 / pt );
|
---|
150 | $headline_text->translate( 15 / mm, 280 / mm );
|
---|
151 | $headline_text->text($headline);
|
---|
152 | $y = $y0;
|
---|
153 | my $pngName = sprintf ( "%s_NEU.png", $station );
|
---|
154 | my $chartNEU = newChart($station);
|
---|
155 | $chartNEU->set( output => $pngName );
|
---|
156 | $chartNEU->set( ylabel => "Displacements [m]", yrange => [ " -0.5 ", " 0.5 " ] );
|
---|
157 |
|
---|
158 | #y2label => "Number of Satellites [-]", y2range => [" 0 ", " 20 "], y2tics => 'on',
|
---|
159 |
|
---|
160 | my $dataN = Chart::Gnuplot::DataSet->new(
|
---|
161 | xdata => $EPOCH,
|
---|
162 | ydata => $file->{'N'},
|
---|
163 | title => "Displacements N, RMS + -$str_rms_n m",
|
---|
164 | timefmt => '%s',
|
---|
165 | style => "linespoints",
|
---|
166 | );
|
---|
167 | my $dataE = Chart::Gnuplot::DataSet->new(
|
---|
168 | xdata => $EPOCH,
|
---|
169 | ydata => $file->{'E'},
|
---|
170 | title => "Displacements E, RMS + -$str_rms_e m",
|
---|
171 | timefmt => '%s',
|
---|
172 | style => "linespoints",
|
---|
173 | );
|
---|
174 | my $dataU = Chart::Gnuplot::DataSet->new(
|
---|
175 | xdata => $EPOCH,
|
---|
176 | ydata => $file->{'U'},
|
---|
177 | title => "Displacements U, RMS + -$str_rms_u m",
|
---|
178 | timefmt => '%s',
|
---|
179 | style => "linespoints",
|
---|
180 | );
|
---|
181 | my @datasets = ( $dataN, $dataE, $dataU );
|
---|
182 | $chartNEU->plot2d(@datasets);
|
---|
183 |
|
---|
184 | $png = $page->gfx();
|
---|
185 | LOGDIE("could not find image file: $!\n") unless -e $pngName;
|
---|
186 | $png->image( $pdf->image_png($pngName), $x, $y, $width, $height ); #print "y= : $y \n"
|
---|
187 |
|
---|
188 | ######### TRP #####################
|
---|
189 | if ( grep ( $_ eq "ALL", @plotTypes ) ) {
|
---|
190 | DEBUG "Plot TRP";
|
---|
191 | my $pngName = sprintf ( "%s_TRP.png", $station );
|
---|
192 | my $chartTRP = newChart($station);
|
---|
193 | $chartTRP->set( output => $pngName );
|
---|
194 | $chartTRP->set( ylabel => "Tropospheric Delay [m]", yrange => [ " 1.0 ", " 3.0 " ] );
|
---|
195 |
|
---|
196 | my $dataTRP = Chart::Gnuplot::DataSet->new(
|
---|
197 | xdata => $EPOCH,
|
---|
198 | ydata => $file->{'TRP'},
|
---|
199 | title => "Tropospheric Delay, RMS + -$str_rms_trp m",
|
---|
200 | timefmt => '%s',
|
---|
201 | style => "points",
|
---|
202 | );
|
---|
203 | $chartTRP->plot2d($dataTRP);
|
---|
204 | $y = $y - $dy;
|
---|
205 |
|
---|
206 | if ( $y < 30 / mm ) {
|
---|
207 | $page = $pdf->page();
|
---|
208 | $page->mediabox('A4');
|
---|
209 | $y = $y0;
|
---|
210 | }
|
---|
211 | $png = $page->gfx();
|
---|
212 | LOGDIE("could not find image file: $!\n") unless -e $pngName;
|
---|
213 | $png->image( $pdf->image_png($pngName), $x, $y, $width, $height );
|
---|
214 |
|
---|
215 | ######### CLK #####################
|
---|
216 | if ( scalar @{ $file->{'CLK'} } < 1 ) {
|
---|
217 | DEBUG "No CLK found";
|
---|
218 | }
|
---|
219 | else {
|
---|
220 | DEBUG "Plot CLK";
|
---|
221 | $pngName = sprintf ( "%s_CLK.png", $station );
|
---|
222 | my $chartCLK = newChart($station);
|
---|
223 | $chartCLK->set( output => $pngName );
|
---|
224 | $chartCLK->set( ylabel => "CLK [m]" );
|
---|
225 |
|
---|
226 | $dataset = Chart::Gnuplot::DataSet->new(
|
---|
227 | xdata => $EPOCH,
|
---|
228 | ydata => $file->{'CLK'},
|
---|
229 | title => "Receiver clock",
|
---|
230 | timefmt => '%s',
|
---|
231 | style => "linespoints",
|
---|
232 | );
|
---|
233 | $chartCLK->plot2d($dataset);
|
---|
234 | $y = $y - $dy;
|
---|
235 |
|
---|
236 | if ( $y < 30 / mm ) {
|
---|
237 | $page = $pdf->page();
|
---|
238 | $page->mediabox('A4');
|
---|
239 | $y = $y0;
|
---|
240 | }
|
---|
241 | $png = $page->gfx();
|
---|
242 | LOGDIE("could not find image file: $!\n") unless -e $pngName;
|
---|
243 | $png->image( $pdf->image_png($pngName), $x, $y, $width, $height );
|
---|
244 | }
|
---|
245 |
|
---|
246 | ######### OFF_GPS #####################
|
---|
247 | if ( grep ( $_ eq "ALL", @plotTypes ) ) {
|
---|
248 | if ( scalar @{ $file->{'OFF_GPS'} } < 1 ) {
|
---|
249 | DEBUG "No OFF_GPS found";
|
---|
250 | }
|
---|
251 | else {
|
---|
252 | DEBUG "Plot OFF_GPS";
|
---|
253 | my $pngName = sprintf ( "%s_OFF_G.png", $station );
|
---|
254 | my $chartOFF_GPS = newChart($station);
|
---|
255 | $chartOFF_GPS->set( output => $pngName );
|
---|
256 | $chartOFF_GPS->set( ylabel => "Offset GPS [m]" );
|
---|
257 |
|
---|
258 | $dataset = Chart::Gnuplot::DataSet->new(
|
---|
259 | xdata => $EPOCH_OFF_GPS,
|
---|
260 | ydata => $file->{'OFF_GPS'},
|
---|
261 | title => "Receiver Offset GPS",
|
---|
262 | timefmt => '%s',
|
---|
263 | style => "linespoints",
|
---|
264 | );
|
---|
265 | $chartOFF_GPS->plot2d($dataset); #system ("display $pngName&");
|
---|
266 | $y = $y - $dy;
|
---|
267 |
|
---|
268 | if ( $y < 30 / mm ) {
|
---|
269 | $page = $pdf->page();
|
---|
270 | $page->mediabox('A4');
|
---|
271 | $y = $y0;
|
---|
272 | }
|
---|
273 | $png = $page->gfx();
|
---|
274 | LOGDIE("could not find image file: $!\n") unless -e $pngName;
|
---|
275 | $png->image( $pdf->image_png($pngName), $x, $y, $width, $height );
|
---|
276 | }
|
---|
277 | }
|
---|
278 |
|
---|
279 |
|
---|
280 | ######### OFF_GLO #####################
|
---|
281 | if ( grep ( $_ eq "ALL", @plotTypes ) ) {
|
---|
282 | if ( scalar @{ $file->{'OFF_GLO'} } < 1 ) {
|
---|
283 | DEBUG "No OFF_GLO found";
|
---|
284 | }
|
---|
285 | else {
|
---|
286 | DEBUG "Plot OFF_GLO";
|
---|
287 | my $pngName = sprintf ( "%s_OFF_R.png", $station );
|
---|
288 | my $chartOFF_GLO = newChart($station);
|
---|
289 | $chartOFF_GLO->set( output => $pngName );
|
---|
290 | $chartOFF_GLO->set( ylabel => "Offset GLONASS [m]" );
|
---|
291 |
|
---|
292 | $dataset = Chart::Gnuplot::DataSet->new(
|
---|
293 | xdata => $EPOCH_OFF_GLO,
|
---|
294 | ydata => $file->{'OFF_GLO'},
|
---|
295 | title => "Receiver Offset GLONASS",
|
---|
296 | timefmt => '%s',
|
---|
297 | style => "linespoints",
|
---|
298 | );
|
---|
299 | $chartOFF_GLO->plot2d($dataset); #system ("display $pngName&");
|
---|
300 | $y = $y - $dy;
|
---|
301 |
|
---|
302 | if ( $y < 30 / mm ) {
|
---|
303 | $page = $pdf->page();
|
---|
304 | $page->mediabox('A4');
|
---|
305 | $y = $y0;
|
---|
306 | }
|
---|
307 | $png = $page->gfx();
|
---|
308 | LOGDIE("could not find image file: $!\n") unless -e $pngName;
|
---|
309 | $png->image( $pdf->image_png($pngName), $x, $y, $width, $height );
|
---|
310 | }
|
---|
311 | }
|
---|
312 |
|
---|
313 | ######### OFF_GAL #####################
|
---|
314 | if ( grep ( $_ eq "ALL", @plotTypes ) ) {
|
---|
315 | if ( scalar @{ $file->{'OFF_GAL'} } < 1 ) {
|
---|
316 | DEBUG "No OFF_GAL found";
|
---|
317 | }
|
---|
318 | else {
|
---|
319 | DEBUG "Plot OFF_GAL";
|
---|
320 | my $pngName = sprintf ( "%s_OFF_E.png", $station );
|
---|
321 | my $chartOFF_GAL = newChart($station);
|
---|
322 | $chartOFF_GAL->set( output => $pngName );
|
---|
323 | $chartOFF_GAL->set( ylabel => "Offset Galileo [m]" );
|
---|
324 |
|
---|
325 | $dataset = Chart::Gnuplot::DataSet->new(
|
---|
326 | xdata => $EPOCH_OFF_GAL,
|
---|
327 | ydata => $file->{'OFF_GAL'},
|
---|
328 | title => "Receiver Offset Galileo",
|
---|
329 | timefmt => '%s',
|
---|
330 | style => "linespoints",
|
---|
331 | );
|
---|
332 | $chartOFF_GAL->plot2d($dataset); #system ("display $pngName&");
|
---|
333 | $y = $y - $dy;
|
---|
334 |
|
---|
335 | if ( $y < 30 / mm ) {
|
---|
336 | $page = $pdf->page();
|
---|
337 | $page->mediabox('A4');
|
---|
338 | $y = $y0;
|
---|
339 | }
|
---|
340 | $png = $page->gfx();
|
---|
341 | LOGDIE("could not find image file: $!\n") unless -e $pngName;
|
---|
342 | $png->image( $pdf->image_png($pngName), $x, $y, $width, $height );
|
---|
343 | }
|
---|
344 | }
|
---|
345 |
|
---|
346 | ######### OFF_BDS #####################
|
---|
347 | if ( grep ( $_ eq "ALL", @plotTypes ) ) {
|
---|
348 | if ( scalar @{ $file->{'OFF_BDS'} } < 1 ) {
|
---|
349 | DEBUG "No OFF_BDS found";
|
---|
350 | }
|
---|
351 | else {
|
---|
352 | DEBUG "Plot OFF_BDS";
|
---|
353 | my $pngName = sprintf ( "%s_OFF_C.png", $station );
|
---|
354 | my $chartOFF_BDS = newChart($station);
|
---|
355 | $chartOFF_BDS->set( output => $pngName );
|
---|
356 | $chartOFF_BDS->set( ylabel => "Offset Beidou [m]" );
|
---|
357 |
|
---|
358 | $dataset = Chart::Gnuplot::DataSet->new(
|
---|
359 | xdata => $EPOCH_OFF_BDS,
|
---|
360 | ydata => $file->{'OFF_BDS'},
|
---|
361 | title => "Receiver Offset Beidou",
|
---|
362 | timefmt => '%s',
|
---|
363 | style => "linespoints",
|
---|
364 | );
|
---|
365 | $chartOFF_BDS->plot2d($dataset); #system ("display $pngName&");
|
---|
366 | $y = $y - $dy;
|
---|
367 |
|
---|
368 | if ( $y < 30 / mm ) {
|
---|
369 | $page = $pdf->page();
|
---|
370 | $page->mediabox('A4');
|
---|
371 | $y = $y0;
|
---|
372 | }
|
---|
373 | $png = $page->gfx();
|
---|
374 | LOGDIE("could not find image file: $!\n") unless -e $pngName;
|
---|
375 | $png->image( $pdf->image_png($pngName), $x, $y, $width, $height );
|
---|
376 | }
|
---|
377 | }
|
---|
378 |
|
---|
379 | ######### ELE #####################
|
---|
380 | DEBUG "Plot Elevations";
|
---|
381 | $page = $pdf->page();
|
---|
382 | $page->mediabox('A4');
|
---|
383 | $y = $y0 + $dy;
|
---|
384 | $headline = sprintf ( "Satellite Elevations for station %s", $station );
|
---|
385 | $headline_text = $page->text;
|
---|
386 | $headline_text->font( $font1, 11 / pt );
|
---|
387 | $headline_text->translate( 15 / mm, 280 / mm );
|
---|
388 | $headline_text->text($headline);
|
---|
389 |
|
---|
390 | my $chartELE = newChart($station);
|
---|
391 | $chartELE->set( legend => { position => "outside right" } );
|
---|
392 |
|
---|
393 | # SYSTEM #print Dumper \%ELE;
|
---|
394 | foreach my $key_sys ( sort keys %ELE ) {
|
---|
395 |
|
---|
396 | # print "$key_sys \n";# print Dumper $ELE{$key_sys};
|
---|
397 | my @datasets = (); # init datasets
|
---|
398 | my $pngName = sprintf ( "%s_ELE_%s.png", $station, $key_sys );
|
---|
399 | $chartELE->set( output => $pngName );
|
---|
400 | $chartELE->set( ylabel => "Elevation [°]", yrange => [ " 0.0 ", " 90.0 " ] );
|
---|
401 |
|
---|
402 | # SATELLITE
|
---|
403 | foreach my $key_sat ( sort keys %{ $ELE{$key_sys} } ) {
|
---|
404 |
|
---|
405 | # print "$key_sat = $ELE{$key_sys}{$key_sat} \n";
|
---|
406 | $dataset = Chart::Gnuplot::DataSet->new(
|
---|
407 | xdata => \@{ $ELE{$key_sys}{$key_sat}{EPOCH} }, # array of epochs
|
---|
408 | ydata => \@{ $ELE{$key_sys}{$key_sat}{DATA} }, # array of elevations of one satellite
|
---|
409 | title => "$key_sat",
|
---|
410 | timefmt => '%s',
|
---|
411 |
|
---|
412 | #style => "points",
|
---|
413 | style => "points",
|
---|
414 | );
|
---|
415 | push ( @datasets, $dataset );
|
---|
416 | }
|
---|
417 | $chartELE->plot2d(@datasets);
|
---|
418 |
|
---|
419 | # system ("display $pngName&");
|
---|
420 | $y = $y - $dy;
|
---|
421 | if ( $y < 30 / mm ) {
|
---|
422 | $page = $pdf->page();
|
---|
423 | $page->mediabox('A4');
|
---|
424 | $y = $y0;
|
---|
425 | }
|
---|
426 | $png = $page->gfx();
|
---|
427 | die ("could not find image file: $!") unless -e $pngName;
|
---|
428 | $png->image( $pdf->image_png($pngName), $x, $y, $width, $height );
|
---|
429 | }
|
---|
430 |
|
---|
431 | ######### AMB #####################
|
---|
432 | DEBUG "Plot Ambiguities";
|
---|
433 | $page = $pdf->page();
|
---|
434 | $page->mediabox('A4');
|
---|
435 | $y = $y0 + $dy;
|
---|
436 | $headline = sprintf ( "Ambiguities for station %s", $station );
|
---|
437 | $headline_text = $page->text;
|
---|
438 | $headline_text->font( $font1, 11 / pt );
|
---|
439 | $headline_text->translate( 15 / mm, 280 / mm );
|
---|
440 | $headline_text->text($headline);
|
---|
441 |
|
---|
442 | # AMBIGUITY_TYPE #print Dumper \%AMB;
|
---|
443 | foreach my $key_ambType (%AMB) { #print "$key_ambType \n";
|
---|
444 | foreach my $key_sys ( sort keys %{ $AMB{$key_ambType} } ) {
|
---|
445 |
|
---|
446 | #print "$key_sys \n"; print Dumper $AMB{$key_ambType};
|
---|
447 | my ( @datasets_amb, @datasets_epo ); # init datasets
|
---|
448 | my $pngName_amb = sprintf ( "%s_AMB_%s_%s.png", $station, $key_ambType, $key_sys );
|
---|
449 | my $pngName_epo = sprintf ( "%s_EPO_%s_%s.png", $station, $key_ambType, $key_sys );
|
---|
450 | my $chartAMB = Chart::Gnuplot->new(
|
---|
451 | output => $pngName_amb,
|
---|
452 | terminal => 'png',
|
---|
453 | title => $station,
|
---|
454 | ylabel => "Ambiguities $key_ambType [m]",
|
---|
455 |
|
---|
456 | # yrange => [" 0.0 ", " 90.0 "],
|
---|
457 | xlabel => "Time [h]",
|
---|
458 | timeaxis => 'x',
|
---|
459 | xtics => { labelfmt => '%H:%M', rotate => '-270', },
|
---|
460 | legend => { position => "outside right", },
|
---|
461 | grid => 'on',
|
---|
462 | );
|
---|
463 | my $chartEPO = Chart::Gnuplot->new(
|
---|
464 | output => $pngName_epo,
|
---|
465 | terminal => 'png',
|
---|
466 | title => $station,
|
---|
467 | ylabel => "Number of Epochs $key_ambType [-]",
|
---|
468 |
|
---|
469 | # yrange => [" 0.0 ", " 90.0 "],
|
---|
470 | xlabel => "Time [h]",
|
---|
471 | timeaxis => 'x',
|
---|
472 | xtics => { labelfmt => '%H:%M', rotate => '-270', },
|
---|
473 | legend => { position => "outside right", },
|
---|
474 | grid => 'on',
|
---|
475 | );
|
---|
476 |
|
---|
477 | # SATELLITE
|
---|
478 | foreach my $key_sat ( sort keys %{ $AMB{$key_ambType}{$key_sys} } ) {
|
---|
479 |
|
---|
480 | #print "$key_sat = $AMB{$key_ambType}{$key_sys}{$key_sat} \n";
|
---|
481 | # ambiguities
|
---|
482 | my $dataset_amb = Chart::Gnuplot::DataSet->new(
|
---|
483 | xdata => $AMB{$key_ambType}{$key_sys}{$key_sat}{EPOCH}, # array of epochs
|
---|
484 | ydata => $AMB{$key_ambType}{$key_sys}{$key_sat}{DATA}, # array of ambiguities of one satellite
|
---|
485 | title => "$key_sat",
|
---|
486 | timefmt => '%s',
|
---|
487 | style => "points",
|
---|
488 |
|
---|
489 | #style => "points",
|
---|
490 | );
|
---|
491 | push ( @datasets_amb, $dataset_amb );
|
---|
492 |
|
---|
493 | # number of epochs used for ambiguity
|
---|
494 | my $dataset_epo = Chart::Gnuplot::DataSet->new(
|
---|
495 | xdata => $AMB{$key_ambType}{$key_sys}{$key_sat}{EPOCH}, # array of epochs
|
---|
496 | ydata => $AMB{$key_ambType}{$key_sys}{$key_sat}{NUMEPO}, # array of ambiguities of one satellite
|
---|
497 | title => "$key_sat",
|
---|
498 | timefmt => '%s',
|
---|
499 |
|
---|
500 | #style => "points",
|
---|
501 | style => "points",
|
---|
502 | );
|
---|
503 | push ( @datasets_epo, $dataset_epo );
|
---|
504 | }
|
---|
505 |
|
---|
506 | # ambiguities
|
---|
507 | $chartAMB->plot2d(@datasets_amb);
|
---|
508 |
|
---|
509 | # system ("display $pngName_amb&");
|
---|
510 | $y = $y - $dy;
|
---|
511 | if ( $y < 30 / mm ) {
|
---|
512 | $page = $pdf->page();
|
---|
513 | $page->mediabox('A4');
|
---|
514 | $y = $y0;
|
---|
515 | }
|
---|
516 | $png = $page->gfx();
|
---|
517 | LOGDIE("could not find image file: $!\n") unless -e $pngName_amb;
|
---|
518 | $png->image( $pdf->image_png($pngName_amb), $x, $y, $width, $height );
|
---|
519 |
|
---|
520 | # number of epochs used for ambiguity
|
---|
521 | $chartEPO->plot2d(@datasets_epo);
|
---|
522 |
|
---|
523 | # system ("display $pngName_epo&");
|
---|
524 | $y = $y - $dy;
|
---|
525 | if ( $y < 30 / mm ) {
|
---|
526 | $page = $pdf->page();
|
---|
527 | $page->mediabox('A4');
|
---|
528 | $y = $y0;
|
---|
529 | }
|
---|
530 | $png = $page->gfx();
|
---|
531 | LOGDIE("could not find image file $pngName_epo: $!\n") unless -e $pngName_epo;
|
---|
532 | $png->image( $pdf->image_png($pngName_epo), $x, $y, $width, $height );
|
---|
533 | }
|
---|
534 | }
|
---|
535 |
|
---|
536 | ######### ION #####################
|
---|
537 | if ( grep ( $_ eq "ALL", @plotTypes ) ) {
|
---|
538 | DEBUG "Plot ION";
|
---|
539 | $page = $pdf->page();
|
---|
540 | $page->mediabox('A4');
|
---|
541 | $y = $y0 + $dy;
|
---|
542 | $headline = sprintf ( "Ionosphere Delay for station %s", $station );
|
---|
543 | $headline_text = $page->text;
|
---|
544 | $headline_text->font( $font1, 11 / pt );
|
---|
545 | $headline_text->translate( 15 / mm, 280 / mm );
|
---|
546 | $headline_text->text($headline);
|
---|
547 |
|
---|
548 | my $chartION = newChart($station);
|
---|
549 | $chartION->set( ylabel => "Ionophere Delay [m]" );
|
---|
550 | $chartION->set( legend => { position => "outside right" } );
|
---|
551 |
|
---|
552 | # SYSTEM
|
---|
553 | foreach my $ksys ( sort keys %ION ) { #print "$key_sys \n"; #print Dumper $ION{$key_sys};
|
---|
554 | my @datasets; # init datasets
|
---|
555 | my $pngName = sprintf ( "%s_ION_%s.png", $station, $ksys );
|
---|
556 | $chartION->set( output => $pngName );
|
---|
557 |
|
---|
558 | # SATELLITE
|
---|
559 | foreach my $sat ( sort keys %{ $ION{$ksys} } ) { #print "$key_sat = $ION{$key_sys}{$key_sat} \n";
|
---|
560 | my $dataset = Chart::Gnuplot::DataSet->new(
|
---|
561 | xdata => $ION{$ksys}{$sat}{EPOCH}, # array of epochs
|
---|
562 | ydata => $ION{$ksys}{$sat}{DATA}, # array of ionvations of one satellite
|
---|
563 | title => "$sat",
|
---|
564 | timefmt => '%s',
|
---|
565 |
|
---|
566 | #style => " points ",
|
---|
567 | style => "points",
|
---|
568 | );
|
---|
569 | push ( @datasets, $dataset );
|
---|
570 | }
|
---|
571 |
|
---|
572 | $chartION->plot2d(@datasets); #system ("display $pngName&");
|
---|
573 | $y = $y - $dy;
|
---|
574 | if ( $y < 30 / mm ) {
|
---|
575 | $page = $pdf->page();
|
---|
576 | $page->mediabox('A4');
|
---|
577 | $y = $y0;
|
---|
578 | }
|
---|
579 | $png = $page->gfx();
|
---|
580 | die ("could not find image file: $!") unless -e $pngName;
|
---|
581 | $png->image( $pdf->image_png($pngName), $x, $y, $width, $height );
|
---|
582 | }
|
---|
583 | }
|
---|
584 |
|
---|
585 | ######### BIAS #####################
|
---|
586 | if ( grep ( $_ eq "ALL", @plotTypes ) ) {
|
---|
587 | DEBUG "Plot BIAS";
|
---|
588 | $page = $pdf->page();
|
---|
589 | $page->mediabox('A4');
|
---|
590 | $y = $y0 + $dy;
|
---|
591 | $headline = sprintf ( "Receiver Biases for station %s", $station );
|
---|
592 | $headline_text = $page->text;
|
---|
593 | $headline_text->font( $font1, 11 / pt );
|
---|
594 | $headline_text->translate( 15 / mm, 280 / mm );
|
---|
595 | $headline_text->text($headline);
|
---|
596 |
|
---|
597 | my $chartBIAS = newChart($station);
|
---|
598 | $chartBIAS->set( legend => { position => "outside right" } );
|
---|
599 |
|
---|
600 | # BIAS_TYPE #print Dumper \%BIA;
|
---|
601 | foreach my $key_biasType ( sort keys %BIA ) { #print "key_biasType: $key_biasType \n";
|
---|
602 | foreach my $key_sys ( sort keys %{ $BIA{$key_biasType} } ) {
|
---|
603 |
|
---|
604 | #print "key_sys: $key_sys \n"; #print Dumper $BIA{$key_biasType};
|
---|
605 | my @datasets; # init datasets
|
---|
606 | my $pngName = sprintf ( "%s_BIAS_%s_%s.png", $station, $key_biasType, $key_sys );
|
---|
607 | $chartBIAS->set( output => $pngName );
|
---|
608 | $chartBIAS->set( ylabel => "Receiver Bias $key_biasType [m]" );
|
---|
609 |
|
---|
610 | my $dataset =
|
---|
611 | Chart::Gnuplot::DataSet->new(
|
---|
612 | xdata => $BIA{$key_biasType}{$key_sys}{EPOCH},
|
---|
613 | ydata => $BIA{$key_biasType}{$key_sys}{DATA},
|
---|
614 | title => "$key_sys",
|
---|
615 | timefmt => '%s',
|
---|
616 | style => "points",
|
---|
617 | );
|
---|
618 | push ( @datasets, $dataset );
|
---|
619 |
|
---|
620 | $chartBIAS->plot2d(@datasets);
|
---|
621 | $y = $y - $dy;
|
---|
622 | if ( $y < 30 / mm ) {
|
---|
623 | $page = $pdf->page();
|
---|
624 | $page->mediabox('A4');
|
---|
625 | $y = $y0;
|
---|
626 | }
|
---|
627 | $png = $page->gfx();
|
---|
628 | die ("could not find image file: $!") unless -e $pngName;
|
---|
629 | $png->image( $pdf->image_png($pngName), $x, $y, $width, $height );
|
---|
630 | }
|
---|
631 | }
|
---|
632 | }
|
---|
633 |
|
---|
634 | ######### RES #####################
|
---|
635 | DEBUG "Plot Residuals";
|
---|
636 | $page = $pdf->page();
|
---|
637 | $page->mediabox('A4');
|
---|
638 | $y = $y0 + $dy;
|
---|
639 | $headline = sprintf ( "Residuals for station %s", $station );
|
---|
640 | $headline_text = $page->text;
|
---|
641 | $headline_text->font( $font1, 11 / pt );
|
---|
642 | $headline_text->translate( 15 / mm, 280 / mm );
|
---|
643 | $headline_text->text($headline);
|
---|
644 |
|
---|
645 | my $chartRES = newChart($station);
|
---|
646 | $chartRES->set( legend => { position => "outside right" } );
|
---|
647 |
|
---|
648 | # RESIDUAL_TYPE #print Dumper \%RES;
|
---|
649 | foreach my $key_resType ( sort keys %RES ) { #print "key_resType: $key_resType \n";
|
---|
650 | #SYSTEM
|
---|
651 | foreach my $key_sys ( sort keys %{ $RES{$key_resType} } ) {
|
---|
652 |
|
---|
653 | #print "key_sys: $key_sys \n"; #print Dumper $RES{$key_resType};
|
---|
654 | my @datasets;
|
---|
655 | my $pngName = sprintf ( "%s_RES_%s_%s.png", $station, $key_resType, $key_sys );
|
---|
656 | $chartRES->set( output => $pngName );
|
---|
657 | $chartRES->set( ylabel => "Residuals $key_resType [m]" );
|
---|
658 |
|
---|
659 | if ( $key_resType =~ /^c/ ) {
|
---|
660 | $chartRES->set( yrange => [ " -6.0 ", " 6.0 " ] );
|
---|
661 | }
|
---|
662 | elsif ( $key_resType =~ /^l/ ) {
|
---|
663 | $chartRES->set( yrange => [ " -0.06 ", " 0.06 " ] );
|
---|
664 | }
|
---|
665 |
|
---|
666 | elsif ( $key_resType =~ /^GIM/ ) {
|
---|
667 | $chartRES->set( yrange => [ " -6.0 ", " 6.0 " ] );
|
---|
668 | }
|
---|
669 |
|
---|
670 | # SATELLITE
|
---|
671 | foreach my $key_sat ( sort keys %{ $RES{$key_resType}{$key_sys} } ) {
|
---|
672 |
|
---|
673 | #print "$key_sat = $RES{$key_resType}{$key_sys}{$key_sat} \n";
|
---|
674 | $dataset = Chart::Gnuplot::DataSet->new(
|
---|
675 | xdata => $RES{$key_resType}{$key_sys}{$key_sat}{EPOCH}, # array of epochs
|
---|
676 | ydata => $RES{$key_resType}{$key_sys}{$key_sat}{DATA}, # array of residuals of one satellite
|
---|
677 | title => "$key_sat",
|
---|
678 | timefmt => '%s',
|
---|
679 | style => "points",
|
---|
680 | );
|
---|
681 | push ( @datasets, $dataset );
|
---|
682 | }
|
---|
683 | $chartRES->plot2d(@datasets);
|
---|
684 | $y = $y - $dy;
|
---|
685 | if ( $y < 30 / mm ) {
|
---|
686 | $page = $pdf->page();
|
---|
687 | $page->mediabox('A4');
|
---|
688 | $y = $y0;
|
---|
689 | }
|
---|
690 | $png = $page->gfx();
|
---|
691 | LOGDIE("could not find image file: $!\n") unless -e $pngName;
|
---|
692 | $png->image( $pdf->image_png($pngName), $x, $y, $width, $height );
|
---|
693 | }
|
---|
694 | }
|
---|
695 | } # end if ALL @plotTypes
|
---|
696 |
|
---|
697 | $pdf->save();
|
---|
698 | $pdf->end();
|
---|
699 |
|
---|
700 | system ("rm *.png");
|
---|
701 | if (Common::amInteractiv ) {
|
---|
702 | system ("evince $inputDir/$pdf_name");
|
---|
703 | }
|
---|
704 | } # ----- next logfile -----
|
---|
705 |
|
---|
706 | # newChart returns a default chart.
|
---|
707 | sub newChart {
|
---|
708 | my $title = shift;
|
---|
709 | return Chart::Gnuplot->new(
|
---|
710 | terminal => 'png',
|
---|
711 | title => $title,
|
---|
712 | xlabel => "Time [h]",
|
---|
713 | timeaxis => 'x',
|
---|
714 | xtics => { labelfmt => '%H:%M', rotate => '-270' },
|
---|
715 | grid => 'on',
|
---|
716 | );
|
---|
717 | }
|
---|
718 |
|
---|
719 | sub HELP_MESSAGE {
|
---|
720 | print <<EOI_HILFE;
|
---|
721 | $prog - plot BNC's PPP results using gnuplot
|
---|
722 |
|
---|
723 | USAGE:
|
---|
724 | $prog [OPTIONS]
|
---|
725 |
|
---|
726 | OPTIONS:
|
---|
727 | -p, --plotTypes ALL or NEU (default)
|
---|
728 | -l, --logFiles comma separated list of BNC's PPP logfiles
|
---|
729 | -s, --sampling sampling interval in seconds for the logfile data (default: 1); for a daily logfile <30> seconds should be usefull
|
---|
730 | -h, --help show help contents
|
---|
731 |
|
---|
732 | EXAMPLES:
|
---|
733 | $prog --plotTypes ALL -s 30 -l /path/to/FFMJ186730.ppp
|
---|
734 |
|
---|
735 | 2021 andrea.stuerze\@bkg.bund.de
|
---|
736 | EOI_HILFE
|
---|
737 | exit;
|
---|
738 | }
|
---|