Commit 76f6ad4308a3344a767fb0f2c18b4581c379504f

Authored by Jean-Luc Shaw
1 parent 3f96f345
Exists in master

Just before pushing to gitlasso

Showing 3 changed files with 70 additions and 12 deletions   Show diff stats
LogGen.pl
... ... @@ -20,11 +20,8 @@ print ">> Enter cruise directory : " ;
20 20 chop($folder = <STDIN>) ;
21 21 print "\n" ;
22 22  
23   -# SETUP GPS
24   -($gps,$gpson,$gpsport,$gpsbaud) = sub_getgps() ;
25   -
26 23 # ASK FOR or READ CRUISE INFO
27   -($ops,$sts,$numops,$numsts,$headerstring,$stslat,$stslon) = sub_cruiseinfo($name,$folder,$gpson,$gpsport,$gpsbaud) ;
  24 +($ops,$sts,$gps,$gpson,$numops,$numsts,$headerstring,$stslat,$stslon) = sub_cruiseinfo() ;
28 25  
29 26 # SET PRINTING FORMAT
30 27 $frmt = "%6s;%10.5f;%10.5f;%20s;%s\n" ;
... ...
readme.md 0 → 100644
... ... @@ -0,0 +1,25 @@
  1 +HEARDER INFO for .out files
  2 +
  3 +LINE 1 : Cruise info
  4 +LINE 2 : Cruise folder path
  5 +LINE 3 : GPS feature on or off (1 or 0)
  6 +LINE 4 : GPS serial port name
  7 +LINE 5 : GPS serial port baud rate
  8 +LINE 6 : Number of operation types (N)
  9 +LINE 7 : First operation type
  10 +LINE 7+N : Last operation type
  11 +LINE 7+N+1 : Number of stations (M)
  12 +LINE 7+N+2 : First station name;station latitude;station longitude
  13 +LINE 7+N+2+M : Last station name;station latitude;station longitude
  14 +LINE 7+N+3+M : Sequential current leg number
  15 +LINE 7+N+4+M : Column titles
  16 +LINE 7+N+5+M : Start of data entries
  17 +
  18 +COLUMN DEFINITIONS
  19 +
  20 +COL 0 = entry type (station,operation,comment) (string)
  21 +COL 1 = latitude in decimal degrees (float)
  22 +COL 2 = longitude in decimal degrees (float)
  23 +COL 3 = time in ISOXXXX standard yyyy-mm-ddTHH:MM:SSZ (string)
  24 +COL 4 = entry value (station name, ..., comment) (string)
  25 +
... ...
sub_cruiseinfo.pl
1 1 sub sub_cruiseinfo {
2 2  
3   - $name = $_[0] ;
4   - $folder = $_[1] ;
5   -
6 3 # does this cruise already have a mission log?
7 4 if (-e "$folder/LogGen/$name.out") {
8   - # Open the file handle to append
9   - # Get the stations
10   - # Get the operations
  5 +
  6 + # Open the file for reading
  7 + open(OUT,"$folder/LogGen/$name.out") || die("EXIT!! : Did not find LogGen folder or cruise folder\n") ;
  8 +
  9 + # Read header and store in an array
  10 + while (<OUT>) {
  11 + if ( $_ !~ /\#/) {last;}
  12 + chop($_) ;
  13 + $str = substr $_, 2 ;
  14 + push(@header,$str) ; }
  15 + close(OUT) ;
  16 +
  17 + $gpson = $header[2] ;
  18 + $gpsport = $header[3] ;
  19 + $gpsbaud = $header[4] ;
  20 + $numops = $header[5] ;
  21 +
  22 + # Get the operations
  23 + for ($ii=0;$ii<$numops;$ii++) {
  24 + push(@ops,$header[6+$ii]) ; }
  25 +
  26 + $numsts = $header[6+$numops] ;
  27 +
  28 + # Get the stations and their coordinates
  29 + for ($ii=0;$ii<$numsts;$ii++) {
  30 + @hl = split(/;/,$header[6+$numops+1+$ii]) ;
  31 + push(@sts,$hl[0]) ;
  32 + $stslon{$hl[0]} = $hl[2] ;
  33 + $stslat{$hl[0]} = $hl[1] ;
  34 + }
  35 + $stslon{"none"} = "NaN" ;
  36 + $stslat{"none"} = "NaN" ;
  37 +
  38 + $headerstring = "Continuing operations log for $name cruise" ;
  39 +
  40 + #Close the file handle and open for appending
  41 + close(OUT) ;
  42 + open(OUT,">>$folder/LogGen/$name.out") || die("EXIT!! : Did not find LogGen folder or cruise folder\n") ;
11 43  
12 44 } else { # this cruise does not already have an output file
13 45 # MANAGE FILE HANDLES
... ... @@ -37,6 +69,10 @@ sub sub_cruiseinfo {
37 69 }
38 70 print "\n" ;
39 71  
  72 +
  73 + # Ask for gps and connect if needed
  74 + ($gps,$gpson,$gpsport,$gpsbaud) = sub_getgps() ;
  75 +
40 76 # Manually enter GPS values for stations if no GPS is used
41 77 if (not $gpson) {
42 78 for ($ii=0;$ii<$numsts;$ii++) {
... ... @@ -61,7 +97,7 @@ sub sub_cruiseinfo {
61 97 for ($ii=0;$ii<$numsts;$ii++) { print OUT "\# $sts[$ii];$stslat{$sts[$ii]};$stslon{$sts[$ii]}\n" ; }
62 98 print OUT "\# 0\n" ;
63 99 $cul = 0 ;
64   - @coltitles = ("\#type","longitude","latitude","yyyy-mm-ddTHH:MM:SSZ","value") ;
  100 + @coltitles = ("\#type","latitude","longitude","yyyy-mm-ddTHH:MM:SSZ","value") ;
65 101 printf OUT "%5s;%10s;%10s;%20s;%s\n",@coltitles ;
66 102  
67 103 $headerstring = "Starting operations log for $name cruise" ;
... ... @@ -69,7 +105,7 @@ sub sub_cruiseinfo {
69 105 }
70 106  
71 107 # RETURN NEEDED VALUES
72   - return (\@ops,\@sts,$numops,$numsts,$headerstring,\%stslat,\%stslon) ;
  108 + return (\@ops,\@sts,$gps,$gpson,$numops,$numsts,$headerstring,\%stslat,\%stslon) ;
73 109  
74 110  
75 111 }
... ...