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
807ca9a0
Commit
807ca9a0
authored
3 months ago
by
Shavers, Nicholas H
Browse files
Options
Downloads
Patches
Plain Diff
import module syntax i.e __init__.py used
parent
2ce501ae
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!380
xmlfactory mvp
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
geomagio/Controller.py
+3
-4
3 additions, 4 deletions
geomagio/Controller.py
geomagio/xml/XMLFactory.py
+2
-1
2 additions, 1 deletion
geomagio/xml/XMLFactory.py
geomagio/xml/__init__.py
+8
-0
8 additions, 0 deletions
geomagio/xml/__init__.py
with
13 additions
and
5 deletions
geomagio/Controller.py
+
3
−
4
View file @
807ca9a0
...
@@ -7,8 +7,6 @@ from typing import List, Optional, Tuple, Union
...
@@ -7,8 +7,6 @@ from typing import List, Optional, Tuple, Union
from
obspy.core
import
Stream
,
UTCDateTime
from
obspy.core
import
Stream
,
UTCDateTime
from
geomagio.api.xml.XMLFactory
import
XMLFactory
from
.algorithm
import
Algorithm
,
algorithms
,
AlgorithmException
,
FilterAlgorithm
from
.algorithm
import
Algorithm
,
algorithms
,
AlgorithmException
,
FilterAlgorithm
from
.DerivedTimeseriesFactory
import
DerivedTimeseriesFactory
from
.DerivedTimeseriesFactory
import
DerivedTimeseriesFactory
from
.PlotTimeseriesFactory
import
PlotTimeseriesFactory
from
.PlotTimeseriesFactory
import
PlotTimeseriesFactory
...
@@ -25,6 +23,7 @@ from . import imfv122
...
@@ -25,6 +23,7 @@ from . import imfv122
from
.
import
imfv283
from
.
import
imfv283
from
.
import
temperature
from
.
import
temperature
from
.
import
vbf
from
.
import
vbf
from
.
import
xml
class
Controller
(
object
):
class
Controller
(
object
):
...
@@ -562,7 +561,7 @@ def get_input_factory(args):
...
@@ -562,7 +561,7 @@ def get_input_factory(args):
**
input_factory_args
,
**
input_factory_args
,
)
)
elif
input_type
==
"
xml
"
:
elif
input_type
==
"
xml
"
:
input_factory
=
XMLFactory
(
**
input_factory_args
)
input_factory
=
xml
.
XMLFactory
(
**
input_factory_args
)
# wrap stream
# wrap stream
if
input_stream
is
not
None
:
if
input_stream
is
not
None
:
input_factory
=
StreamTimeseriesFactory
(
input_factory
=
StreamTimeseriesFactory
(
...
@@ -649,7 +648,7 @@ def get_output_factory(args):
...
@@ -649,7 +648,7 @@ def get_output_factory(args):
**
output_factory_args
,
**
output_factory_args
,
)
)
elif
output_type
==
"
xml
"
:
elif
output_type
==
"
xml
"
:
output_factory
=
XMLFactory
(
**
output_factory_args
)
output_factory
=
xml
.
XMLFactory
(
**
output_factory_args
)
# wrap stream
# wrap stream
if
output_stream
is
not
None
:
if
output_stream
is
not
None
:
output_factory
=
StreamTimeseriesFactory
(
output_factory
=
StreamTimeseriesFactory
(
...
...
This diff is collapsed.
Click to expand it.
geomagio/
api/
xml/XMLFactory.py
→
geomagio/xml/XMLFactory.py
+
2
−
1
View file @
807ca9a0
...
@@ -185,12 +185,13 @@ class XMLFactory(TimeseriesFactory):
...
@@ -185,12 +185,13 @@ class XMLFactory(TimeseriesFactory):
# Create Data element
# Create Data element
data_elem
=
ET
.
SubElement
(
root
,
"
Data
"
)
data_elem
=
ET
.
SubElement
(
root
,
"
Data
"
)
#
All traces should have the same starttime and delta per convention
#
For each sample, create and add as sub element of <data>...</data>
for
i
in
range
(
npts
):
for
i
in
range
(
npts
):
sample
=
ET
.
SubElement
(
data_elem
,
"
Sample
"
)
sample
=
ET
.
SubElement
(
data_elem
,
"
Sample
"
)
for
trace
in
timeseries
:
for
trace
in
timeseries
:
ch_name
=
trace
.
stats
.
channel
ch_name
=
trace
.
stats
.
channel
value
=
trace
.
data
[
i
]
if
i
<
len
(
trace
.
data
)
else
""
value
=
trace
.
data
[
i
]
if
i
<
len
(
trace
.
data
)
else
""
# For each channels trace, get data point, add as a sub element of <sample>...</sample>
ET
.
SubElement
(
sample
,
ch_name
).
text
=
f
"
{
value
}
"
ET
.
SubElement
(
sample
,
ch_name
).
text
=
f
"
{
value
}
"
# Generate the XML string
# Generate the XML string
...
...
This diff is collapsed.
Click to expand it.
geomagio/xml/__init__.py
0 → 100644
+
8
−
0
View file @
807ca9a0
"""
IO Module for Edge Format
"""
from
__future__
import
absolute_import
from
.XMLFactory
import
XMLFactory
__all__
=
[
"
XMLFactory
"
]
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