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
3c5fba47
Commit
3c5fba47
authored
9 years ago
by
Jeremy M Fee
Browse files
Options
Downloads
Patches
Plain Diff
Change how empty channels are detected and filtered
parent
7fea7947
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
geomagio/iaga2002/IAGA2002Parser.py
+6
-4
6 additions, 4 deletions
geomagio/iaga2002/IAGA2002Parser.py
geomagio/iaga2002/IAGA2002Writer.py
+4
-2
4 additions, 2 deletions
geomagio/iaga2002/IAGA2002Writer.py
with
10 additions
and
6 deletions
geomagio/iaga2002/IAGA2002Parser.py
+
6
−
4
View file @
3c5fba47
...
...
@@ -8,6 +8,9 @@ from datetime import datetime
EIGHTS
=
numpy
.
float64
(
'
88888.88
'
)
NINES
=
numpy
.
float64
(
'
99999.99
'
)
# placeholder channel name used when less than 4 channels are being written.
EMPTY_CHANNEL
=
'
NUL
'
class
IAGA2002Parser
(
object
):
"""
IAGA2002 parser.
...
...
@@ -166,13 +169,12 @@ class IAGA2002Parser(object):
self
.
parse_comments
()
self
.
times
=
self
.
_parsedata
[
0
]
for
channel
,
data
in
zip
(
self
.
channels
,
self
.
_parsedata
[
1
:]):
#ignore empty channels
# ignore "empty" channels
if
channel
==
EMPTY_CHANNEL
:
continue
data
=
numpy
.
array
(
data
,
dtype
=
numpy
.
float64
)
data
[
data
==
EIGHTS
]
=
numpy
.
nan
data
[
data
==
NINES
]
=
numpy
.
nan
# filter empty values
if
data
.
count
(
numpy
.
nan
)
==
len
(
data
):
continue
self
.
data
[
channel
]
=
data
self
.
_parsedata
=
None
...
...
This diff is collapsed.
Click to expand it.
geomagio/iaga2002/IAGA2002Writer.py
+
4
−
2
View file @
3c5fba47
...
...
@@ -14,8 +14,10 @@ class IAGA2002Writer(object):
"""
IAGA2002 writer.
"""
def
__init__
(
self
,
empty_value
=
IAGA2002Parser
.
NINES
):
def
__init__
(
self
,
empty_value
=
IAGA2002Parser
.
NINES
,
empty_channel
=
IAGA2002Parser
.
EMPTY_CHANNEL
):
self
.
empty_value
=
empty_value
self
.
empty_channel
=
empty_channel
def
write
(
self
,
out
,
timeseries
,
channels
):
"""
write timeseries to iaga file
...
...
@@ -232,7 +234,7 @@ class IAGA2002Writer(object):
def
_pad_to_four_channels
(
self
,
timeseries
,
channels
):
for
x
in
range
(
len
(
channels
),
4
):
channel
=
'
NUL
'
channel
=
self
.
empty_channel
channels
.
append
(
channel
)
timeseries
+=
create_empty_trace
(
timeseries
[
0
],
channel
)
...
...
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