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

Last change on this file since 10385 was 10385, checked in by stuerze, 7 weeks ago

changes regarding PPP

  • Property svn:executable set to *
  • Property svn:keywords set to Header
File size: 29.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 10385 2024-03-12 09:29:47Z 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 $EPOCH = $file->{'EPOCH'};
109 my $EPOCH_OFF_GLO = $file->{'EPOCH_OFF_GLO'};
110 my $EPOCH_OFF_GAL = $file->{'EPOCH_OFF_GAL'};
111 my $EPOCH_OFF_BDS = $file->{'EPOCH_OFF_BDS'};
112 my $EPOCH_CLK = $file->{'EPOCH_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->{'TRP'} );
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 => $EPOCH,
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 => $EPOCH,
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 => $EPOCH,
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 TRP";
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 => $EPOCH,
197 ydata => $file->{'TRP'},
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 ######### CLK #####################
215 if ( scalar @{ $file->{'CLK'} } < 1 ) {
216 DEBUG "No CLK found";
217 }
218 else {
219 DEBUG "Plot CLK";
220 $pngName = sprintf ( "%s_CLK.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 => $EPOCH,
227 ydata => $file->{'CLK'},
228 title => "Receiver clock",
229 timefmt => '%s',
230 style => "linespoints",
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("could not find image file: $!\n") unless -e $pngName;
242 $png->image( $pdf->image_png($pngName), $x, $y, $width, $height );
243 }
244
245
246 ######### OFF_GLO #####################
247 if ( grep ( $_ eq "ALL", @plotTypes ) ) {
248 if ( scalar @{ $file->{'OFF_GLO'} } < 1 ) {
249 DEBUG "No OFF_GLO found";
250 }
251 else {
252 DEBUG "Plot OFF_GLO";
253 my $pngName = sprintf ( "%s_OFF_R.png", $station );
254 my $chartOFF_GLO = newChart($station);
255 $chartOFF_GLO->set( output => $pngName );
256 $chartOFF_GLO->set( ylabel => "Offset GLONASS [m]" );
257
258 $dataset = Chart::Gnuplot::DataSet->new(
259 #xdata => $EPOCH_OFF_GLO,
260 xdata => $EPOCH,
261 ydata => $file->{'OFF_GLO'},
262 title => "Receiver Offset GLONASS",
263 timefmt => '%s',
264 style => "linespoints",
265 );
266 $chartOFF_GLO->plot2d($dataset); #system ("display $pngName&");
267 $y = $y - $dy;
268
269 if ( $y < 30 / mm ) {
270 $page = $pdf->page();
271 $page->mediabox('A4');
272 $y = $y0;
273 }
274 $png = $page->gfx();
275 LOGDIE("could not find image file: $!\n") unless -e $pngName;
276 $png->image( $pdf->image_png($pngName), $x, $y, $width, $height );
277 }
278 }
279
280 ######### OFF_GAL #####################
281 if ( grep ( $_ eq "ALL", @plotTypes ) ) {
282 if ( scalar @{ $file->{'OFF_GAL'} } < 1 ) {
283 DEBUG "No OFF_GAL found";
284 }
285 else {
286 DEBUG "Plot OFF_GAL";
287 my $pngName = sprintf ( "%s_OFF_E.png", $station );
288 my $chartOFF_GAL = newChart($station);
289 $chartOFF_GAL->set( output => $pngName );
290 $chartOFF_GAL->set( ylabel => "Offset Galileo [m]" );
291
292 $dataset = Chart::Gnuplot::DataSet->new(
293 #xdata => $EPOCH_OFF_GAL,
294 xdata => $EPOCH,
295 ydata => $file->{'OFF_GAL'},
296 title => "Receiver Offset Galileo",
297 timefmt => '%s',
298 style => "linespoints",
299 );
300 $chartOFF_GAL->plot2d($dataset); #system ("display $pngName&");
301 $y = $y - $dy;
302
303 if ( $y < 30 / mm ) {
304 $page = $pdf->page();
305 $page->mediabox('A4');
306 $y = $y0;
307 }
308 $png = $page->gfx();
309 LOGDIE("could not find image file: $!\n") unless -e $pngName;
310 $png->image( $pdf->image_png($pngName), $x, $y, $width, $height );
311 }
312 }
313
314 ######### OFF_BDS #####################
315 if ( grep ( $_ eq "ALL", @plotTypes ) ) {
316 if ( scalar @{ $file->{'OFF_BDS'} } < 1 ) {
317 DEBUG "No OFF_BDS found";
318 }
319 else {
320 DEBUG "Plot OFF_BDS";
321 my $pngName = sprintf ( "%s_OFF_C.png", $station );
322 my $chartOFF_BDS = newChart($station);
323 $chartOFF_BDS->set( output => $pngName );
324 $chartOFF_BDS->set( ylabel => "Offset Beidou [m]" );
325
326 $dataset = Chart::Gnuplot::DataSet->new(
327 #xdata => $EPOCH_OFF_BDS,
328 xdata => $EPOCH,
329 ydata => $file->{'OFF_BDS'},
330 title => "Receiver Offset Beidou",
331 timefmt => '%s',
332 style => "linespoints",
333 );
334 $chartOFF_BDS->plot2d($dataset); #system ("display $pngName&");
335 $y = $y - $dy;
336
337 if ( $y < 30 / mm ) {
338 $page = $pdf->page();
339 $page->mediabox('A4');
340 $y = $y0;
341 }
342 $png = $page->gfx();
343 LOGDIE("could not find image file: $!\n") unless -e $pngName;
344 $png->image( $pdf->image_png($pngName), $x, $y, $width, $height );
345 }
346 }
347
348 ######### ELE #####################
349 DEBUG "Plot Elevations";
350 $page = $pdf->page();
351 $page->mediabox('A4');
352 $y = $y0 + $dy;
353 $headline = sprintf ( "Satellite Elevations for station %s", $station );
354 $headline_text = $page->text;
355 $headline_text->font( $font1, 11 / pt );
356 $headline_text->translate( 15 / mm, 280 / mm );
357 $headline_text->text($headline);
358
359 my $chartELE = newChart($station);
360 $chartELE->set( legend => { position => "outside right" } );
361
362 # SYSTEM #print Dumper \%ELE;
363 foreach my $key_sys ( sort keys %ELE ) {
364
365 # print "$key_sys \n";# print Dumper $ELE{$key_sys};
366 my @datasets = (); # init datasets
367 my $pngName = sprintf ( "%s_ELE_%s.png", $station, $key_sys );
368 $chartELE->set( output => $pngName );
369 $chartELE->set( ylabel => "Elevation [°]", yrange => [ " 0.0 ", " 90.0 " ] );
370
371 # SATELLITE
372 foreach my $key_sat ( sort keys %{ $ELE{$key_sys} } ) {
373
374 # print "$key_sat = $ELE{$key_sys}{$key_sat} \n";
375 $dataset = Chart::Gnuplot::DataSet->new(
376 xdata => \@{ $ELE{$key_sys}{$key_sat}{EPOCH} }, # array of epochs
377 ydata => \@{ $ELE{$key_sys}{$key_sat}{DATA} }, # array of elevations of one satellite
378 title => "$key_sat",
379 timefmt => '%s',
380
381 #style => "points",
382 style => "points",
383 );
384 push ( @datasets, $dataset );
385 }
386 $chartELE->plot2d(@datasets);
387
388 # system ("display $pngName&");
389 $y = $y - $dy;
390 if ( $y < 30 / mm ) {
391 $page = $pdf->page();
392 $page->mediabox('A4');
393 $y = $y0;
394 }
395 $png = $page->gfx();
396 die ("could not find image file: $!") unless -e $pngName;
397 $png->image( $pdf->image_png($pngName), $x, $y, $width, $height );
398 }
399
400 ######### AMB #####################
401 DEBUG "Plot Ambiguities";
402 $page = $pdf->page();
403 $page->mediabox('A4');
404 $y = $y0 + $dy;
405 $headline = sprintf ( "Ambiguities for station %s", $station );
406 $headline_text = $page->text;
407 $headline_text->font( $font1, 11 / pt );
408 $headline_text->translate( 15 / mm, 280 / mm );
409 $headline_text->text($headline);
410
411 # AMBIGUITY_TYPE #print Dumper \%AMB;
412 foreach my $key_ambType (%AMB) { #print "$key_ambType \n";
413 foreach my $key_sys ( sort keys %{ $AMB{$key_ambType} } ) {
414
415 #print "$key_sys \n"; print Dumper $AMB{$key_ambType};
416 my ( @datasets_amb, @datasets_epo ); # init datasets
417 my $pngName_amb = sprintf ( "%s_AMB_%s_%s.png", $station, $key_ambType, $key_sys );
418 my $pngName_epo = sprintf ( "%s_EPO_%s_%s.png", $station, $key_ambType, $key_sys );
419 my $chartAMB = Chart::Gnuplot->new(
420 output => $pngName_amb,
421 terminal => 'png',
422 title => $station,
423 ylabel => "Ambiguities $key_ambType [m]",
424
425 # yrange => [" 0.0 ", " 90.0 "],
426 xlabel => "Time [h]",
427 timeaxis => 'x',
428 xtics => { labelfmt => '%H:%M', rotate => '-270', },
429 legend => { position => "outside right", },
430 grid => 'on',
431 );
432 my $chartEPO = Chart::Gnuplot->new(
433 output => $pngName_epo,
434 terminal => 'png',
435 title => $station,
436 ylabel => "Number of Epochs $key_ambType [-]",
437
438 # yrange => [" 0.0 ", " 90.0 "],
439 xlabel => "Time [h]",
440 timeaxis => 'x',
441 xtics => { labelfmt => '%H:%M', rotate => '-270', },
442 legend => { position => "outside right", },
443 grid => 'on',
444 );
445
446 # SATELLITE
447 foreach my $key_sat ( sort keys %{ $AMB{$key_ambType}{$key_sys} } ) {
448
449 #print "$key_sat = $AMB{$key_ambType}{$key_sys}{$key_sat} \n";
450 # ambiguities
451 my $dataset_amb = 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}{DATA}, # array of ambiguities of one satellite
454 title => "$key_sat",
455 timefmt => '%s',
456 style => "points",
457
458 #style => "points",
459 );
460 push ( @datasets_amb, $dataset_amb );
461
462 # number of epochs used for ambiguity
463 my $dataset_epo = Chart::Gnuplot::DataSet->new(
464 xdata => $AMB{$key_ambType}{$key_sys}{$key_sat}{EPOCH}, # array of epochs
465 ydata => $AMB{$key_ambType}{$key_sys}{$key_sat}{NUMEPO}, # array of ambiguities of one satellite
466 title => "$key_sat",
467 timefmt => '%s',
468
469 #style => "points",
470 style => "points",
471 );
472 push ( @datasets_epo, $dataset_epo );
473 }
474
475 # ambiguities
476 $chartAMB->plot2d(@datasets_amb);
477
478 # system ("display $pngName_amb&");
479 $y = $y - $dy;
480 if ( $y < 30 / mm ) {
481 $page = $pdf->page();
482 $page->mediabox('A4');
483 $y = $y0;
484 }
485 $png = $page->gfx();
486 LOGDIE("could not find image file: $!\n") unless -e $pngName_amb;
487 $png->image( $pdf->image_png($pngName_amb), $x, $y, $width, $height );
488
489 # number of epochs used for ambiguity
490 $chartEPO->plot2d(@datasets_epo);
491
492 # system ("display $pngName_epo&");
493 $y = $y - $dy;
494 if ( $y < 30 / mm ) {
495 $page = $pdf->page();
496 $page->mediabox('A4');
497 $y = $y0;
498 }
499 $png = $page->gfx();
500 LOGDIE("could not find image file $pngName_epo: $!\n") unless -e $pngName_epo;
501 $png->image( $pdf->image_png($pngName_epo), $x, $y, $width, $height );
502 }
503 }
504
505 ######### ION #####################
506 if ( grep ( $_ eq "ALL", @plotTypes ) ) {
507 DEBUG "Plot ION";
508 $page = $pdf->page();
509 $page->mediabox('A4');
510 $y = $y0 + $dy;
511 $headline = sprintf ( "Ionosphere Delay for station %s", $station );
512 $headline_text = $page->text;
513 $headline_text->font( $font1, 11 / pt );
514 $headline_text->translate( 15 / mm, 280 / mm );
515 $headline_text->text($headline);
516
517 my $chartION = newChart($station);
518 $chartION->set( ylabel => "Ionophere Delay [m]" );
519 $chartION->set( legend => { position => "outside right" } );
520
521 # SYSTEM
522 foreach my $ksys ( sort keys %ION ) { #print "$key_sys \n"; #print Dumper $ION{$key_sys};
523 my @datasets; # init datasets
524 my $pngName = sprintf ( "%s_ION_%s.png", $station, $ksys );
525 $chartION->set( output => $pngName );
526
527 # SATELLITE
528 foreach my $sat ( sort keys %{ $ION{$ksys} } ) { #print "$key_sat = $ION{$key_sys}{$key_sat} \n";
529 my $dataset = Chart::Gnuplot::DataSet->new(
530 xdata => $ION{$ksys}{$sat}{EPOCH}, # array of epochs
531 ydata => $ION{$ksys}{$sat}{DATA}, # array of ionvations of one satellite
532 title => "$sat",
533 timefmt => '%s',
534
535 #style => " points ",
536 style => "points",
537 );
538 push ( @datasets, $dataset );
539 }
540
541 $chartION->plot2d(@datasets); #system ("display $pngName&");
542 $y = $y - $dy;
543 if ( $y < 30 / mm ) {
544 $page = $pdf->page();
545 $page->mediabox('A4');
546 $y = $y0;
547 }
548 $png = $page->gfx();
549 die ("could not find image file: $!") unless -e $pngName;
550 $png->image( $pdf->image_png($pngName), $x, $y, $width, $height );
551 }
552 }
553
554 ######### BIAS #####################
555 if ( grep ( $_ eq "ALL", @plotTypes ) ) {
556 DEBUG "Plot BIAS";
557 $page = $pdf->page();
558 $page->mediabox('A4');
559 $y = $y0 + $dy;
560 $headline = sprintf ( "Receiver Biases for station %s", $station );
561 $headline_text = $page->text;
562 $headline_text->font( $font1, 11 / pt );
563 $headline_text->translate( 15 / mm, 280 / mm );
564 $headline_text->text($headline);
565
566 my $chartBIAS = newChart($station);
567 $chartBIAS->set( legend => { position => "outside right" } );
568
569 # BIAS_TYPE #print Dumper \%BIA;
570 foreach my $key_biasType ( sort keys %BIA ) { #print "key_biasType: $key_biasType \n";
571 foreach my $key_sys ( sort keys %{ $BIA{$key_biasType} } ) {
572
573 #print "key_sys: $key_sys \n"; #print Dumper $BIA{$key_biasType};
574 my @datasets; # init datasets
575 my $pngName = sprintf ( "%s_BIAS_%s_%s.png", $station, $key_biasType, $key_sys );
576 $chartBIAS->set( output => $pngName );
577 $chartBIAS->set( ylabel => "Receiver Bias $key_biasType [m]" );
578
579 my $dataset =
580 Chart::Gnuplot::DataSet->new(
581 xdata => $BIA{$key_biasType}{$key_sys}{EPOCH},
582 ydata => $BIA{$key_biasType}{$key_sys}{DATA},
583 title => "$key_sys",
584 timefmt => '%s',
585 style => "points",
586 );
587 push ( @datasets, $dataset );
588
589 $chartBIAS->plot2d(@datasets);
590 $y = $y - $dy;
591 if ( $y < 30 / mm ) {
592 $page = $pdf->page();
593 $page->mediabox('A4');
594 $y = $y0;
595 }
596 $png = $page->gfx();
597 die ("could not find image file: $!") unless -e $pngName;
598 $png->image( $pdf->image_png($pngName), $x, $y, $width, $height );
599 }
600 }
601 }
602
603 ######### RES #####################
604 DEBUG "Plot Residuals";
605 $page = $pdf->page();
606 $page->mediabox('A4');
607 $y = $y0 + $dy;
608 $headline = sprintf ( "Residuals for station %s", $station );
609 $headline_text = $page->text;
610 $headline_text->font( $font1, 11 / pt );
611 $headline_text->translate( 15 / mm, 280 / mm );
612 $headline_text->text($headline);
613
614 my $chartRES = newChart($station);
615 $chartRES->set( legend => { position => "outside right" } );
616
617 # RESIDUAL_TYPE #print Dumper \%RES;
618 foreach my $key_resType ( sort keys %RES ) { #print "key_resType: $key_resType \n";
619 #SYSTEM
620 foreach my $key_sys ( sort keys %{ $RES{$key_resType} } ) {
621
622 #print "key_sys: $key_sys \n"; #print Dumper $RES{$key_resType};
623 my @datasets;
624 my $pngName = sprintf ( "%s_RES_%s_%s.png", $station, $key_resType, $key_sys );
625 $chartRES->set( output => $pngName );
626 $chartRES->set( ylabel => "Residuals $key_resType [m]" );
627
628 if ( $key_resType =~ /^c/ ) {
629 $chartRES->set( yrange => [ " -6.0 ", " 6.0 " ] );
630 }
631 elsif ( $key_resType =~ /^l/ ) {
632 $chartRES->set( yrange => [ " -0.06 ", " 0.06 " ] );
633 }
634
635 elsif ( $key_resType =~ /^GIM/ ) {
636 $chartRES->set( yrange => [ " -6.0 ", " 6.0 " ] );
637 }
638
639 # SATELLITE
640 foreach my $key_sat ( sort keys %{ $RES{$key_resType}{$key_sys} } ) {
641
642 #print "$key_sat = $RES{$key_resType}{$key_sys}{$key_sat} \n";
643 $dataset = Chart::Gnuplot::DataSet->new(
644 xdata => $RES{$key_resType}{$key_sys}{$key_sat}{EPOCH}, # array of epochs
645 ydata => $RES{$key_resType}{$key_sys}{$key_sat}{DATA}, # array of residuals of one satellite
646 title => "$key_sat",
647 timefmt => '%s',
648 style => "points",
649 );
650 push ( @datasets, $dataset );
651 }
652 $chartRES->plot2d(@datasets);
653 $y = $y - $dy;
654 if ( $y < 30 / mm ) {
655 $page = $pdf->page();
656 $page->mediabox('A4');
657 $y = $y0;
658 }
659 $png = $page->gfx();
660 LOGDIE("could not find image file: $!\n") unless -e $pngName;
661 $png->image( $pdf->image_png($pngName), $x, $y, $width, $height );
662 }
663 }
664 } # end if ALL @plotTypes
665
666 $pdf->save();
667 $pdf->end();
668
669 system ("rm *.png");
670 if (Common::amInteractiv ) {
671 system ("evince $inputDir/$pdf_name");
672 }
673} # ----- next logfile -----
674
675# newChart returns a default chart.
676sub newChart {
677 my $title = shift;
678 return Chart::Gnuplot->new(
679 terminal => 'png',
680 title => $title,
681 xlabel => "Time [h]",
682 timeaxis => 'x',
683 xtics => { labelfmt => '%H:%M', rotate => '-270' },
684 grid => 'on',
685 );
686}
687
688sub HELP_MESSAGE {
689 print <<EOI_HILFE;
690$prog - plot BNC's PPP results using gnuplot
691
692USAGE:
693 $prog [OPTIONS]
694
695OPTIONS:
696 -p, --plotTypes ALL or NEU (default)
697 -l, --logFiles comma separated list of BNC's PPP logfiles
698 -s, --sampling sampling interval in seconds for the logfile data (default: 1); for a daily logfile <30> seconds should be usefull
699 -h, --help show help contents
700
701EXAMPLES:
702 $prog --plotTypes ALL -s 30 -l /path/to/FFMJ186730.ppp
703
7042021 andrea.stuerze\@bkg.bund.de
705EOI_HILFE
706 exit;
707}
Note: See TracBrowser for help on using the repository browser.