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
a1c770ea
Commit
a1c770ea
authored
4 years ago
by
Cain, Payton David
Browse files
Options
Downloads
Patches
Plain Diff
Implement step timeshift method
parent
4a3789ea
No related branches found
Branches containing commit
No related tags found
Tags containing commit
2 merge requests
!146
Release CMO metadata to production
,
!17
Implement hourly/daily filtering products
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
geomagio/algorithm/FilterAlgorithm.py
+9
-3
9 additions, 3 deletions
geomagio/algorithm/FilterAlgorithm.py
with
9 additions
and
3 deletions
geomagio/algorithm/FilterAlgorithm.py
+
9
−
3
View file @
a1c770ea
...
...
@@ -43,6 +43,12 @@ STEPS = [
]
def
get_step_time_shift
(
step
):
input_sample_period
=
step
[
"
input_sample_period
"
]
numtaps
=
len
(
step
[
"
window
"
])
return
input_sample_period
*
((
numtaps
-
1
)
/
2
)
class
FilterAlgorithm
(
Algorithm
):
"""
Filter Algorithm that filters and downsamples data
...
...
@@ -226,13 +232,13 @@ class FilterAlgorithm(Algorithm):
window
=
window
/
sum
(
window
)
# first output timestamp is in the center of the filter window for firfilters
# center output timestamp is in the center of the filter window for averages
filter_time_shift
=
input_sample_period
*
((
numtaps
-
1
)
/
2
)
shift
=
get_step_time_shift
(
step
)
out
=
Stream
()
for
trace
in
stream
:
# data to filter
data
=
trace
.
data
starttime
,
data
=
self
.
check_misalignment
(
step
,
data
,
trace
.
stats
.
starttime
,
filter_time_
shift
step
,
data
,
trace
.
stats
.
starttime
,
shift
)
if
len
(
data
)
<
numtaps
:
continue
...
...
@@ -336,7 +342,7 @@ class FilterAlgorithm(Algorithm):
end
=
(
start
+
intervals
)
-
step
[
"
input_sample_period
"
]
return
(
start
,
end
)
shift
=
len
(
step
[
"
window
"
])
//
2
shift
=
get_step_time_shift
(
step
)
shift_step
=
shift
*
step
[
"
input_sample_period
"
]
start
=
start
-
shift_step
end
=
end
+
shift_step
...
...
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