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
f06188a9
Commit
f06188a9
authored
9 years ago
by
Eddie McWhirter
Browse files
Options
Downloads
Patches
Plain Diff
Move math from value formatter to data formatter.
parent
00d62c45
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
geomagio/pcdcp/PCDCPWriter.py
+12
-11
12 additions, 11 deletions
geomagio/pcdcp/PCDCPWriter.py
with
12 additions
and
11 deletions
geomagio/pcdcp/PCDCPWriter.py
+
12
−
11
View file @
f06188a9
...
...
@@ -2,6 +2,7 @@
from
cStringIO
import
StringIO
from
geomagio
import
ChannelConverter
import
numpy
from
obspy.core
import
Stream
import
PCDCPParser
from
datetime
import
datetime
...
...
@@ -71,18 +72,19 @@ class PCDCPWriter(object):
"""
buf
=
[]
# create new stream
timeseriesLocal
=
Stream
()
# Use a copy of the trace so that we don't modify the original.
timeseriesLocal
=
timeseries
.
copy
()
for
trace
in
timeseries
:
traceLocal
=
trace
.
copy
()
if
traceLocal
.
stats
.
channel
==
'
D
'
:
traceLocal
.
data
=
\
ChannelConverter
.
get_minutes_from_radians
(
traceLocal
.
data
)
if
timeseriesLocal
.
select
(
channel
=
'
D
'
):
d
=
timeseriesLocal
.
select
(
channel
=
'
D
'
)
d
[
0
].
data
=
ChannelConverter
.
get_minutes_from_radians
(
d
[
0
].
data
)
traceLocal
.
data
=
\
numpy
.
round
(
numpy
.
multiply
(
traceLocal
.
data
,
100
)).
astype
(
int
)
# TODO - is this doing anything?
i
=
0
for
trace
in
timeseriesLocal
:
timeseriesLocal
[
i
].
trace
=
numpy
.
round
(
numpy
.
multiply
(
trace
,
100
))
i
+=
1
timeseriesLocal
.
append
(
traceLocal
)
traces
=
[
timeseriesLocal
.
select
(
channel
=
c
)[
0
]
for
c
in
channels
]
starttime
=
float
(
traces
[
0
].
stats
.
starttime
)
...
...
@@ -116,8 +118,7 @@ class PCDCPWriter(object):
return
'
{0:0>4d} {2: >8d} {3: >8d} {4: >8d} {5: >8d}
\n
'
.
format
(
totalMinutes
,
int
(
time
.
microsecond
/
1000
),
*
[
self
.
empty_value
if
numpy
.
isnan
(
val
)
else
int
(
round
(
val
*
100
))
*
[
self
.
empty_value
if
numpy
.
isnan
(
val
)
else
val
for
val
in
values
])
@classmethod
...
...
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