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
b80ea5ef
Commit
b80ea5ef
authored
4 years ago
by
Cain, Payton David
Browse files
Options
Downloads
Patches
Plain Diff
Remove update_legacy script
parent
0e13e3d3
Branches
Branches containing commit
Tags
Tags containing commit
2 merge requests
!146
Release CMO metadata to production
,
!52
Update legacy
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
geomagio/processing/update_legacy.py
+0
-73
0 additions, 73 deletions
geomagio/processing/update_legacy.py
with
0 additions
and
73 deletions
geomagio/processing/update_legacy.py
deleted
100644 → 0
+
0
−
73
View file @
0e13e3d3
import
os
from
..
import
Controller
from
..edge
import
EdgeFactory
from
..algorithm
import
FilterAlgorithm
from
..TimeseriesUtility
import
(
get_delta_from_interval
,
get_previous_interval
,
get_merged_gaps
,
get_stream_gaps
,
)
from
datetime
import
datetime
from
obspy.core
import
UTCDateTime
import
typer
def
main
():
typer
.
run
(
update_legacy
)
def
update_legacy
(
observatory
:
str
,
interval
:
str
,
input_channels
:
list
,
output_channels
:
list
=
None
,
realtime_interval
:
int
=
86400
,
edge_host
:
str
=
os
.
getenv
(
"
EDGE_HOST
"
,
"
cwbpub.cr.usgs.gov
"
),
edge_port
:
int
=
os
.
getenv
(
"
EDGE_PORT
"
,
2061
),
):
# get specified time interval from time that script is ran
current_time
=
datetime
.
utcnow
()
current_time_string
=
current_time
.
strftime
(
"
%Y-%m-%d
"
)
endtime
=
UTCDateTime
(
current_time_string
)
-
1
starttime
=
endtime
-
realtime_interval
# create factory for script outputs
timeseries_factory
=
EdgeFactory
(
host
=
edge_host
,
port
=
edge_port
,
interval
=
interval
)
# request data across time interval
output_timeseries
=
timeseries_factory
.
get_timeseries
(
observatory
=
observatory
,
starttime
=
starttime
,
endtime
=
endtime
,
channels
=
channels
,
type
=
"
variation
"
,
)
# find gaps in legacy data
output_gaps
=
get_merged_gaps
(
get_stream_gaps
(
output_timeseries
))
# exit script if legacy data is complete
if
len
(
output_gaps
)
==
0
:
return
# get input/output deltas for timeseries processing
input_interval
=
get_previous_interval
(
interval
)
input_delta
=
get_delta_from_interval
(
input_interval
)
output_delta
=
get_delta_from_interval
(
interval
)
# configure controller to process gaps
controller
=
Controller
(
algorithm
=
FilterAlgorithm
(
input_sample_period
=
input_delta
,
output_sample_period
=
output_delta
),
inputFactory
=
EdgeFactory
(
host
=
edge_host
,
port
=
edge_port
,
interval
=
input_interval
),
outputFactory
=
timeseries_factory
,
)
# gather, process, and write data into legacy gaps
for
output_gap
in
output_gaps
:
controller
.
run
(
observatory
=
(
observatory
,),
starttime
=
output_gap
[
0
],
endtime
=
output_gap
[
1
],
input_channels
=
input_channels
,
output_channels
=
output_channels
,
)
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