Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
geomag-algorithms
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
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
ghsc
National Geomagnetism Program
geomag-algorithms
Commits
d7bb8f90
Commit
d7bb8f90
authored
6 years ago
by
arigdon-usgs
Browse files
Options
Downloads
Patches
Plain Diff
Fixed linting and spacing errors and cleaned up code
parent
3224e084
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
geomagio/TimeseriesUtility.py
+4
-3
4 additions, 3 deletions
geomagio/TimeseriesUtility.py
test/TimeseriesUtility_test.py
+7
-13
7 additions, 13 deletions
test/TimeseriesUtility_test.py
with
11 additions
and
16 deletions
geomagio/TimeseriesUtility.py
+
4
−
3
View file @
d7bb8f90
...
...
@@ -236,15 +236,16 @@ def merge_streams(*streams):
=======
=======
<<<<<<<
HEAD
>>>>>>>
fixed
rebasing
issues
# print('\n masked trace \n')
# print(masked_trace)
# trim masked trace to the same size as other traces and add back to merged stream
=======
>>>>>>>
Fixed
linting
and
spacing
errors
and
cleaned
up
code
if
masked_trace
:
masked_trace
.
trim
(
merged
[
0
].
stats
.
starttime
,
merged
[
0
].
stats
.
endtime
)
masked_trace
.
trim
(
merged
[
0
].
stats
.
starttime
,
merged
[
0
].
stats
.
endtime
)
merged
+=
masked_trace
# print('\n after merging masked trace back in \n')
# print(merged)
<<<<<<<
HEAD
...
...
This diff is collapsed.
Click to expand it.
test/TimeseriesUtility_test.py
+
7
−
13
View file @
d7bb8f90
...
...
@@ -114,6 +114,7 @@ def test_get_merged_gaps():
assert_equals
(
gap
[
0
],
UTCDateTime
(
'
2015-01-01T00:00:05Z
'
))
assert_equals
(
gap
[
1
],
UTCDateTime
(
'
2015-01-01T00:00:07Z
'
))
def
test_merge_streams
():
"""
TimeseriesUtility_test.test_merge_streams()
...
...
@@ -128,26 +129,19 @@ def test_merge_streams():
npts1
=
len
(
trace1
.
data
)
npts2
=
len
(
trace4
.
data
)
timeseries1
=
Stream
(
traces
=
[
trace1
,
trace2
,
trace3
])
timeseries2
=
Stream
(
traces
=
[
trace4
,
trace5
,
trace6
])
timeseries2
=
Stream
(
traces
=
[
trace4
,
trace5
,
trace6
])
for
trace
in
timeseries1
:
trace
.
stats
.
starttime
=
UTCDateTime
(
'
2018-01-01T00:00:00Z
'
)
trace
.
stats
.
npts
=
npts1
for
trace
in
timeseries2
:
trace
.
stats
.
starttime
=
UTCDateTime
(
'
2018-01-01T00:02:00Z
'
)
trace
.
stats
.
npts
=
npts2
print
(
timeseries1
)
Merged_streams1
=
TimeseriesUtility
.
merge_streams
(
timeseries1
)
print
(
Merged_streams1
)
assert_equals
(
len
(
timeseries1
),
len
(
Merged_streams1
))
# Make sure the empty 'F' was not removed from stream
assert_equals
(
len
(
timeseries1
),
len
(
Merged_streams1
))
# Merge multiple streams with overlapping timestamps
timeseries
=
timeseries1
+
timeseries2
print
(
timeseries
)
Merged_streams
=
TimeseriesUtility
.
merge_streams
(
timeseries
)
print
(
'
\n
Merged Streams before clean
\n
'
)
print
(
Merged_streams
)
assert_equals
(
len
(
Merged_streams
),
len
(
timeseries1
))
assert_equals
(
Merged_streams
[
0
])
\ No newline at end of file
assert_equals
(
len
(
Merged_streams
),
len
(
timeseries1
))
assert_equals
(
len
(
Merged_streams
[
0
].
data
),
6
)
assert_equals
(
len
(
Merged_streams
[
2
]),
6
)
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