Index: trunk/BNC/scripts/Bnc.pm
===================================================================
--- trunk/BNC/scripts/Bnc.pm	(revision 10089)
+++ trunk/BNC/scripts/Bnc.pm	(revision 10090)
@@ -71,6 +71,7 @@
 # Parse Message-Types with repetition rate from a BNC/scanRTCM logfile
 #
-# Param  : $logfile     [required] Path to the BNC-logfile.
+# Param  : $logfile     [required] Path of the BNC/scanRTCM logfile
 #          $caAbbr      [optional] caster name or abbreviation
+#          $tmpPath     [optional] write working files to this path
 #
 # Return : Message-types for each mountpoint (as Hash-Ref)
@@ -304,4 +305,5 @@
             my @mpts_def = ();
             foreach (@mpts) {
+
                 #  user:passwd@igs-ip.net:2101/ASPA0 RTCM_3.0 ASM -14.33 189.28 no 1
                 if ( $_ =~
@@ -491,12 +493,8 @@
     my $epochSec     = 0;
     my $epochDiff    = 0;
-    my (
-         @hlp,    @EPOCHs,   @N,        @E,       @U,
-         %SATNUM, @TRPs,
-         @CLKs,   @OFF_GLOs, @OFF_GALs, @OFF_BDSs,
-    );
+    my ( @hlp, @EPOCHs, @N, @E, @U, %SATNUM, @TRPs, @CLKs, @OFF_GLOs, @OFF_GALs, @OFF_BDSs, );
     my ( @EPOCHs_CLK, @EPOCHs_OFF_GLO, @EPOCHs_OFF_GAL, @EPOCHs_OFF_BDS );
-    my ( %AMB,          %RES,          %ELE, %ION, %BIA );
-    my ( $station,      $lki,          $sys, $sat, $amb );
+    my ( %AMB,        %RES,            %ELE,            %ION, %BIA );
+    my ( $station,    $lki,            $sys,            $sat, $amb );
     open ( my $fh, "<", $file ) || LOGDIE "Could not open file $file: $!\n";
 
@@ -515,5 +513,5 @@
             # PPP of Epoch 2015-08-27_14:00:15.000
             if ( $ln =~ /PPP of Epoch (\d{4}-\d{2}-\d{2}_\d{2}:\d{2}:\d{2})\.\d+/ ) {
-                $epo       = $1;              #print "$epo\n";
+                $epo = $1;    #print "$epo\n";
             }
             else { ERROR "strange line: \"$ln\""; next }
@@ -535,5 +533,5 @@
             $old_epochSec = $epochSec;
 
-            #2015-08-27_13:59:50.000 DIEP1 X = 3842152.9054 +- 0.0242 Y = 563402.0331 +- 0.0176 Z = 5042888.5182 +- 0.0319 dN = 0.0130 +- 0.0193 dE = -0.0032 +- 0.0178 dU = -0.0248 +- 0.0349
+#2015-08-27_13:59:50.000 DIEP1 X = 3842152.9054 +- 0.0242 Y = 563402.0331 +- 0.0176 Z = 5042888.5182 +- 0.0319 dN = 0.0130 +- 0.0193 dE = -0.0032 +- 0.0178 dU = -0.0248 +- 0.0349
             $station = $hlp[1];
 
@@ -547,16 +545,18 @@
         }
         elsif ( ( $ln =~ /\bAMB\b/ ) && ( $ln !~ /RESET/ ) ) {
-              # 2015-08... AMB lIF G04 253.0000 -8.9924 +- 1.7825 el = 22.03 epo = 86
-              $lki = $hlp[2];
-              $sat = $hlp[3];
-              $sys = substr ( $sat, 0, 1 );
-              $amb = $hlp[4] + $hlp[5];
-              push @{ $AMB{$lki}{$sys}{$sat}{EPOCH} },  $epochSec;
-              push @{ $AMB{$lki}{$sys}{$sat}{DATA} },   $amb;
-              push @{ $AMB{$lki}{$sys}{$sat}{NUMEPO} }, $hlp[13];
-              push @{ $ELE{$sys}{$sat}{EPOCH} }, $epochSec;
-              push @{ $ELE{$sys}{$sat}{DATA} },  $hlp[10];
+
+            # 2015-08... AMB lIF G04 253.0000 -8.9924 +- 1.7825 el = 22.03 epo = 86
+            $lki = $hlp[2];
+            $sat = $hlp[3];
+            $sys = substr ( $sat, 0, 1 );
+            $amb = $hlp[4] + $hlp[5];
+            push @{ $AMB{$lki}{$sys}{$sat}{EPOCH} },  $epochSec;
+            push @{ $AMB{$lki}{$sys}{$sat}{DATA} },   $amb;
+            push @{ $AMB{$lki}{$sys}{$sat}{NUMEPO} }, $hlp[13];
+            push @{ $ELE{$sys}{$sat}{EPOCH} }, $epochSec;
+            push @{ $ELE{$sys}{$sat}{DATA} },  $hlp[10];
         }
         elsif ( $ln =~ /\bRES\b/ && $ln !~ /Neglected/ ) {
+
             # 2015-08... RES lIF G30  -0.0076
             $sat = $hlp[3];
@@ -588,20 +588,20 @@
             push ( @CLKs,       $hlp[2] + $hlp[3] );
         }
-        elsif ( $ln =~ /\bOFF_GLO\b/ ) {                # 2015-08... OFF_GLO 52.6806 -3.8042 +- 9.0077
+        elsif ( $ln =~ /\bOFF_GLO\b/ ) {    # 2015-08... OFF_GLO 52.6806 -3.8042 +- 9.0077
             push ( @EPOCHs_OFF_GLO, $epochSec );
             push ( @OFF_GLOs,       $hlp[2] + $hlp[3] );
         }
-        elsif ( $ln =~ /\bOFF_GAL\b/ ) {                # 2015-08... OFF_GAL 52.6806 -3.8042 +- 9.0077
+        elsif ( $ln =~ /\bOFF_GAL\b/ ) {    # 2015-08... OFF_GAL 52.6806 -3.8042 +- 9.0077
             push ( @EPOCHs_OFF_GAL, $epochSec );
             push ( @OFF_GALs,       $hlp[2] + $hlp[3] );
         }
-        elsif ( $ln =~ /\bOFF_BDS\b/ ) {                # 2015-08... OFF_BDS 52.6806 -3.8042 +- 9.0077
+        elsif ( $ln =~ /\bOFF_BDS\b/ ) {    # 2015-08... OFF_BDS 52.6806 -3.8042 +- 9.0077
             push ( @EPOCHs_OFF_BDS, $epochSec );
             push ( @OFF_BDSs,       $hlp[2] + $hlp[3] );
         }
-        elsif ( $ln =~ /\bSATNUM\b/ ) {                 # 2015-09... SATNUM G  8
+        elsif ( $ln =~ /\bSATNUM\b/ ) {     # 2015-09... SATNUM G  8
             push ( @{ $SATNUM{ $hlp[2] } }, $hlp[3] );
         }
-        elsif ( $ln =~ /\bTRP\b/ ) {                    # 2015-08... TRP  2.3803 +0.1009 +- 0.0324
+        elsif ( $ln =~ /\bTRP\b/ ) {        # 2015-08... TRP  2.3803 +0.1009 +- 0.0324
             push ( @TRPs, $hlp[2] + $hlp[3] );
         }
@@ -612,5 +612,5 @@
 
     my $nof_epochs = scalar @EPOCHs;
-    DEBUG(   "epochs:$nof_epochs, North displac.: "
+    DEBUG(   "$station: epochs:$nof_epochs, North displac.: "
            . scalar @N
            . ", East displac.: "
@@ -620,28 +620,36 @@
            . ", TRPs:"
            . scalar @TRPs );
-    if ( $nof_epochs != scalar @N )                                { LOGDIE "number of epochs and residuals not equal\n" }
-    if ( $nof_epochs != scalar @TRPs )                             { LOGDIE "number of epochs and TRPs not equal\n" }
-    if ( @CLKs && scalar @EPOCHs_CLK != scalar @CLKs )             { LOGDIE "number of epochs and CLKs not equal\n" }
-    if ( @OFF_GLOs && scalar @EPOCHs_OFF_GLO != scalar @OFF_GLOs ) { LOGDIE "number of epochs and OFF_GLOs not equal\n" }
-    if ( @OFF_GALs && scalar @EPOCHs_OFF_GAL != scalar @OFF_GALs ) { LOGDIE "number of epochs and OFF_GALs not equal\n" }
-    if ( @OFF_BDSs && scalar @EPOCHs_OFF_BDS != scalar @OFF_BDSs ) { LOGDIE "number of epochs and OFF_BDSs not equal\n" }
-
+    if ( $nof_epochs != scalar @N )                    { LOGDIE "number of epochs and residuals not equal\n" }
+    if ( $nof_epochs != scalar @TRPs )                 { LOGDIE "number of epochs and TRPs not equal\n" }
+    if ( @CLKs && scalar @EPOCHs_CLK != scalar @CLKs ) { LOGDIE "number of epochs and CLKs not equal\n" }
+
+    if ( @OFF_GLOs && scalar @EPOCHs_OFF_GLO != scalar @OFF_GLOs ) {
+        LOGDIE "number of epochs and OFF_GLOs not equal\n";
+    }
+    if ( @OFF_GALs && scalar @EPOCHs_OFF_GAL != scalar @OFF_GALs ) {
+        LOGDIE "number of epochs and OFF_GALs not equal\n";
+    }
+    if ( @OFF_BDSs && scalar @EPOCHs_OFF_BDS != scalar @OFF_BDSs ) {
+        LOGDIE "number of epochs and OFF_BDSs not equal\n";
+    }
+    if ( !$station ) { WARN "could not grep stationname from file: $file\n" }
 
     my %data = (
-                 EPOCHS    => \@EPOCHs,
-                 N         => \@N,
-                 E         => \@E,
-                 U         => \@U,
-                 SATNUM    => \%SATNUM,
-                 TRPs      => \@TRPs,
-                 CLKs    => \@CLKs,
-                 OFF_GLOs  => \@OFF_GLOs,
-                 OFF_GALs  => \@OFF_GALs,
-                 OFF_BDSs  => \@OFF_BDSs,
-                 RES       => \%RES,
-                 AMB       => \%AMB,
-                 ELE       => \%ELE,
-                 ION       => \%ION,
-                 BIA       => \%BIA,
+                 EPOCHS     => \@EPOCHs,
+                 N          => \@N,
+                 E          => \@E,
+                 U          => \@U,
+                 SATNUM     => \%SATNUM,
+                 TRPs       => \@TRPs,
+                 CLKs       => \@CLKs,
+                 CLK_EPOCHS => \@EPOCHs_CLK,
+                 OFF_GLOs   => \@OFF_GLOs,
+                 OFF_GALs   => \@OFF_GALs,
+                 OFF_BDSs   => \@OFF_BDSs,
+                 RES        => \%RES,
+                 AMB        => \%AMB,
+                 ELE        => \%ELE,
+                 ION        => \%ION,
+                 BIA        => \%BIA,
     );
 
