Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
SOHViewer
Manage
Activity
Members
Labels
Plan
Issues
11
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
2
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
c7b66da9
Commit
c7b66da9
authored
1 year ago
by
Lan Dam
Browse files
Options
Downloads
Patches
Plain Diff
combine get_wf_plot_info() into get_chan_plot_info
parent
a41506c6
No related branches found
No related tags found
1 merge request
!131
combine get wf plot info to get chan plot info
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
sohstationviewer/database/extract_data.py
+12
-31
12 additions, 31 deletions
sohstationviewer/database/extract_data.py
with
12 additions
and
31 deletions
sohstationviewer/database/extract_data.py
+
12
−
31
View file @
c7b66da9
...
@@ -5,7 +5,7 @@ from sohstationviewer.database.process_db import execute_db_dict, execute_db
...
@@ -5,7 +5,7 @@ from sohstationviewer.database.process_db import execute_db_dict, execute_db
from
sohstationviewer.conf.dbSettings
import
dbConf
from
sohstationviewer.conf.dbSettings
import
dbConf
def
get_chan_plot_info
(
org_chan_id
:
str
,
chan_info
:
Dict
,
data_type
:
str
,
def
get_chan_plot_info
(
org_chan_id
:
str
,
data_type
:
str
,
color_mode
:
ColorMode
=
'
B
'
)
->
Dict
:
color_mode
:
ColorMode
=
'
B
'
)
->
Dict
:
"""
"""
Given chanID read from raw data file and detected dataType
Given chanID read from raw data file and detected dataType
...
@@ -24,10 +24,10 @@ def get_chan_plot_info(org_chan_id: str, chan_info: Dict, data_type: str,
...
@@ -24,10 +24,10 @@ def get_chan_plot_info(org_chan_id: str, chan_info: Dict, data_type: str,
chan
=
'
VM?
'
chan
=
'
VM?
'
if
org_chan_id
.
startswith
(
'
MassPos
'
):
if
org_chan_id
.
startswith
(
'
MassPos
'
):
chan
=
'
MassPos?
'
chan
=
'
MassPos?
'
if
org_chan_id
.
startswith
(
'
DS
'
):
chan
=
'
SEISMIC
'
if
org_chan_id
.
startswith
(
'
Event DS
'
):
if
org_chan_id
.
startswith
(
'
Event DS
'
):
chan
=
'
Event DS?
'
chan
=
'
Event DS?
'
if
org_chan_id
.
startswith
(
'
DS
'
):
chan
=
'
DS?
'
if
org_chan_id
.
startswith
(
'
Disk Usage
'
):
if
org_chan_id
.
startswith
(
'
Disk Usage
'
):
chan
=
'
Disk Usage?
'
chan
=
'
Disk Usage?
'
if
dbConf
[
'
seisRE
'
].
match
(
chan
):
if
dbConf
[
'
seisRE
'
].
match
(
chan
):
...
@@ -46,17 +46,13 @@ def get_chan_plot_info(org_chan_id: str, chan_info: Dict, data_type: str,
...
@@ -46,17 +46,13 @@ def get_chan_plot_info(org_chan_id: str, chan_info: Dict, data_type: str,
sql
=
(
f
"
{
o_sql
}
WHERE channel=
'
{
chan
}
'
and C.param=P.param
"
sql
=
(
f
"
{
o_sql
}
WHERE channel=
'
{
chan
}
'
and C.param=P.param
"
f
"
and dataType=
'
{
data_type
}
'"
)
f
"
and dataType=
'
{
data_type
}
'"
)
chan_db_info
=
execute_db_dict
(
sql
)
chan_db_info
=
execute_db_dict
(
sql
)
seismic_label
=
None
if
len
(
chan_db_info
)
==
0
:
if
len
(
chan_db_info
)
==
0
:
chan_db_info
=
execute_db_dict
(
chan_db_info
=
execute_db_dict
(
f
"
{
o_sql
}
WHERE channel=
'
DEFAULT
'
and C.param=P.param
"
)
f
"
{
o_sql
}
WHERE channel=
'
DEFAULT
'
and C.param=P.param
"
)
else
:
else
:
if
chan_db_info
[
0
][
'
channel
'
]
==
'
SEISMIC
'
:
if
chan_db_info
[
0
][
'
channel
'
]
==
'
SEISMIC
'
:
try
:
seismic_label
=
get_seismic_chan_label
(
org_chan_id
)
chan_db_info
[
0
][
'
label
'
]
=
dbConf
[
'
seisLabel
'
][
org_chan_id
[
-
1
]]
except
KeyError
:
chan_db_info
[
0
][
'
label
'
]
=
str
(
chan_info
[
'
samplerate
'
])
chan_db_info
[
0
][
'
channel
'
]
=
org_chan_id
chan_db_info
[
0
][
'
channel
'
]
=
org_chan_id
chan_db_info
[
0
][
'
label
'
]
=
(
chan_db_info
[
0
][
'
label
'
]
=
(
...
@@ -68,6 +64,8 @@ def get_chan_plot_info(org_chan_id: str, chan_info: Dict, data_type: str,
...
@@ -68,6 +64,8 @@ def get_chan_plot_info(org_chan_id: str, chan_info: Dict, data_type: str,
else
chan_db_info
[
0
][
'
fixPoint
'
])
else
chan_db_info
[
0
][
'
fixPoint
'
])
if
chan_db_info
[
0
][
'
label
'
].
strip
()
==
''
:
if
chan_db_info
[
0
][
'
label
'
].
strip
()
==
''
:
chan_db_info
[
0
][
'
label
'
]
=
chan_db_info
[
0
][
'
channel
'
]
chan_db_info
[
0
][
'
label
'
]
=
chan_db_info
[
0
][
'
channel
'
]
elif
seismic_label
is
not
None
:
chan_db_info
[
0
][
'
label
'
]
=
seismic_label
else
:
else
:
chan_db_info
[
0
][
'
label
'
]
=
'
-
'
.
join
([
chan_db_info
[
0
][
'
channel
'
],
chan_db_info
[
0
][
'
label
'
]
=
'
-
'
.
join
([
chan_db_info
[
0
][
'
channel
'
],
chan_db_info
[
0
][
'
label
'
]])
chan_db_info
[
0
][
'
label
'
]])
...
@@ -76,30 +74,13 @@ def get_chan_plot_info(org_chan_id: str, chan_info: Dict, data_type: str,
...
@@ -76,30 +74,13 @@ def get_chan_plot_info(org_chan_id: str, chan_info: Dict, data_type: str,
return
chan_db_info
[
0
]
return
chan_db_info
[
0
]
def
get_
wf_plot_info
(
org_chan_id
:
str
,
*
args
,
**
kwargs
)
->
Dict
:
def
get_
seismic_chan_label
(
chan_id
)
:
"""
"""
:param org_chan_id: channel name read from data source
Get label for chan_id in which data stream can use chan_id for label while
:param chan_info: to be compliant with get_chan_plot_info()
other seismic need to add coordinate to chan_id for label
:param data_type: to be compliant with get_chan_plot_info()
:param chan_id: name of channel
:param color_mode: to be compliant with get_chan_plot_info()
:return label: label to put in front of the plot of the channel
:return info of channel read from DB which is used for plotting
"""
"""
# Waveform plot's color is fixed to NULL in the database, so we do not need
# to get the valueColors columns from the database.
chan_info
=
execute_db_dict
(
"
SELECT param, plotType, height
"
"
FROM Parameters WHERE param=
'
Seismic data
'"
)
# The plotting API still requires that the key 'valueColors' is mapped to
# something, so we are setting it to None.
chan_info
[
0
][
'
valueColors
'
]
=
None
chan_info
[
0
][
'
label
'
]
=
get_chan_label
(
org_chan_id
)
chan_info
[
0
][
'
unit
'
]
=
''
chan_info
[
0
][
'
channel
'
]
=
'
SEISMIC
'
chan_info
[
0
][
'
convertFactor
'
]
=
1
return
chan_info
[
0
]
def
get_chan_label
(
chan_id
):
if
chan_id
.
startswith
(
"
DS
"
):
if
chan_id
.
startswith
(
"
DS
"
):
label
=
chan_id
label
=
chan_id
else
:
else
:
...
...
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