Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Jean-Luc Shaw
LogGen_linux
Commits
f199093a
Commit
f199093a
authored
May 08, 2018
by
Jean-Luc Shaw
Browse files
Still need to write preset station coordinates to outfile. Perhaps using an indexed array.
parent
b5a8ec81
Changes
3
Hide whitespace changes
Inline
Side-by-side
LogGen.pl
View file @
f199093a
...
...
@@ -21,13 +21,13 @@ chop($folder = <STDIN>) ;
print
"
\n
"
;
# SETUP GPS
$gps
=
sub_getgps
()
;
(
$gps
,
$gpson
,
$gpsport
,
$gpsbaud
)
=
sub_getgps
()
;
# ASK FOR or READ CRUISE INFO
(
$ops
,
$sts
,
$numops
,
$numsts
,
$headerstring
)
=
sub_cruiseinfo
(
$name
,
$folder
)
;
(
$ops
,
$sts
,
$numops
,
$numsts
,
$headerstring
)
=
sub_cruiseinfo
(
$name
,
$folder
,
$gpson
,
$gpsport
,
$gpsbaud
)
;
# SET PRINTING FORMAT
$frmt
=
"
\
%4s
\
%.4f
\
%.4f
\
%4s
\
%2s
\
%2s
\
%2s
\
%2s
\
%2s
\
%s
\n
"
;
$frmt
=
"
%6s;%10.5f;%10.5f;%20s;
%s
\n
"
;
# DISPLAY AVAILABLE STATIONS and OPERATIONS
print
"
>> AVAILABLE OPERATIONS ARE:
\n
";
...
...
@@ -37,8 +37,12 @@ print ">> PLANNED STATIONS ARE:\n";
foreach
$line
(
@sts
)
{
print
"
>>
$line
\n
";
}
print
"
>> ---
\n\n
"
;
$pre
=
"
>
"
;
$cus
=
"
none
"
;
# INITIAL VALUES
$pre
=
"
>
"
;
$cus
=
"
none
"
;
$culon
=
"
NaN
"
;
$culat
=
"
NaN
"
;
# DEFAULT START HEADER
print
"
=============================================================================================
\n
"
;
...
...
@@ -55,9 +59,19 @@ while (<STDIN>) {
@time
=
localtime
;
$time
[
4
]
++
;
$time
[
5
]
+=
1900
;
$mmddHHMM
=
sprintf
"
%02d/%02d %02d:%02d
",
@time
[
4
],
@time
[
3
],
@time
[
2
],
@time
[
1
]
;
$isotime
=
sprintf
"
%s-%02s-%02sT%02s:%02s:%02sZ
",
reverse
@time
[
0
..
5
]
;
# POLL GPS FOR COORDINATES
(
$ns
,
$lat
,
$ew
,
$lon
)
=
$gps
->
get_position
;
if
(
$gpson
)
{
# if gps is used, actual values are written
(
$ns
,
$lat
,
$ew
,
$lon
)
=
$gps
->
get_position
;
if
(
$ns
=~
/S/i
)
{
$lat
*=-
1
;
}
if
(
$ew
=~
/W/i
)
{
$lon
*=-
1
;
}
}
else
{
# if no gps is used be we are on station, these coordinates a written
$lon
=
$culon
;
$lat
=
$culat
;
}
# THIS IS THE EXIT COMMAND
if
(
$line
[
0
]
=~
/exit/
)
{
last
;}
...
...
@@ -71,28 +85,29 @@ while (<STDIN>) {
print
"
$pre
\t\t
NOW RECORDING STATION
\t
$line
[1],
\t\t\t
TIME :
$mmddHHMM
\n
"
;
print
"
$pre
\t\t\t\t\t\t\t\t\t\t
LON :
$lon
\n
"
;
print
"
$pre
\t\t\t\t\t\t\t\t\t\t
LAT :
$lat
\n
$pre
"
;
printf
OUT
$frmt
,
$line
[
0
],
reverse
@time
[
0
..
5
]
,
$line
[
1
]
;
printf
OUT
$frmt
,
$line
[
0
],
$lat
,
$lon
,
$isotime
,
$line
[
1
]
;
}
elsif
(
$cus
=~
/$line[1]/
)
{
# case : we are currently at this station
$cus
=
"
none
"
;
print
"
$pre
\t\t\t
END OF STATION
\t
$line
[1],
\t\t\t
TIME :
$mmddHHMM
\n
>
\n
>
\n
>
"
;
printf
OUT
$frmt
,
$line
[
0
],
reverse
@time
[
0
..
5
]
,
$line
[
1
]
;
printf
OUT
$frmt
,
$line
[
0
],
$lat
,
$lon
,
$isotime
,
$line
[
1
]
;
$pre
=
"
>
"
;
}
else
{
# case : we are currently at a different station
printf
OUT
$frmt
,
$line
[
0
],
reverse
@time
[
0
..
5
]
,
$cus
;
printf
OUT
$frmt
,
$line
[
0
],
$lat
,
$lon
,
$isotime
,
$cus
;
print
"
$pre
\t\t\t
END OF STATION
\t
$cus
,
\t\t\t
TIME :
$mmddHHMM
\n
>
\n
>
\n
"
;
$cus
=
$line
[
1
]
;
print
"
$pre
\t\t
NOW RECORDING STATION
\t
$line
[1],
\t\t\t
TIME :
$mmddHHMM
\n
"
;
print
"
$pre
\t\t\t\t\t\t\t\t\t\t
LON :
$lon
\n
"
;
print
"
$pre
\t\t\t\t\t\t\t\t\t\t
LAT :
$lat
\n
$pre
"
;
printf
OUT
$frmt
,
$line
[
0
],
reverse
@time
[
0
..
5
]
,
$line
[
1
]
;
printf
OUT
$frmt
,
$line
[
0
],
$lat
,
$lon
,
$isotime
,
$line
[
1
]
;
}
}
# THIS IS A NEW LEG ENTRY
elsif
(
$line
[
0
]
=~
/lg/
)
{
$cul
++
;
print
"
>
\t
NOW RECORDING LEG
$cul
\n
>
"
;
printf
OUT
$frmt
,
$line
[
0
],
$lat
,
$lon
,
$isotime
,
$cul
;
}
# THIS IS AN OPERATION ENTRY
...
...
@@ -102,6 +117,7 @@ while (<STDIN>) {
print
"
$pre
\t\t\t
OPERATION
\t\t
$line
[1],
\t\t\t\t
TIME :
$mmddHHMM
\n
"
;
print
"
$pre
\t\t\t\t\t\t\t\t\t\t
LON :
$lon
\n
"
;
print
"
$pre
\t\t\t\t\t\t\t\t\t\t
LAT :
$lat
\n
$pre
"
;
printf
OUT
$frmt
,
$line
[
0
],
$lat
,
$lon
,
$isotime
,
$line
[
1
]
;
}
}
}
...
...
@@ -109,6 +125,7 @@ while (<STDIN>) {
# THIS IS A COMMENT ENTRY
elsif
(
$line
[
0
]
=~
/cm/
)
{
print
"
$pre
\t\t\t
COMMENT :
$line
[1]
\n
$pre
"
;
printf
OUT
$frmt
,
$line
[
0
],
$lat
,
$lon
,
$isotime
,
$line
[
1
]
;
}
# UNRECOGNIZED INPUT
...
...
sub_cruiseinfo.pl
View file @
f199093a
...
...
@@ -32,21 +32,37 @@ sub sub_cruiseinfo {
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
]
\n
"
;
}
for
(
$ii
=
0
;
$ii
<
$numsts
;
$ii
++
)
{
print
OUT
"
\
#
$sts
[
$ii
]
;
$stslat
[ii];
$stslon
[ii]
\n
"
;
}
print
OUT
"
\
# 0
\n
"
;
$cul
=
0
;
print
OUT
"
\
# Type lon lat yyyy mm dd HH MM SS Name
\n
"
;
@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
"
;
...
...
sub_getgps.pl
View file @
f199093a
...
...
@@ -9,16 +9,19 @@ sub sub_getgps {
print
"
>> Baud rate...? :
"
;
chop
(
$gpsbaud
=
<
STDIN
>
)
;
print
"
\n
"
;
$gpson
=
1
;
}
else
{
$gpson
=
0
;
}
$gps
=
new
GPS::
NMEA
(
'
Port
'
=>
"
$gpsport
",
'
Baud
'
=>
$gpsbaud
,
);
$gpson
=
1
;
}
else
{
$gpson
=
0
;
$gpsport
=
"
NaN
"
;
$gpsbaud
=
"
NaN
"
;
$gps
=
"
NaN
"
;
}
return
$gps
;
return
(
$gps
,
$gpson
,
$gpsport
,
$gpsbaud
)
;
}
1
;
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment