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
4
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
23fbceff
Commit
23fbceff
authored
1 year ago
by
Kien Le
Browse files
Options
Downloads
Patches
Plain Diff
Read ASCII files
parent
770b191b
No related branches found
No related tags found
1 merge request
!132
Fast MSEED read
Pipeline
#2582
passed with stage
Stage: Build Env and Test
in 2 minutes and 53 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
sohstationviewer/model/mseed/read_mseed_experiment/mseed_reader.py
+32
-19
32 additions, 19 deletions
...nviewer/model/mseed/read_mseed_experiment/mseed_reader.py
with
32 additions
and
19 deletions
sohstationviewer/model/mseed/read_mseed_experiment/mseed_reader.py
+
32
−
19
View file @
23fbceff
...
...
@@ -250,25 +250,38 @@ class RecordReader:
encoding_format
=
self
.
header_unpacker
.
unpack
(
'
b
'
,
encoding_format
)[
0
]
encoding_format
=
EncodingFormat
(
encoding_format
)
# Currently, we are extracting only the first data point in each
# record. The smallest possible amount of bytes we can extract while
# guaranteeing that we get the first data point in the record is 8,
# with Steim encodings and IEEE double precision float needing to use
# the whole buffer.
buffer
=
self
.
file
.
read
(
8
)
encoding_to_decoder
=
{
EncodingFormat
.
ASCII
:
(
lambda
a1
,
a2
:
int
(
1
)),
EncodingFormat
.
INT_16_BIT
:
decode_int16
,
EncodingFormat
.
INT_24_BIT
:
decode_int24
,
EncodingFormat
.
INT_32_BIT
:
decode_int32
,
EncodingFormat
.
IEEE_FLOAT_32_BIT
:
decode_ieee_float
,
EncodingFormat
.
IEEE_FLOAT_64_BIT
:
decode_ieee_double
,
EncodingFormat
.
STEIM_1
:
decode_steim
,
EncodingFormat
.
STEIM_2
:
decode_steim
,
}
first_data_point
=
encoding_to_decoder
[
encoding_format
](
buffer
,
self
.
data_unpacker
)
if
encoding_format
==
EncodingFormat
.
ASCII
:
# We want to read everything in the record if the encoding is
# ASCII.
record_length_exp
=
self
.
header_unpacker
.
unpack
(
'
B
'
,
self
.
blockette_1000
.
record_length
)[
0
]
record_size
=
2
**
record_length_exp
# This name does not make much sense with what we are doing here,
# but it will have to do for now.
# The size of the record includes the header, so we have to account
# for that when grabbing the data.
first_data_point
=
self
.
file
.
read
(
record_size
-
data_start
)
else
:
# Currently, we are extracting only the first data point in each
# record. The smallest possible amount of bytes we can extract
# while guaranteeing that we get the first data point in the
# record is 8, with Steim encodings and IEEE double precision
# float needing to use the whole buffer.
buffer
=
self
.
file
.
read
(
8
)
encoding_to_decoder
=
{
EncodingFormat
.
INT_16_BIT
:
decode_int16
,
EncodingFormat
.
INT_24_BIT
:
decode_int24
,
EncodingFormat
.
INT_32_BIT
:
decode_int32
,
EncodingFormat
.
IEEE_FLOAT_32_BIT
:
decode_ieee_float
,
EncodingFormat
.
IEEE_FLOAT_64_BIT
:
decode_ieee_double
,
EncodingFormat
.
STEIM_1
:
decode_steim
,
EncodingFormat
.
STEIM_2
:
decode_steim
,
}
first_data_point
=
encoding_to_decoder
[
encoding_format
](
buffer
,
self
.
data_unpacker
)
# Seek back to the start of the record so we can call this method again
# if needed.
self
.
file
.
seek
(
record_start
)
...
...
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