Commit 3f96f345ec10b0a9d8613a0a49b0771d419548f1

Authored by Jean-Luc Shaw
1 parent f199093a
Exists in master

Working with gps off is now a working option.

Showing 2 changed files with 18 additions and 13 deletions   Show diff stats
LogGen.pl
... ... @@ -24,7 +24,7 @@ print "\n" ;
24 24 ($gps,$gpson,$gpsport,$gpsbaud) = sub_getgps() ;
25 25  
26 26 # ASK FOR or READ CRUISE INFO
27   -($ops,$sts,$numops,$numsts,$headerstring) = sub_cruiseinfo($name,$folder,$gpson,$gpsport,$gpsbaud) ;
  27 +($ops,$sts,$numops,$numsts,$headerstring,$stslat,$stslon) = sub_cruiseinfo($name,$folder,$gpson,$gpsport,$gpsbaud) ;
28 28  
29 29 # SET PRINTING FORMAT
30 30 $frmt = "%6s;%10.5f;%10.5f;%20s;%s\n" ;
... ... @@ -40,9 +40,6 @@ print ">> ---\n\n" ;
40 40 # INITIAL VALUES
41 41 $pre = ">" ;
42 42 $cus = "none" ;
43   -$culon = "NaN" ;
44   -$culat = "NaN" ;
45   -
46 43  
47 44 # DEFAULT START HEADER
48 45 print "=============================================================================================\n" ;
... ... @@ -69,8 +66,8 @@ while (<STDIN>) {
69 66 if ($ew =~ /W/i) { $lon*=-1 ; }
70 67 } else {
71 68 # if no gps is used be we are on station, these coordinates a written
72   - $lon = $culon ;
73   - $lat = $culat ;
  69 + $lon = %stslon{$cus} ;
  70 + $lat = %stslat{$cus} ;
74 71 }
75 72  
76 73 # THIS IS THE EXIT COMMAND
... ... @@ -80,8 +77,12 @@ while (<STDIN>) {
80 77 elsif ($line[0] =~ /st/) {
81 78  
82 79 if ( $cus =~ /none/ ) { # case : we are currently off station
83   - $cus = $line[1] ;
84   - $pre = ">>" ;
  80 + $cus = $line[1] ;
  81 + $pre = ">>" ;
  82 + if (not $gpson) {
  83 + $lon = %stslon{$cus} ;
  84 + $lat = %stslat{$cus} ;
  85 + }
85 86 print "$pre\t\tNOW RECORDING STATION\t $line[1],\t\t\t TIME : $mmddHHMM\n" ;
86 87 print "$pre\t\t\t\t\t\t\t\t\t\tLON : $lon\n" ;
87 88 print "$pre\t\t\t\t\t\t\t\t\t\tLAT : $lat\n$pre " ;
... ... @@ -97,6 +98,10 @@ while (<STDIN>) {
97 98 printf OUT $frmt,$line[0],$lat,$lon,$isotime,$cus ;
98 99 print "$pre\t\t\tEND OF STATION\t $cus,\t\t\t TIME : $mmddHHMM\n>\n>\n" ;
99 100 $cus = $line[1] ;
  101 + if (not $gpson) {
  102 + $lon = %stslon{$cus} ;
  103 + $lat = %stslat{$cus} ;
  104 + }
100 105 print "$pre\t\tNOW RECORDING STATION\t $line[1],\t\t\t TIME : $mmddHHMM\n" ;
101 106 print "$pre\t\t\t\t\t\t\t\t\t\tLON : $lon\n" ;
102 107 print "$pre\t\t\t\t\t\t\t\t\t\tLAT : $lat\n$pre " ;
... ...
sub_cruiseinfo.pl
... ... @@ -32,8 +32,6 @@ sub sub_cruiseinfo {
32 32 while (<STDIN>) {
33 33 chop($_) ;
34 34 push(@sts,$_) ;
35   - push(@stslon,"NaN") ;
36   - push(@stslat,"NaN") ;
37 35 print ">> : " ;
38 36 $numsts++ ;
39 37 }
... ... @@ -44,8 +42,10 @@ sub sub_cruiseinfo {
44 42 for ($ii=0;$ii<$numsts;$ii++) {
45 43 print ">> Enter lon;lat of station $sts[$ii] (pm180) : " ;
46 44 chop($line = <STDIN>) ;
47   - ($stslon[$ii],$stslat[$ii]) = split(/;/,$line) ;
  45 + ($stslon{$sts[$ii]},$stslat{$sts[$ii]}) = split(/;/,$line) ;
48 46 }
  47 + $stslon{"none"} = "NaN" ;
  48 + $stslat{"none"} = "NaN" ;
49 49 }
50 50 print "\n\n\n" ;
51 51  
... ... @@ -58,7 +58,7 @@ sub sub_cruiseinfo {
58 58 print OUT "\# $numops\n" ;
59 59 for ($ii=0;$ii<$numops;$ii++) { print OUT "\# $ops[$ii]\n" ; }
60 60 print OUT "\# $numsts\n" ;
61   - for ($ii=0;$ii<$numsts;$ii++) { print OUT "\# $sts[$ii];$stslat[ii];$stslon[ii]\n" ; }
  61 + for ($ii=0;$ii<$numsts;$ii++) { print OUT "\# $sts[$ii];$stslat{$sts[$ii]};$stslon{$sts[$ii]}\n" ; }
62 62 print OUT "\# 0\n" ;
63 63 $cul = 0 ;
64 64 @coltitles = ("\#type","longitude","latitude","yyyy-mm-ddTHH:MM:SSZ","value") ;
... ... @@ -69,7 +69,7 @@ sub sub_cruiseinfo {
69 69 }
70 70  
71 71 # RETURN NEEDED VALUES
72   - return (\@ops,\@sts,$numops,$numsts,$headerstring) ;
  72 + return (\@ops,\@sts,$numops,$numsts,$headerstring,\%stslat,\%stslon) ;
73 73  
74 74  
75 75 }
... ...