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