source: ntrip/trunk/BNC/scripts/pppPlot.pl@ 9910

Last change on this file since 9910 was 9910, checked in by stuerze, 17 months ago

ppp plot script updated

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