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
Commits
cb04e18e
Commit
cb04e18e
authored
1 year ago
by
Kien Le
Browse files
Options
Downloads
Patches
Plain Diff
Add header and mass-positions to RT130 SOH message
parent
f45ed5a2
No related branches found
No related tags found
1 merge request
!199
Write log file
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
sohstationviewer/conf/constants.py
+4
-0
4 additions, 0 deletions
sohstationviewer/conf/constants.py
sohstationviewer/model/reftek_data/reftek.py
+47
-0
47 additions, 0 deletions
sohstationviewer/model/reftek_data/reftek.py
with
51 additions
and
0 deletions
sohstationviewer/conf/constants.py
+
4
−
0
View file @
cb04e18e
...
...
@@ -56,6 +56,10 @@ CONFIG_PATH = 'sohstationviewer/conf/read_settings.ini'
# List of image formats. Have to put PNG at the beginning to go with
# dpi in dialog
IMG_FORMAT
=
[
'
PNG
'
,
'
PDF
'
,
'
EPS
'
,
'
SVG
'
]
# The current version of SOHStationViewer
SOFTWARE_VERSION
=
'
2023.1.0.0
'
# ================================================================= #
# PLOTTING CONSTANT
# ================================================================= #
...
...
This diff is collapsed.
Click to expand it.
sohstationviewer/model/reftek_data/reftek.py
+
47
−
0
View file @
cb04e18e
"""
RT130 object to hold and process RefTek data
"""
import
datetime
from
pathlib
import
Path
from
typing
import
Union
,
List
,
Tuple
,
Dict
import
traceback
import
numpy
as
np
from
obspy
import
UTCDateTime
from
obspy.core
import
Stream
from
sohstationviewer.conf
import
constants
from
sohstationviewer.conf.constants
import
SOFTWARE_VERSION
from
sohstationviewer.model.reftek_data.reftek_reader.log_file_reader
import
(
LogFileReader
,
process_mass_poss_line
,
)
...
...
@@ -26,6 +29,24 @@ from sohstationviewer.model.reftek_data.reftek_reader import core, soh_packet
from
sohstationviewer.model.reftek_data.log_info
import
LogInfo
def
format_timestamp_as_mass_pos_time
(
timestamp
:
float
)
->
str
:
"""
Format a UTC timestamp in the format of a mass-position time in SOH
messages.
:param timestamp: the UTC timestamp to format
:return: the formatted time string
"""
# We trim the last three character because the %f format character has a
# millisecond precision (6 characters), while the time format we use only
# has a microsecond precision (3 characters).
return
UTCDateTime
(
timestamp
).
strftime
(
'
%Y:%j:%H:%M:%S.%f
'
)[:
-
3
]
format_timestamp_as_mass_pos_time
=
np
.
vectorize
(
format_timestamp_as_mass_pos_time
,
otypes
=
[
str
]
)
class
RT130
(
GeneralData
):
"""
read and process reftek file into object with properties can be used to
...
...
@@ -114,6 +135,32 @@ class RT130(GeneralData):
# this happens when there is text or ascii only in the data
self
.
data_time
[
key
]
=
[
self
.
read_start
,
self
.
read_end
]
for
key
in
self
.
log_data
:
if
key
==
'
TEXT
'
:
continue
current_time
=
datetime
.
datetime
.
now
().
ctime
()
soh_header
=
(
f
'
SOHStationViewer: v
{
SOFTWARE_VERSION
}
'
f
'
Run time (UTC):
{
current_time
}
\n
'
)
soh_footer
=
''
if
self
.
include_masspos_in_soh_messages
:
soh_footer
+=
'
\n\n
Mass-positions:
\n
'
mass_pos_lines
=
[]
for
chan
in
self
.
mass_pos_data
[
key
]:
chan_data
=
self
.
mass_pos_data
[
key
][
chan
]
# We combined all data into one trace above
trace
=
chan_data
[
'
tracesInfo
'
][
0
]
times
=
format_timestamp_as_mass_pos_time
(
trace
[
'
times
'
])
data
=
trace
[
'
data
'
].
astype
(
times
.
dtype
)
formatted_lines
=
[
f
'
LPMP
{
time
}
{
chan
[
-
1
]
}
{
mass_position
}
'
for
(
time
,
mass_position
)
in
zip
(
times
,
data
)
]
mass_pos_lines
.
extend
(
formatted_lines
)
soh_footer
+=
'
\n
'
.
join
(
mass_pos_lines
)
soh_messages
=
self
.
log_data
[
key
][
'
SOH
'
]
soh_messages
[
0
]
=
soh_header
+
soh_messages
[
0
]
+
soh_footer
def
read_log_files
(
self
):
"""
Read data from self.rt130_log_files and store it in self.log_data
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment