Changeset 9679 in ntrip


Ignore:
Timestamp:
Apr 7, 2022, 4:46:56 PM (2 years ago)
Author:
wiese
Message:

ADD: allow glob for reading several logfiles

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/BNC/scripts/sot.pl

    r9672 r9679  
    22
    33#
    4 # sot.pl - parse BNC logfile and create *.sot files that contain the observation types for each GNSS in RINEX header format
     4# sot.pl - parse BNC logfile(s) and create *.sot files that contain the observation types for each GNSS in RINEX header format
    55#
    6 # Revision: $Header:$
     6# Revision: $Header$
    77#
    88
     
    1919$opts{h} && HELP_MESSAGE();
    2020my $caster = $opts{n} ? $opts{n} : "";
    21 
    22 my $logFil = $ARGV[0];
    23 if ( !$logFil ) {
     21if ( scalar @ARGV < 1 ) {
    2422    warn "usage error: no BNC logfile given\n";
    2523    HELP_MESSAGE();
    2624}
     25my @logFiles = @ARGV;
    2726
    2827my %obsTyps_of;
    29 open ( my $inp, '<', $logFil ) || die ("could not open file '$logFil': $!");
    30 while (<$inp>) {
    31     if ( $_ =~ /Observation Types:/ ) {  # 16-03-21 10:25:38 MARS0: Observation Types: R     6   C1C L1C S1C C2P L2P S2P
    32         chomp;
    33         my @fields = split ( /\s+/, $_ );
    34         my $mp     = $fields[2];
    35         $mp =~ s/:$//;
    36         my $satSys  = $fields[5];
    37         my @obsTyps = @fields[ 7 .. $#fields ];
    38         $obsTyps_of{$mp}->{$satSys} = \@obsTyps;
    3928
    40         # Check obs types
    41         if ( $satSys eq "G" ) {          # GPS see #65
    42             foreach my $otp (@obsTyps) {
    43                 if ( $otp eq "L2P" || $otp eq "C2P" ) {
    44                     warn ("$_: Observation Types 'L2P' and/or 'C2P' are not reasonable for GPS\n");
     29# Parse each logfile
     30foreach my $logfile (@logFiles) {
     31    my $inp;
     32    if ( !open ( $inp, '<', $logfile ) ) {
     33        warn "could not open file '$logfile': $!";
     34        next;
     35    }
     36    while (<$inp>) {
     37
     38        # # 16-03-21 10:25:38 MARS0: Observation Types: R     6   C1C L1C S1C C2P L2P S2P
     39        if ( $_ =~ /Observation Types:/ ) {
     40            chomp;
     41            my @fields = split ( /\s+/, $_ );
     42            my $mp     = $fields[2];
     43            $mp =~ s/:$//;
     44            my $satSys  = $fields[5];
     45            my @obsTyps = @fields[ 7 .. $#fields ];
     46            $obsTyps_of{$mp}->{$satSys} = \@obsTyps;
     47
     48            # Check obs types
     49            if ( $satSys eq "G" ) {                     # GPS see #65
     50                foreach my $otp (@obsTyps) {
     51                    if ( $otp eq "L2P" || $otp eq "C2P" ) {
     52                        warn ("$_: Observation Types 'L2P' and/or 'C2P' are not reasonable for GPS\n");
     53                    }
    4554                }
    4655            }
    4756        }
    4857    }
     58    close ($inp);
    4959}
    50 close ($inp);
    5160
    5261# Write .sot files
     
    104113sub HELP_MESSAGE {
    105114    print <<EOI_HILFE;
    106 $prog - parse observation types from BNC's logfile and write them as *.sot files
     115$prog - parse observation types from BNC's logfile(s) and write them as *.sot files
    107116
    108117USAGE:
    109   $prog [OPTIONS] <bnc-logfil>
     118  $prog [OPTIONS] <bnc-logfiles>
    110119
    111120OPTIONS:
     
    114123
    115124EXAMPLES:
    116    $prog -n euref-ip.net /home/user/log/scanRTCM_EUREF-IP.log
     125   $prog -n euref-ip.net /home/user/log/bnc*.log
    117126
    118127EOI_HILFE
Note: See TracChangeset for help on using the changeset viewer.