Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
SOHViewer
Manage
Activity
Members
Labels
Plan
Issues
14
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
5
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Software Public
PASSOFT
SOHViewer
Merge requests
!60
Implement extracting RT130 GPS data
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Implement extracting RT130 GPS data
feature-#19-get_gps_data_rt130
into
master
Overview
1
Commits
1
Pipelines
5
Changes
4
Merged
Kien Le
requested to merge
feature-#19-get_gps_data_rt130
into
master
2 years ago
Overview
1
Commits
1
Pipelines
5
Changes
2
Expand
#19 (closed)
Edited
2 years ago
by
Kien Le
👍
0
👎
0
Merge request reports
Viewing commit
9d3e8e14
Show latest version
2 files
+
64
−
8
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
2
Search (e.g. *.vue) (Ctrl+P)
9d3e8e14
Implement extracting GPS data for RT130 data
· 9d3e8e14
Kien Le
authored
2 years ago
sohstationviewer/model/reftek/reftek.py
+
62
−
6
Options
"""
RT130 object to hold and process RefTek data
"""
from
datetime
import
datetime
import
os
from
pathlib
import
Path
from
typing
import
Tuple
,
List
import
numpy
as
np
from
obspy.core
import
Stream
,
UTCDateTime
from
obspy.core
import
Stream
from
sohstationviewer.model.gps_point
import
GPSPoint
from
sohstationviewer.model.reftek.from_rt2ms
import
(
core
,
soh_packet
,
packet
)
from
sohstationviewer.model.reftek.log_info
import
LogInfo
from
sohstationviewer.model.data_type_model
import
DataTypeModel
,
ThreadStopped
from
sohstationviewer.model.handling_data
import
(
read_waveform_reftek
,
squash_gaps
,
sort_data
,
read_mp_trace
,
read_text
)
from
sohstationviewer.conf
import
constants
from
sohstationviewer.controller.util
import
validate_file
from
sohstationviewer.view.util.enums
import
LogType
@@ -50,6 +47,7 @@ class RT130(DataTypeModel):
raise
ThreadStopped
()
if
len
(
self
.
req_wf_chans
)
!=
0
:
self
.
read_wf_files
(
self
.
selected_key
)
self
.
get_gps_data
()
def
read_soh_index_waveform
(
self
,
folder
:
str
)
->
None
:
"""
@@ -344,3 +342,61 @@ class RT130(DataTypeModel):
# endtime, duration, number of missing samples]
all_gaps
+=
[[
g
[
4
].
timestamp
,
g
[
5
].
timestamp
]
for
g
in
gaps
]
self
.
gaps
[
k
]
=
squash_gaps
(
all_gaps
)
def
get_gps_data
(
self
):
log_lines
=
self
.
log_data
[
self
.
selected_key
][
'
SOH
'
]
log_lines
=
log_lines
[
0
].
split
(
'
\n
'
)
log_lines
=
[
line
.
strip
(
'
\r
'
).
strip
(
''
)
for
line
in
log_lines
]
gps_year
=
None
for
line
in
log_lines
:
if
'
State of Health
'
in
line
:
current_time
=
line
.
split
()[
3
]
two_digit_year
=
current_time
[:
2
]
gps_year
=
two_digit_year_to_four_digit_year
(
two_digit_year
)
if
'
GPS POSITION
'
in
line
.
lower
():
self
.
gps_points
.
append
(
self
.
parse_gps_point
(
line
,
gps_year
))
def
parse_gps_point
(
self
,
gps_str
:
str
,
gps_year
):
fix_type
=
'
N/A
'
num_sats_used
=
'
N/A
'
time_str
,
*
_
,
lat_str
,
long_str
,
height_str
=
gps_str
.
split
()
time_str
=
gps_year
+
'
:
'
+
time_str
time_format
=
'
%Y:%j:%H:%M:%S
'
gps_time
=
datetime
.
strptime
(
time_str
,
time_format
).
isoformat
(
sep
=
'
'
)
print
(
lat_str
)
lat_as_list
=
lat_str
.
split
(
'
:
'
)
lat_second
=
float
(
lat_as_list
[
2
])
lat_minute
=
float
(
lat_as_list
[
1
])
+
lat_second
/
60
lat
=
float
(
lat_as_list
[
0
][
1
:])
+
lat_minute
/
60
if
lat_as_list
[
0
][
0
]
==
'
S
'
:
lat
=
-
lat
long_as_list
=
long_str
.
split
(
'
:
'
)
long_second
=
float
(
long_as_list
[
2
])
long_minute
=
float
(
long_as_list
[
1
])
+
long_second
/
60
long
=
float
(
long_as_list
[
0
][
2
:])
+
long_minute
/
60
if
long_as_list
[
0
][
0
]
==
'
W
'
:
long
=
-
long
i
=
len
(
height_str
)
current_char
=
height_str
[
i
-
1
]
while
current_char
!=
'
.
'
and
not
current_char
.
isnumeric
():
i
-=
1
current_char
=
height_str
[
i
-
1
]
height
=
float
(
height_str
[:
i
])
height_unit
=
height_str
[
i
:]
return
GPSPoint
(
gps_time
,
fix_type
,
num_sats_used
,
lat
,
long
,
height
,
height_unit
)
def
two_digit_year_to_four_digit_year
(
year
:
str
)
->
str
:
if
int
(
year
)
<
69
:
year
=
'
20
'
+
year
else
:
year
=
'
19
'
+
year
return
year
Loading