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
3795a9bb
Commit
3795a9bb
authored
1 month ago
by
Wilbur, Spencer Franklin
Browse files
Options
Downloads
Patches
Plain Diff
Addressed Josh's Comments
parent
d76d6285
No related branches found
No related tags found
1 merge request
!390
Added NEIC client parameters to FDSNFactory.py
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
geomagio/edge/FDSNFactory.py
+12
-32
12 additions, 32 deletions
geomagio/edge/FDSNFactory.py
with
12 additions
and
32 deletions
geomagio/edge/FDSNFactory.py
+
12
−
32
View file @
3795a9bb
...
...
@@ -69,15 +69,14 @@ class FDSNFactory(TimeseriesFactory):
Notes
-----
This is designed to read from the FDSN Client and EDGE if data is less than 1 day old, but it
currently only writes to an edge.
This is designed to read from the FDSN Client and EDGE if data is less than 1 day old
"""
def
__init__
(
self
,
base
_url
:
str
=
"
http://service.iris.edu
"
,
host
:
Optional
[
str
]
=
None
,
port
:
Optional
[
int
]
=
None
,
fdsn
_url
:
str
=
"
http://service.iris.edu
"
,
host
:
Optional
[
str
]
=
"
edgecwb.usgs.gov
"
,
port
:
Optional
[
int
]
=
2061
,
tag
:
str
=
"
GeomagAlg
"
,
observatory
:
Optional
[
str
]
=
None
,
network
:
str
=
"
NT
"
,
...
...
@@ -92,7 +91,7 @@ class FDSNFactory(TimeseriesFactory):
]
=
None
,
# Accepts "remove_sensitivity" or "remove_response"
):
TimeseriesFactory
.
__init__
(
self
,
observatory
,
channels
,
type
,
interval
)
self
.
Client
=
FDSNClient
(
base
_url
)
self
.
Client
=
FDSNClient
(
fdsn
_url
)
self
.
port
=
port
# Need to add this paramter for later logic
self
.
host
=
host
self
.
remove_sensitivity
=
remove_sensitivity
...
...
@@ -254,11 +253,11 @@ class FDSNFactory(TimeseriesFactory):
)
# Determine whether to use FDSN Client or request data from EDGE
if
endtime
>=
(
UTCDateTime
.
now
()
-
86400
):
print
(
"
The endtime is less than a day later!
"
,
endtime
)
oldest_neic_utc
=
UTCDateTime
.
now
()
-
(
86_400
*
60
)
# `date` ensures a midnight boundary
if
starttime
>=
oldest_neic_utc
:
self
.
host
=
"
137.227.252.145
"
self
.
port
=
2061
# use NEIC Client instead
neic_client
=
neic
.
Client
(
self
.
host
,
self
.
port
)
...
...
@@ -275,8 +274,6 @@ class FDSNFactory(TimeseriesFactory):
endtime
=
endtime
+
half_delta
,
)
data
.
attach_response
(
inv
)
else
:
data
=
self
.
Client
.
get_waveforms
(
...
...
@@ -286,9 +283,11 @@ class FDSNFactory(TimeseriesFactory):
channel
=
sncl
.
channel
,
starttime
=
starttime
,
endtime
=
endtime
+
half_delta
,
attach_response
=
True
,
)
# Attach the channel response. This must be done before the _calibarate_sensitivity_and_response function is called
data
.
attach_response
(
inv
)
# Perfrom calibrations to properly remove response/sensitivity
data
=
self
.
_calibrate_sensitivty_and_response
(
data
)
...
...
@@ -415,23 +414,6 @@ class FDSNFactory(TimeseriesFactory):
Channels are mapped as follows:
'
X
'
->
'
*F2
'
,
'
Y
'
->
'
*F1
'
,
'
Z
'
->
'
*FZ
'
.
"""
# Initialize FDSN client and get the necessary data
# FDSN = self.Client
# Determine if the requested channel is X, Y, or
# inv = FDSN.get_stations(
# network=sncl.network,
# station=sncl.station,
# location=sncl.location, # Use location if necessary
# channel=sncl.channel, # Request *F1, *F2, and *FZ
# starttime=starttime,
# endtime=endtime,
# level="response",
# )
print
(
"
The SNCL Channel being requested for teh inventory object in rotations:
"
,
sncl
.
channel
,
)
# Rotate the stream to ZNE
data
.
rotate
(
method
=
"
->ZNE
"
,
inventory
=
inv
)
...
...
@@ -486,6 +468,4 @@ class FDSNFactory(TimeseriesFactory):
# Geomag Program observatories use 2nd order instrument_polynomial
# to capture both offset and scale, but no frequency response
data
.
remove_response
()
else
:
print
(
"
NO RESPONSE ATTIBUTE WAS DEALT WITH
"
)
return
data
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