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
eac313cd
Commit
eac313cd
authored
4 years ago
by
Jeremy M Fee
Committed by
Cain, Payton David
4 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Add function to calculate realtime start/end from interval
parent
41ee4253
No related branches found
No related tags found
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/Controller.py
+9
-3
9 additions, 3 deletions
geomagio/Controller.py
with
9 additions
and
3 deletions
geomagio/Controller.py
+
9
−
3
View file @
eac313cd
...
@@ -575,6 +575,14 @@ def get_output_factory(args):
...
@@ -575,6 +575,14 @@ def get_output_factory(args):
return
output_factory
return
output_factory
def
get_realtime_interval
(
interval_seconds
:
int
)
->
Tuple
[
UTCDateTime
,
UTCDateTime
]:
# calculate endtime/starttime
now
=
UTCDateTime
()
endtime
=
UTCDateTime
(
now
.
year
,
now
.
month
,
now
.
day
,
now
.
hour
,
now
.
minute
)
starttime
=
endtime
-
interval_seconds
return
starttime
,
endtime
def
main
(
args
):
def
main
(
args
):
"""
command line factory for geomag algorithms
"""
command line factory for geomag algorithms
...
@@ -619,9 +627,7 @@ def main(args):
...
@@ -619,9 +627,7 @@ def main(args):
else
:
else
:
args
.
realtime
=
600
args
.
realtime
=
600
# calculate endtime/starttime
# calculate endtime/starttime
now
=
UTCDateTime
()
args
.
starttime
,
args
.
endtime
=
get_realtime_interval
(
args
.
realtime
)
args
.
endtime
=
UTCDateTime
(
now
.
year
,
now
.
month
,
now
.
day
,
now
.
hour
,
now
.
minute
)
args
.
starttime
=
args
.
endtime
-
args
.
realtime
if
args
.
observatory_foreach
:
if
args
.
observatory_foreach
:
observatory
=
args
.
observatory
observatory
=
args
.
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