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