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

Last change on this file since 10233 was 10233, checked in by stuerze, 4 months ago

minor changes

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