Commit 76f6ad43 authored by Jean-Luc Shaw's avatar Jean-Luc Shaw

Just before pushing to gitlasso

parent 3f96f345
......@@ -20,11 +20,8 @@ print ">> Enter cruise directory : " ;
chop($folder = <STDIN>) ;
print "\n" ;
# SETUP GPS
($gps,$gpson,$gpsport,$gpsbaud) = sub_getgps() ;
# ASK FOR or READ CRUISE INFO
($ops,$sts,$numops,$numsts,$headerstring,$stslat,$stslon) = sub_cruiseinfo($name,$folder,$gpson,$gpsport,$gpsbaud) ;
($ops,$sts,$gps,$gpson,$numops,$numsts,$headerstring,$stslat,$stslon) = sub_cruiseinfo() ;
# SET PRINTING FORMAT
$frmt = "%6s;%10.5f;%10.5f;%20s;%s\n" ;
......
HEARDER INFO for .out files
LINE 1 : Cruise info
LINE 2 : Cruise folder path
LINE 3 : GPS feature on or off (1 or 0)
LINE 4 : GPS serial port name
LINE 5 : GPS serial port baud rate
LINE 6 : Number of operation types (N)
LINE 7 : First operation type
LINE 7+N : Last operation type
LINE 7+N+1 : Number of stations (M)
LINE 7+N+2 : First station name;station latitude;station longitude
LINE 7+N+2+M : Last station name;station latitude;station longitude
LINE 7+N+3+M : Sequential current leg number
LINE 7+N+4+M : Column titles
LINE 7+N+5+M : Start of data entries
COLUMN DEFINITIONS
COL 0 = entry type (station,operation,comment) (string)
COL 1 = latitude in decimal degrees (float)
COL 2 = longitude in decimal degrees (float)
COL 3 = time in ISOXXXX standard yyyy-mm-ddTHH:MM:SSZ (string)
COL 4 = entry value (station name, ..., comment) (string)
sub sub_cruiseinfo {
$name = $_[0] ;
$folder = $_[1] ;
# does this cruise already have a mission log?
if (-e "$folder/LogGen/$name.out") {
# Open the file handle to append
# Get the stations
# Get the operations
# Open the file for reading
open(OUT,"$folder/LogGen/$name.out") || die("EXIT!! : Did not find LogGen folder or cruise folder\n") ;
# Read header and store in an array
while (<OUT>) {
if ( $_ !~ /\#/) {last;}
chop($_) ;
$str = substr $_, 2 ;
push(@header,$str) ; }
close(OUT) ;
$gpson = $header[2] ;
$gpsport = $header[3] ;
$gpsbaud = $header[4] ;
$numops = $header[5] ;
# Get the operations
for ($ii=0;$ii<$numops;$ii++) {
push(@ops,$header[6+$ii]) ; }
$numsts = $header[6+$numops] ;
# Get the stations and their coordinates
for ($ii=0;$ii<$numsts;$ii++) {
@hl = split(/;/,$header[6+$numops+1+$ii]) ;
push(@sts,$hl[0]) ;
$stslon{$hl[0]} = $hl[2] ;
$stslat{$hl[0]} = $hl[1] ;
}
$stslon{"none"} = "NaN" ;
$stslat{"none"} = "NaN" ;
$headerstring = "Continuing operations log for $name cruise" ;
#Close the file handle and open for appending
close(OUT) ;
open(OUT,">>$folder/LogGen/$name.out") || die("EXIT!! : Did not find LogGen folder or cruise folder\n") ;
} else { # this cruise does not already have an output file
# MANAGE FILE HANDLES
......@@ -37,6 +69,10 @@ sub sub_cruiseinfo {
}
print "\n" ;
# Ask for gps and connect if needed
($gps,$gpson,$gpsport,$gpsbaud) = sub_getgps() ;
# Manually enter GPS values for stations if no GPS is used
if (not $gpson) {
for ($ii=0;$ii<$numsts;$ii++) {
......@@ -61,7 +97,7 @@ sub sub_cruiseinfo {
for ($ii=0;$ii<$numsts;$ii++) { print OUT "\# $sts[$ii];$stslat{$sts[$ii]};$stslon{$sts[$ii]}\n" ; }
print OUT "\# 0\n" ;
$cul = 0 ;
@coltitles = ("\#type","longitude","latitude","yyyy-mm-ddTHH:MM:SSZ","value") ;
@coltitles = ("\#type","latitude","longitude","yyyy-mm-ddTHH:MM:SSZ","value") ;
printf OUT "%5s;%10s;%10s;%20s;%s\n",@coltitles ;
$headerstring = "Starting operations log for $name cruise" ;
......@@ -69,7 +105,7 @@ sub sub_cruiseinfo {
}
# RETURN NEEDED VALUES
return (\@ops,\@sts,$numops,$numsts,$headerstring,\%stslat,\%stslon) ;
return (\@ops,\@sts,$gps,$gpson,$numops,$numsts,$headerstring,\%stslat,\%stslon) ;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment