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
ff400625
Commit
ff400625
authored
2 years ago
by
Wernle, Alexandra Nicole
Committed by
Wilbur, Spencer Franklin
2 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Working on Jeremy's comments
parent
22c4a0ac
No related branches found
No related tags found
2 merge requests
!223
Attempt StringIO after failed BytesIO file read
,
!212
Draft: Reattempt to merge old Iris-Factory Branch from Swilbur's local repo
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
geomagio/processing/copy_absolutes.py
+21
-13
21 additions, 13 deletions
geomagio/processing/copy_absolutes.py
with
21 additions
and
13 deletions
geomagio/processing/copy_absolutes.py
+
21
−
13
View file @
ff400625
...
@@ -7,7 +7,8 @@ Created on Thu Jul 7 11:05:19 2022
...
@@ -7,7 +7,8 @@ Created on Thu Jul 7 11:05:19 2022
import
json
import
json
import
os
import
os
from
datetime
import
date
,
datetime
,
time
,
timedelta
from
datetime
import
date
,
datetime
,
time
,
timedelta
from
typing
import
List
from
typing
import
List
,
Optional
from
pathlib
import
Path
import
typer
import
typer
from
enum
import
Enum
from
enum
import
Enum
...
@@ -19,9 +20,9 @@ from ..residual import Reading, WebAbsolutesFactory, SpreadsheetAbsolutesFactory
...
@@ -19,9 +20,9 @@ from ..residual import Reading, WebAbsolutesFactory, SpreadsheetAbsolutesFactory
TODAY
=
datetime
.
combine
(
date
.
today
(),
time
(
0
,
0
,
0
))
TODAY
=
datetime
.
combine
(
date
.
today
(),
time
(
0
,
0
,
0
))
class
f
actor
ies
(
str
,
Enum
):
class
ResidualF
actor
y
(
str
,
Enum
):
web_absolutes_factory
=
"
web_absolutes_factory
"
SPREADSHEET
=
"
spreadsheet
"
spreadsheet_factory
=
"
spreadsheet_factory
"
WEB_ABSOLUTES
=
"
webabsolutes
"
def
copy_absolutes
(
def
copy_absolutes
(
...
@@ -46,19 +47,23 @@ def copy_absolutes(
...
@@ -46,19 +47,23 @@ def copy_absolutes(
help
=
"
URL to web absolutes service
"
,
help
=
"
URL to web absolutes service
"
,
metavar
=
"
URL
"
,
metavar
=
"
URL
"
,
),
),
spreadsheets_dir
:
str
=
typer
.
Option
(
directory
:
Optional
[
Path
]
=
typer
.
Option
(
default
=
"
---
"
,
help
=
"
Directory to residual spreadsheets
"
,
metavar
=
"
DIR
"
None
,
exists
=
True
,
file_okay
=
False
,
dir_okay
=
True
,
writable
=
False
,
readable
=
False
,
resolve_path
=
True
,
help
=
"
Residual spreadsheet directory
"
,
),
),
# I am not sure what to specify as the default directory, I was using a local directory as a test
factory
:
ResidualFactory
=
ResidualFactory
.
WEB_ABSOLUTES
,
factory
:
factories
=
factories
.
web_absolutes_factory
,
):
):
"""
Copy absolutes from the web absolutes service OR residual spreadsheets into the metadata service.
"""
"""
Copy absolutes from the web absolutes service OR residual spreadsheets into the metadata service.
"""
print
(
f
"
Using factory:
{
factory
.
value
}
"
)
if
factory
.
value
==
ResidualFactory
.
WEB_ABSOLUTES
:
if
factory
.
value
==
factories
.
web_absolutes_factory
:
factory
=
WebAbsolutesFactory
(
url
=
web_absolutes_url
)
factory
=
WebAbsolutesFactory
(
url
=
web_absolutes_url
)
else
:
else
:
factory
=
SpreadsheetAbsolutesFactory
(
base_directory
=
spreadsheets_dir
)
factory
=
SpreadsheetAbsolutesFactory
(
base_directory
=
directory
)
readings
=
get_readings
(
readings
=
get_readings
(
factory
=
factory
,
factory
=
factory
,
...
@@ -104,7 +109,10 @@ def create_reading_metadata(reading: Reading) -> Metadata:
...
@@ -104,7 +109,10 @@ def create_reading_metadata(reading: Reading) -> Metadata:
def
get_readings
(
def
get_readings
(
factory
:
factories
,
observatory
:
str
,
starttime
:
UTCDateTime
,
endtime
:
UTCDateTime
factory
:
ResidualFactory
,
observatory
:
str
,
starttime
:
UTCDateTime
,
endtime
:
UTCDateTime
,
)
->
List
[
Reading
]:
)
->
List
[
Reading
]:
"""
Get readings from web absolutes or residual spreadsheets.
"""
Get readings from web absolutes or residual spreadsheets.
...
...
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