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 10589 2024-12-12 11:15:30Z 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 %RECCLK = %{ $file->{'RECCLK'} };
|
---|
110 | my %AMB = %{ $file->{'AMB'} };
|
---|
111 | my %RES = %{ $file->{'RES'} };
|
---|
112 | my %ELE = %{ $file->{'ELE'} };
|
---|
113 | my %ION = %{ $file->{'ION'} };
|
---|
114 | my %BIA = %{ $file->{'BIA'} };
|
---|
115 |
|
---|
116 | # -----------------------------------------------------------------------------
|
---|
117 | # RMS computation
|
---|
118 | # -----------------------------------------------------------------------------
|
---|
119 | my ( $mean, $prms, $median, $min, $max, $adev, $rms_n, $rms_e, $rms_u, $rms_trp );
|
---|
120 | my ( $n, $e, $u, $trp, $str_rms_n, $str_rms_e, $str_rms_u, $str_rms_trp );
|
---|
121 | $n = pdl( $file->{'N'} );
|
---|
122 | ( $mean, $prms, $median, $min, $max, $adev, $rms_n ) = stats($n);
|
---|
123 | $e = pdl( $file->{'E'} );
|
---|
124 | ( $mean, $prms, $median, $min, $max, $adev, $rms_e ) = stats($e);
|
---|
125 | $u = pdl( $file->{'U'} );
|
---|
126 | ( $mean, $prms, $median, $min, $max, $adev, $rms_u ) = stats($u);
|
---|
127 | $trp = pdl( $file->{'TRP'} );
|
---|
128 | ( $mean, $prms, $median, $min, $max, $adev, $rms_trp ) = stats($trp);
|
---|
129 | $str_rms_n = sprintf ( " %.2f ", $rms_n );
|
---|
130 | $str_rms_e = sprintf ( " %.2f ", $rms_e );
|
---|
131 | $str_rms_u = sprintf ( " %.2f ", $rms_u );
|
---|
132 | $str_rms_trp = sprintf ( " %.2f ", $rms_trp );
|
---|
133 | DEBUG("RMS: North: $str_rms_n, East: $str_rms_e, Up: $str_rms_u, TRP: $str_rms_trp");
|
---|
134 |
|
---|
135 | # -----------------------------------------------------------------------------
|
---|
136 | # Plot several data sets
|
---|
137 | # -----------------------------------------------------------------------------
|
---|
138 | my $dataset;
|
---|
139 | ######### NEU #####################
|
---|
140 | DEBUG "Plot NEU";
|
---|
141 | $page = $pdf->page();
|
---|
142 | $page->mediabox('A4');
|
---|
143 | $headline = sprintf ( "PPP results for station %s", $station );
|
---|
144 | $headline_text = $page->text;
|
---|
145 | $headline_text->font( $font1, 11 / pt );
|
---|
146 | $headline_text->translate( 15 / mm, 280 / mm );
|
---|
147 | $headline_text->text($headline);
|
---|
148 | $y = $y0;
|
---|
149 | my $pngNameNEU = sprintf ( "%s_NEU.png", $station );
|
---|
150 | my $chartNEU = newChart($station);
|
---|
151 | $chartNEU->set( output => $pngNameNEU);
|
---|
152 | $chartNEU->set( ylabel => "Displacements [m]", yrange => [ " -0.9 ", " 0.9 " ] );
|
---|
153 |
|
---|
154 | #y2label => "Number of Satellites [-]", y2range => [" 0 ", " 20 "], y2tics => 'on',
|
---|
155 |
|
---|
156 | my $dataN = Chart::Gnuplot::DataSet->new(
|
---|
157 | xdata => $EPOCH,
|
---|
158 | ydata => $file->{'N'},
|
---|
159 | title => "Displacements N, RMS + -$str_rms_n m",
|
---|
160 | timefmt => '%s',
|
---|
161 | style => "linespoints",
|
---|
162 | );
|
---|
163 | my $dataE = Chart::Gnuplot::DataSet->new(
|
---|
164 | xdata => $EPOCH,
|
---|
165 | ydata => $file->{'E'},
|
---|
166 | title => "Displacements E, RMS + -$str_rms_e m",
|
---|
167 | timefmt => '%s',
|
---|
168 | style => "linespoints",
|
---|
169 | );
|
---|
170 | my $dataU = Chart::Gnuplot::DataSet->new(
|
---|
171 | xdata => $EPOCH,
|
---|
172 | ydata => $file->{'U'},
|
---|
173 | title => "Displacements U, RMS + -$str_rms_u m",
|
---|
174 | timefmt => '%s',
|
---|
175 | style => "linespoints",
|
---|
176 | );
|
---|
177 | my @datasets = ( $dataN, $dataE, $dataU );
|
---|
178 | $chartNEU->plot2d(@datasets);
|
---|
179 |
|
---|
180 | $png = $page->gfx();
|
---|
181 | LOGDIE("could not find image file: $!\n") unless -e $pngNameNEU;
|
---|
182 | $png->image( $pdf->image_png($pngNameNEU), $x, $y, $width, $height ); #print "y= : $y \n"
|
---|
183 |
|
---|
184 | ######### TRP #####################
|
---|
185 | if ( grep ( $_ eq "ALL", @plotTypes ) ) {
|
---|
186 | DEBUG "Plot TRP";
|
---|
187 | my $pngNameTRP = sprintf ( "%s_TRP.png", $station );
|
---|
188 | my $chartTRP = newChart($station);
|
---|
189 | $chartTRP->set( output => $pngNameTRP);
|
---|
190 | $chartTRP->set( ylabel => "Tropospheric Delay [m]", yrange => [ " 1.0 ", " 3.0 " ] );
|
---|
191 |
|
---|
192 | my $dataTRP = Chart::Gnuplot::DataSet->new(
|
---|
193 | xdata => $EPOCH,
|
---|
194 | ydata => $file->{'TRP'},
|
---|
195 | title => "Tropospheric Delay, RMS + -$str_rms_trp m",
|
---|
196 | timefmt => '%s',
|
---|
197 | style => "points",
|
---|
198 | );
|
---|
199 | $chartTRP->plot2d($dataTRP);
|
---|
200 | $y = $y - $dy;
|
---|
201 |
|
---|
202 | if ( $y < 30 / mm ) {
|
---|
203 | $page = $pdf->page();
|
---|
204 | $page->mediabox('A4');
|
---|
205 | $y = $y0;
|
---|
206 | }
|
---|
207 | $png = $page->gfx();
|
---|
208 | LOGDIE("could not find image file: $!\n") unless -e $pngNameTRP;
|
---|
209 | $png->image( $pdf->image_png($pngNameTRP), $x, $y, $width, $height );
|
---|
210 |
|
---|
211 | ######### RECCLK #####################
|
---|
212 | DEBUG "Plot Receiver Clocks";
|
---|
213 | $page = $pdf->page();
|
---|
214 | $page->mediabox('A4');
|
---|
215 | $y = $y0 + $dy;
|
---|
216 | $headline = sprintf ( "Receiver Clocks for station %s", $station );
|
---|
217 | $headline_text = $page->text;
|
---|
218 | $headline_text->font( $font1, 11 / pt );
|
---|
219 | $headline_text->translate( 15 / mm, 280 / mm );
|
---|
220 | $headline_text->text($headline);
|
---|
221 |
|
---|
222 | my $chartRECCLK = newChart($station);
|
---|
223 | $chartRECCLK->set( legend => { position => "outside right" } );
|
---|
224 | my @datasets = (); # init datasets
|
---|
225 | my $pngNameRECCLK = sprintf ( "%s_RECCLK.png", $station);
|
---|
226 | $chartRECCLK->set( output => $pngNameRECCLK);
|
---|
227 | $chartRECCLK->set( ylabel => "Receiver Clocks [m]" );
|
---|
228 | # SYSTEM
|
---|
229 | foreach my $key_sys ( sort keys %RECCLK ) {
|
---|
230 |
|
---|
231 | $dataset = Chart::Gnuplot::DataSet->new(
|
---|
232 | xdata => \@{ $RECCLK{$key_sys}{EPOCH} }, # array of epochs
|
---|
233 | ydata => \@{ $RECCLK{$key_sys}{DATA} }, # array of elevations of one satellite
|
---|
234 | title => "$key_sys",
|
---|
235 | timefmt => '%s',
|
---|
236 |
|
---|
237 | #style => "points",
|
---|
238 | style => "points",
|
---|
239 | );
|
---|
240 | push ( @datasets, $dataset );
|
---|
241 | }
|
---|
242 | $chartRECCLK->plot2d(@datasets);
|
---|
243 |
|
---|
244 | # system ("display $pngName&");
|
---|
245 | $y = $y - $dy;
|
---|
246 | if ( $y < 30 / mm ) {
|
---|
247 | $page = $pdf->page();
|
---|
248 | $page->mediabox('A4');
|
---|
249 | $y = $y0;
|
---|
250 | }
|
---|
251 | $png = $page->gfx();
|
---|
252 | die ("could not find image file: $!") unless -e $pngNameRECCLK;
|
---|
253 | $png->image( $pdf->image_png($pngNameRECCLK), $x, $y, $width, $height );
|
---|
254 |
|
---|
255 | ######### ELE #####################
|
---|
256 | DEBUG "Plot Elevations";
|
---|
257 | $page = $pdf->page();
|
---|
258 | $page->mediabox('A4');
|
---|
259 | $y = $y0 + $dy;
|
---|
260 | $headline = sprintf ( "Satellite Elevations for station %s", $station );
|
---|
261 | $headline_text = $page->text;
|
---|
262 | $headline_text->font( $font1, 11 / pt );
|
---|
263 | $headline_text->translate( 15 / mm, 280 / mm );
|
---|
264 | $headline_text->text($headline);
|
---|
265 |
|
---|
266 | my $chartELE = newChart($station);
|
---|
267 | $chartELE->set( legend => { position => "outside right" } );
|
---|
268 |
|
---|
269 | # SYSTEM #print Dumper \%ELE;
|
---|
270 | foreach my $key_sys ( sort keys %ELE ) {
|
---|
271 |
|
---|
272 | # print "$key_sys \n";# print Dumper $ELE{$key_sys};
|
---|
273 | my @datasets = (); # init datasets
|
---|
274 | my $pngNameELE = sprintf ( "%s_ELE_%s.png", $station, $key_sys );
|
---|
275 | $chartELE->set( output => $pngNameELE);
|
---|
276 | $chartELE->set( ylabel => "Elevation [°]", yrange => [ " 0.0 ", " 90.0 " ] );
|
---|
277 |
|
---|
278 | # SATELLITE
|
---|
279 | foreach my $key_sat ( sort keys %{ $ELE{$key_sys} } ) {
|
---|
280 |
|
---|
281 | # print "$key_sat = $ELE{$key_sys}{$key_sat} \n";
|
---|
282 | $dataset = Chart::Gnuplot::DataSet->new(
|
---|
283 | xdata => \@{ $ELE{$key_sys}{$key_sat}{EPOCH} }, # array of epochs
|
---|
284 | ydata => \@{ $ELE{$key_sys}{$key_sat}{DATA} }, # array of elevations of one satellite
|
---|
285 | title => "$key_sat",
|
---|
286 | timefmt => '%s',
|
---|
287 |
|
---|
288 | #style => "points",
|
---|
289 | style => "points",
|
---|
290 | );
|
---|
291 | push ( @datasets, $dataset );
|
---|
292 | }
|
---|
293 | $chartELE->plot2d(@datasets);
|
---|
294 |
|
---|
295 | # system ("display $pngName&");
|
---|
296 | $y = $y - $dy;
|
---|
297 | if ( $y < 30 / mm ) {
|
---|
298 | $page = $pdf->page();
|
---|
299 | $page->mediabox('A4');
|
---|
300 | $y = $y0;
|
---|
301 | }
|
---|
302 | $png = $page->gfx();
|
---|
303 | die ("could not find image file: $!") unless -e $pngNameELE;
|
---|
304 | $png->image( $pdf->image_png($pngNameELE), $x, $y, $width, $height );
|
---|
305 | }
|
---|
306 |
|
---|
307 | ######### AMB #####################
|
---|
308 | DEBUG "Plot Ambiguities";
|
---|
309 | $page = $pdf->page();
|
---|
310 | $page->mediabox('A4');
|
---|
311 | $y = $y0 + $dy;
|
---|
312 | $headline = sprintf ( "Ambiguities for station %s", $station );
|
---|
313 | $headline_text = $page->text;
|
---|
314 | $headline_text->font( $font1, 11 / pt );
|
---|
315 | $headline_text->translate( 15 / mm, 280 / mm );
|
---|
316 | $headline_text->text($headline);
|
---|
317 |
|
---|
318 | # AMBIGUITY_TYPE #print Dumper \%AMB;
|
---|
319 | foreach my $key_ambType (%AMB) { #print "$key_ambType \n";
|
---|
320 | foreach my $key_sys ( sort keys %{ $AMB{$key_ambType} } ) {
|
---|
321 |
|
---|
322 | #print "$key_sys \n"; print Dumper $AMB{$key_ambType};
|
---|
323 | my ( @datasets_amb, @datasets_epo ); # init datasets
|
---|
324 | my $pngNameAMB = sprintf ( "%s_AMB_%s_%s.png", $station, $key_ambType, $key_sys );
|
---|
325 | my $pngNameEPO = sprintf ( "%s_EPO_%s_%s.png", $station, $key_ambType, $key_sys );
|
---|
326 | my $chartAMB = Chart::Gnuplot->new(
|
---|
327 | output => $pngNameAMB,
|
---|
328 | terminal => 'png',
|
---|
329 | title => $station,
|
---|
330 | ylabel => "Ambiguities $key_ambType [m]",
|
---|
331 |
|
---|
332 | # yrange => [" 0.0 ", " 90.0 "],
|
---|
333 | xlabel => "Time [h]",
|
---|
334 | timeaxis => 'x',
|
---|
335 | xtics => { labelfmt => '%H:%M', rotate => '-270', },
|
---|
336 | legend => { position => "outside right", },
|
---|
337 | grid => 'on',
|
---|
338 | );
|
---|
339 | my $chartEPO = Chart::Gnuplot->new(
|
---|
340 | output => $pngNameEPO,
|
---|
341 | terminal => 'png',
|
---|
342 | title => $station,
|
---|
343 | ylabel => "Number of Epochs $key_ambType [-]",
|
---|
344 |
|
---|
345 | # yrange => [" 0.0 ", " 90.0 "],
|
---|
346 | xlabel => "Time [h]",
|
---|
347 | timeaxis => 'x',
|
---|
348 | xtics => { labelfmt => '%H:%M', rotate => '-270', },
|
---|
349 | legend => { position => "outside right", },
|
---|
350 | grid => 'on',
|
---|
351 | );
|
---|
352 |
|
---|
353 | # SATELLITE
|
---|
354 | foreach my $key_sat ( sort keys %{ $AMB{$key_ambType}{$key_sys} } ) {
|
---|
355 |
|
---|
356 | #print "$key_sat = $AMB{$key_ambType}{$key_sys}{$key_sat} \n";
|
---|
357 | # ambiguities
|
---|
358 | my $dataset_amb = Chart::Gnuplot::DataSet->new(
|
---|
359 | xdata => $AMB{$key_ambType}{$key_sys}{$key_sat}{EPOCH}, # array of epochs
|
---|
360 | ydata => $AMB{$key_ambType}{$key_sys}{$key_sat}{DATA}, # array of ambiguities of one satellite
|
---|
361 | title => "$key_sat",
|
---|
362 | timefmt => '%s',
|
---|
363 | style => "points",
|
---|
364 |
|
---|
365 | #style => "points",
|
---|
366 | );
|
---|
367 | push ( @datasets_amb, $dataset_amb );
|
---|
368 |
|
---|
369 | # number of epochs used for ambiguity
|
---|
370 | my $dataset_epo = Chart::Gnuplot::DataSet->new(
|
---|
371 | xdata => $AMB{$key_ambType}{$key_sys}{$key_sat}{EPOCH}, # array of epochs
|
---|
372 | ydata => $AMB{$key_ambType}{$key_sys}{$key_sat}{NUMEPO}, # array of ambiguities of one satellite
|
---|
373 | title => "$key_sat",
|
---|
374 | timefmt => '%s',
|
---|
375 |
|
---|
376 | #style => "points",
|
---|
377 | style => "points",
|
---|
378 | );
|
---|
379 | push ( @datasets_epo, $dataset_epo );
|
---|
380 | }
|
---|
381 |
|
---|
382 | # ambiguities
|
---|
383 | $chartAMB->plot2d(@datasets_amb);
|
---|
384 |
|
---|
385 | # system ("display $pngName_amb&");
|
---|
386 | $y = $y - $dy;
|
---|
387 | if ( $y < 30 / mm ) {
|
---|
388 | $page = $pdf->page();
|
---|
389 | $page->mediabox('A4');
|
---|
390 | $y = $y0;
|
---|
391 | }
|
---|
392 | $png = $page->gfx();
|
---|
393 | LOGDIE("could not find image file: $!\n") unless -e $pngNameAMB;
|
---|
394 | $png->image( $pdf->image_png($pngNameAMB), $x, $y, $width, $height );
|
---|
395 |
|
---|
396 | # number of epochs used for ambiguity
|
---|
397 | $chartEPO->plot2d(@datasets_epo);
|
---|
398 |
|
---|
399 | # system ("display $pngName_epo&");
|
---|
400 | $y = $y - $dy;
|
---|
401 | if ( $y < 30 / mm ) {
|
---|
402 | $page = $pdf->page();
|
---|
403 | $page->mediabox('A4');
|
---|
404 | $y = $y0;
|
---|
405 | }
|
---|
406 | $png = $page->gfx();
|
---|
407 | LOGDIE("could not find image file $pngNameEPO: $!\n") unless -e $pngNameEPO;
|
---|
408 | $png->image( $pdf->image_png($pngNameEPO), $x, $y, $width, $height );
|
---|
409 | }
|
---|
410 | }
|
---|
411 |
|
---|
412 | ######### ION #####################
|
---|
413 | if ( grep ( $_ eq "ALL", @plotTypes ) ) {
|
---|
414 | DEBUG "Plot ION";
|
---|
415 | $page = $pdf->page();
|
---|
416 | $page->mediabox('A4');
|
---|
417 | $y = $y0 + $dy;
|
---|
418 | $headline = sprintf ( "Ionosphere Delay for station %s", $station );
|
---|
419 | $headline_text = $page->text;
|
---|
420 | $headline_text->font( $font1, 11 / pt );
|
---|
421 | $headline_text->translate( 15 / mm, 280 / mm );
|
---|
422 | $headline_text->text($headline);
|
---|
423 |
|
---|
424 | my $chartION = newChart($station);
|
---|
425 | $chartION->set( ylabel => "Ionophere Delay [m]" );
|
---|
426 | $chartION->set( legend => { position => "outside right" } );
|
---|
427 |
|
---|
428 | # SYSTEM
|
---|
429 | foreach my $ksys ( sort keys %ION ) { #print "$key_sys \n"; #print Dumper $ION{$key_sys};
|
---|
430 | my @datasets; # init datasets
|
---|
431 | my $pngNameION = sprintf ( "%s_ION_%s.png", $station, $ksys );
|
---|
432 | $chartION->set( output => $pngNameION);
|
---|
433 |
|
---|
434 | # SATELLITE
|
---|
435 | foreach my $sat ( sort keys %{ $ION{$ksys} } ) { #print "$key_sat = $ION{$key_sys}{$key_sat} \n";
|
---|
436 | my $dataset = Chart::Gnuplot::DataSet->new(
|
---|
437 | xdata => $ION{$ksys}{$sat}{EPOCH}, # array of epochs
|
---|
438 | ydata => $ION{$ksys}{$sat}{DATA}, # array of ionvations of one satellite
|
---|
439 | title => "$sat",
|
---|
440 | timefmt => '%s',
|
---|
441 |
|
---|
442 | #style => " points ",
|
---|
443 | style => "points",
|
---|
444 | );
|
---|
445 | push ( @datasets, $dataset );
|
---|
446 | }
|
---|
447 |
|
---|
448 | $chartION->plot2d(@datasets); #system ("display $pngName&");
|
---|
449 | $y = $y - $dy;
|
---|
450 | if ( $y < 30 / mm ) {
|
---|
451 | $page = $pdf->page();
|
---|
452 | $page->mediabox('A4');
|
---|
453 | $y = $y0;
|
---|
454 | }
|
---|
455 | $png = $page->gfx();
|
---|
456 | die ("could not find image file: $!") unless -e $pngNameION;
|
---|
457 | $png->image( $pdf->image_png($pngNameION), $x, $y, $width, $height );
|
---|
458 | }
|
---|
459 | }
|
---|
460 |
|
---|
461 | ######### BIAS #####################
|
---|
462 | if ( grep ( $_ eq "ALL", @plotTypes ) ) {
|
---|
463 | DEBUG "Plot BIAS";
|
---|
464 | $page = $pdf->page();
|
---|
465 | $page->mediabox('A4');
|
---|
466 | $y = $y0 + $dy;
|
---|
467 | $headline = sprintf ( "Receiver Biases for station %s", $station );
|
---|
468 | $headline_text = $page->text;
|
---|
469 | $headline_text->font( $font1, 11 / pt );
|
---|
470 | $headline_text->translate( 15 / mm, 280 / mm );
|
---|
471 | $headline_text->text($headline);
|
---|
472 |
|
---|
473 | my $chartBIAS = newChart($station);
|
---|
474 | $chartBIAS->set( legend => { position => "outside right" } );
|
---|
475 |
|
---|
476 | # BIAS_TYPE #print Dumper \%BIA;
|
---|
477 | foreach my $key_biasType ( sort keys %BIA ) { #print "key_biasType: $key_biasType \n";
|
---|
478 | foreach my $key_sys ( sort keys %{ $BIA{$key_biasType} } ) {
|
---|
479 |
|
---|
480 | #print "key_sys: $key_sys \n"; #print Dumper $BIA{$key_biasType};
|
---|
481 | my @datasets; # init datasets
|
---|
482 | my $pngNameBIA = sprintf ( "%s_BIAS_%s_%s.png", $station, $key_biasType, $key_sys );
|
---|
483 | $chartBIAS->set( output => $pngNameBIA);
|
---|
484 | $chartBIAS->set( ylabel => "Receiver Bias $key_biasType [m]" );
|
---|
485 |
|
---|
486 | my $dataset =
|
---|
487 | Chart::Gnuplot::DataSet->new(
|
---|
488 | xdata => $BIA{$key_biasType}{$key_sys}{EPOCH},
|
---|
489 | ydata => $BIA{$key_biasType}{$key_sys}{DATA},
|
---|
490 | title => "$key_sys",
|
---|
491 | timefmt => '%s',
|
---|
492 | style => "points",
|
---|
493 | );
|
---|
494 | push ( @datasets, $dataset );
|
---|
495 |
|
---|
496 | $chartBIAS->plot2d(@datasets);
|
---|
497 | $y = $y - $dy;
|
---|
498 | if ( $y < 30 / mm ) {
|
---|
499 | $page = $pdf->page();
|
---|
500 | $page->mediabox('A4');
|
---|
501 | $y = $y0;
|
---|
502 | }
|
---|
503 | $png = $page->gfx();
|
---|
504 | die ("could not find image file: $!") unless -e $pngNameBIA;
|
---|
505 | $png->image( $pdf->image_png($pngNameBIA), $x, $y, $width, $height );
|
---|
506 | }
|
---|
507 | }
|
---|
508 | }
|
---|
509 |
|
---|
510 | ######### RES #####################
|
---|
511 | DEBUG "Plot Residuals";
|
---|
512 | $page = $pdf->page();
|
---|
513 | $page->mediabox('A4');
|
---|
514 | $y = $y0 + $dy;
|
---|
515 | $headline = sprintf ( "Residuals for station %s", $station );
|
---|
516 | $headline_text = $page->text;
|
---|
517 | $headline_text->font( $font1, 11 / pt );
|
---|
518 | $headline_text->translate( 15 / mm, 280 / mm );
|
---|
519 | $headline_text->text($headline);
|
---|
520 |
|
---|
521 | my $chartRES = newChart($station);
|
---|
522 | $chartRES->set( legend => { position => "outside right" } );
|
---|
523 |
|
---|
524 | # RESIDUAL_TYPE #print Dumper \%RES;
|
---|
525 | foreach my $key_resType ( sort keys %RES ) { #print "key_resType: $key_resType \n";
|
---|
526 | #SYSTEM
|
---|
527 | foreach my $key_sys ( sort keys %{ $RES{$key_resType} } ) {
|
---|
528 |
|
---|
529 | #print "key_sys: $key_sys \n"; #print Dumper $RES{$key_resType};
|
---|
530 | my @datasets;
|
---|
531 | my $pngNameRES = sprintf ( "%s_RES_%s_%s.png", $station, $key_resType, $key_sys );
|
---|
532 | $chartRES->set( output => $pngNameRES);
|
---|
533 | $chartRES->set( ylabel => "Residuals $key_resType [m]" );
|
---|
534 |
|
---|
535 | if ( $key_resType =~ /^c/ ) {
|
---|
536 | $chartRES->set( yrange => [ " -6.0 ", " 6.0 " ] );
|
---|
537 | }
|
---|
538 | elsif ( $key_resType =~ /^l/ ) {
|
---|
539 | $chartRES->set( yrange => [ " -0.06 ", " 0.06 " ] );
|
---|
540 | }
|
---|
541 |
|
---|
542 | elsif ( $key_resType =~ /^GIM/ ) {
|
---|
543 | $chartRES->set( yrange => [ " -6.0 ", " 6.0 " ] );
|
---|
544 | }
|
---|
545 |
|
---|
546 | # SATELLITE
|
---|
547 | foreach my $key_sat ( sort keys %{ $RES{$key_resType}{$key_sys} } ) {
|
---|
548 |
|
---|
549 | #print "$key_sat = $RES{$key_resType}{$key_sys}{$key_sat} \n";
|
---|
550 | $dataset = Chart::Gnuplot::DataSet->new(
|
---|
551 | xdata => $RES{$key_resType}{$key_sys}{$key_sat}{EPOCH}, # array of epochs
|
---|
552 | ydata => $RES{$key_resType}{$key_sys}{$key_sat}{DATA}, # array of residuals of one satellite
|
---|
553 | title => "$key_sat",
|
---|
554 | timefmt => '%s',
|
---|
555 | style => "points",
|
---|
556 | );
|
---|
557 | push ( @datasets, $dataset );
|
---|
558 | }
|
---|
559 | $chartRES->plot2d(@datasets);
|
---|
560 | $y = $y - $dy;
|
---|
561 | if ( $y < 30 / mm ) {
|
---|
562 | $page = $pdf->page();
|
---|
563 | $page->mediabox('A4');
|
---|
564 | $y = $y0;
|
---|
565 | }
|
---|
566 | $png = $page->gfx();
|
---|
567 | LOGDIE("could not find image file: $!\n") unless -e $pngNameRES;
|
---|
568 | $png->image( $pdf->image_png($pngNameRES), $x, $y, $width, $height );
|
---|
569 | }
|
---|
570 | }
|
---|
571 | } # end if ALL @plotTypes
|
---|
572 |
|
---|
573 | $pdf->save();
|
---|
574 | $pdf->end();
|
---|
575 |
|
---|
576 | # system ("rm *.png");
|
---|
577 | if (Common::amInteractiv ) {
|
---|
578 | system ("evince $inputDir/$pdf_name");
|
---|
579 | }
|
---|
580 | } # ----- next logfile -----
|
---|
581 |
|
---|
582 | # newChart returns a default chart.
|
---|
583 | sub newChart {
|
---|
584 | my $title = shift;
|
---|
585 | return Chart::Gnuplot->new(
|
---|
586 | terminal => 'png',
|
---|
587 | title => $title,
|
---|
588 | xlabel => "Time [h]",
|
---|
589 | timeaxis => 'x',
|
---|
590 | xtics => { labelfmt => '%H:%M', rotate => '-270' },
|
---|
591 | grid => 'on',
|
---|
592 | );
|
---|
593 | }
|
---|
594 |
|
---|
595 | sub HELP_MESSAGE {
|
---|
596 | print <<EOI_HILFE;
|
---|
597 | $prog - plot BNC's PPP results using gnuplot
|
---|
598 |
|
---|
599 | USAGE:
|
---|
600 | $prog [OPTIONS]
|
---|
601 |
|
---|
602 | OPTIONS:
|
---|
603 | -p, --plotTypes ALL or NEU (default)
|
---|
604 | -l, --logFiles comma separated list of BNC's PPP logfiles
|
---|
605 | -s, --sampling sampling interval in seconds for the logfile data (default: 1); for a daily logfile <30> seconds should be usefull
|
---|
606 | -h, --help show help contents
|
---|
607 |
|
---|
608 | EXAMPLES:
|
---|
609 | $prog --plotTypes ALL -s 30 -l /path/to/FFMJ186730.ppp
|
---|
610 |
|
---|
611 | 2021 andrea.stuerze\@bkg.bund.de
|
---|
612 | EOI_HILFE
|
---|
613 | exit;
|
---|
614 | }
|
---|