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
17dc818c
Commit
17dc818c
authored
4 years ago
by
Cain, Payton David
Browse files
Options
Downloads
Patches
Plain Diff
Add comments
parent
94ebbcb3
No related branches found
Branches containing commit
No related tags found
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
+8
-9
8 additions, 9 deletions
geomagio/processing/update_legacy.py
with
8 additions
and
9 deletions
geomagio/processing/update_legacy.py
+
8
−
9
View file @
17dc818c
...
@@ -28,15 +28,14 @@ def update_legacy(
...
@@ -28,15 +28,14 @@ def update_legacy(
edge_host
:
str
=
os
.
getenv
(
"
EDGE_HOST
"
,
"
cwbpub.cr.usgs.gov
"
),
edge_host
:
str
=
os
.
getenv
(
"
EDGE_HOST
"
,
"
cwbpub.cr.usgs.gov
"
),
edge_port
:
int
=
os
.
getenv
(
"
EDGE_PORT
"
,
2061
),
edge_port
:
int
=
os
.
getenv
(
"
EDGE_PORT
"
,
2061
),
):
):
# get specified time interval from time that script is ran
current_time
=
datetime
.
utcnow
()
current_time
=
datetime
.
utcnow
()
current_time_string
=
current_time
.
strftime
(
"
%Y-%m-%d
"
)
current_time_string
=
current_time
.
strftime
(
"
%Y-%m-%d
"
)
endtime
=
UTCDateTime
(
current_time_string
)
-
1
endtime
=
UTCDateTime
(
current_time_string
)
-
1
starttime
=
endtime
-
realtime_interval
starttime
=
endtime
-
realtime_interval
# create factory for script outputs
timeseries_factory
=
EdgeFactory
(
host
=
edge_host
,
port
=
edge_port
,
interval
=
interval
)
timeseries_factory
=
EdgeFactory
(
host
=
edge_host
,
port
=
edge_port
,
interval
=
interval
)
# request data across time interval
output_timeseries
=
timeseries_factory
.
get_timeseries
(
output_timeseries
=
timeseries_factory
.
get_timeseries
(
observatory
=
observatory
,
observatory
=
observatory
,
starttime
=
starttime
,
starttime
=
starttime
,
...
@@ -44,16 +43,16 @@ def update_legacy(
...
@@ -44,16 +43,16 @@ def update_legacy(
channels
=
channels
,
channels
=
channels
,
type
=
"
variation
"
,
type
=
"
variation
"
,
)
)
# find gaps in legacy data
output_gaps
=
get_merged_gaps
(
get_stream_gaps
(
output_timeseries
))
output_gaps
=
get_merged_gaps
(
get_stream_gaps
(
output_timeseries
))
# exit script if legacy data is complete
if
len
(
output_gaps
)
==
0
:
if
len
(
output_gaps
)
==
0
:
return
return
# get input/output deltas for timeseries processing
input_interval
=
get_previous_interval
(
interval
)
input_interval
=
get_previous_interval
(
interval
)
input_delta
=
get_delta_from_interval
(
input_interval
)
input_delta
=
get_delta_from_interval
(
input_interval
)
output_delta
=
get_delta_from_interval
(
interval
)
output_delta
=
get_delta_from_interval
(
interval
)
# configure controller to process gaps
controller
=
Controller
(
controller
=
Controller
(
algorithm
=
FilterAlgorithm
(
algorithm
=
FilterAlgorithm
(
input_sample_period
=
input_delta
,
output_sample_period
=
output_delta
input_sample_period
=
input_delta
,
output_sample_period
=
output_delta
...
@@ -63,7 +62,7 @@ def update_legacy(
...
@@ -63,7 +62,7 @@ def update_legacy(
),
),
outputFactory
=
timeseries_factory
,
outputFactory
=
timeseries_factory
,
)
)
# gather, process, and write data into legacy gaps
for
output_gap
in
output_gaps
:
for
output_gap
in
output_gaps
:
controller
.
run
(
controller
.
run
(
observatory
=
(
observatory
,),
observatory
=
(
observatory
,),
...
...
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