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
26d90080
Commit
26d90080
authored
9 years ago
by
Eddie McWhirter
Browse files
Options
Downloads
Patches
Plain Diff
Add comments for URL template and others.
parent
09aa375c
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
geomagio/pcdcp/PCDCPFactory.py
+14
-8
14 additions, 8 deletions
geomagio/pcdcp/PCDCPFactory.py
geomagio/pcdcp/PCDCPParser_test.py
+2
-1
2 additions, 1 deletion
geomagio/pcdcp/PCDCPParser_test.py
with
16 additions
and
9 deletions
geomagio/pcdcp/PCDCPFactory.py
+
14
−
8
View file @
26d90080
...
...
@@ -10,7 +10,7 @@ from geomagio import ChannelConverter
# pattern for pcdcp file names
PCDCP_FILE_PATTERN
=
'
%(obs)s%(y)s%(j)s.
min
'
PCDCP_FILE_PATTERN
=
'
%(obs)s%(y)s%(j)s.
%(i)s
'
def
read_url
(
url
):
...
...
@@ -50,10 +50,15 @@ class PCDCPFactory(TimeseriesFactory):
----------
urlTemplate : str
A string that contains any of the following replacement patterns:
-
'
%(i)s
'
: interval abbreviation
-
'
%(interval)s
'
interval name
-
'
%(julian)s
'
julian day formatted as JJJ
-
'
%(obs)s
'
lowercase observatory code
-
'
%(OBS)s
'
uppercase observatory code
-
'
%(t)s
'
type abbreviation
-
'
%(type)s
'
type name
-
'
%(year)s
'
year formatted as YYYY
-
'
%(
julian)s
'
julian day
formatted as
JJJ
-
'
%(
ymd)s
'
time
formatted as
YYYYMMDD
See Also
--------
...
...
@@ -72,15 +77,15 @@ class PCDCPFactory(TimeseriesFactory):
Parameters
----------
observatory : str
observatory code.
3-letter
observatory code.
starttime : obspy.core.UTCDateTime
t
ime of first sample.
T
ime of first sample.
endtime : obspy.core.UTCDateTime
t
ime of last sample.
T
ime of last sample.
type : {
'
variation
'
,
'
quasi-definitive
'
}
d
ata type.
D
ata type.
interval : {
'
minute
'
,
'
second
'
}
d
ata interval.
D
ata interval.
Returns
-------
...
...
@@ -120,7 +125,7 @@ class PCDCPFactory(TimeseriesFactory):
Returns
-------
obspy.core.Stream
p
arsed data.
P
arsed data.
"""
parser
=
PCDCPParser
()
parser
.
parse
(
pcdcpString
)
...
...
@@ -141,6 +146,7 @@ class PCDCPFactory(TimeseriesFactory):
starttime
=
obspy
.
core
.
UTCDateTime
(
start
)
endtime
=
obspy
.
core
.
UTCDateTime
(
end
)
# TODO - this seems fishy, data is a 2-D array containing a 1-D array...
data
=
parser
.
data
length
=
len
(
data
[
data
.
keys
()[
0
]][
0
])
rate
=
(
length
-
1
)
/
(
endtime
-
starttime
)
...
...
This diff is collapsed.
Click to expand it.
geomagio/pcdcp/PCDCPParser_test.py
+
2
−
1
View file @
26d90080
...
...
@@ -29,6 +29,7 @@ def test__parse_header():
parser
.
_parse_header
(
'
BOU 2015 001 01-Jan-15 HEZF 0.01nT
'
+
'
File Version 2.00
'
)
assert_equals
(
parser
.
headers
[
'
date
'
],
'
01-Jan-15
'
)
assert_equals
(
parser
.
headers
[
'
observatory
'
],
'
BOU
'
)
assert_equals
(
parser
.
headers
[
'
year
'
],
'
2015
'
)
assert_equals
(
parser
.
headers
[
'
date
'
],
'
01
-Jan-15
'
)
assert_equals
(
parser
.
headers
[
'
yearday
'
],
'
0
01
'
)
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