sub_cruiseinfo.pl 1.91 KB
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
	
	} else { # this cruise does not already have an output file
	# MANAGE FILE HANDLES 
		# create and open the outfile handle 
		open(OUT,">$folder/LogGen/$name.out") || die("EXIT!! : Did not find LogGen folder or cruise folder\n")  ;
		print ">> Enter operations, 		end with CTRL-d		: " ;
		
		# operations to be conducted
		$numops = 0 ;
		while ( <STDIN> ) {
			chop($_) ;
			push(@ops,$_) ;
			print ">> 							: " ;
			$numops++ ;
		}
		print "\n" ;
		
		
		# stations to be visited 
		$numsts = 0 ;
		print ">> Enter stations names, 	end with CTRL-d		: " ;
		while (<STDIN>) {
			chop($_) ;
			push(@sts,$_) ;
			push(@stslon,"NaN") ;
			push(@stslat,"NaN") ;
			print ">> 							: " ;
			$numsts++ ;
		}
		print "\n" ;

		# Manually enter GPS values for stations if no GPS is used
		if (not $gpson) {
			for ($ii=0;$ii<$numsts;$ii++) {
			print ">> Enter  lon;lat of station $sts[$ii] (pm180)		: " ;
				chop($line = <STDIN>) ;
				($stslon[$ii],$stslat[$ii]) = split(/;/,$line) ;
			}
		}
		print "\n\n\n" ;
	
		# print header to outputfile
		print OUT "\# $name\n" ;
		print OUT "\# $folder\n" ;
		print OUT "\# $gpson\n" ;
		print OUT "\# $gpsport\n" ;
		print OUT "\# $gpsbaud\n" ;
		print OUT "\# $numops\n" ;
		for ($ii=0;$ii<$numops;$ii++) { print OUT "\# $ops[$ii]\n" ; }
		print OUT "\# $numsts\n" ;
		for ($ii=0;$ii<$numsts;$ii++) { print OUT "\# $sts[$ii];$stslat[ii];$stslon[ii]\n" ; }
		print OUT "\# 0\n" ;
		$cul = 0 ;	
		@coltitles = ("\#type","longitude","latitude","yyyy-mm-ddTHH:MM:SSZ","value") ;
		printf OUT "%5s;%10s;%10s;%20s;%s\n",@coltitles ;
	
		$headerstring = "Starting operations log for $name cruise" ;
	
	}

	# RETURN NEEDED VALUES
	return (\@ops,\@sts,$numops,$numsts,$headerstring) ;


}

1;