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
1b7e22e4
Commit
1b7e22e4
authored
1 year ago
by
Wilbur, Spencer Franklin
Browse files
Options
Downloads
Patches
Plain Diff
Resolved comments regarding previous merge request.
parent
c20a839e
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!286
Updates to IRISFactory and channel conversions when using ASL variometers
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
geomagio/edge/IRISFactory.py
+18
-25
18 additions, 25 deletions
geomagio/edge/IRISFactory.py
with
18 additions
and
25 deletions
geomagio/edge/IRISFactory.py
+
18
−
25
View file @
1b7e22e4
...
@@ -151,23 +151,20 @@ class IRISFactory(MiniSeedFactory):
...
@@ -151,23 +151,20 @@ class IRISFactory(MiniSeedFactory):
TimeseriesUtility
.
pad_and_trim_trace
(
TimeseriesUtility
.
pad_and_trim_trace
(
trace
=
data
[
0
],
starttime
=
starttime
,
endtime
=
endtime
trace
=
data
[
0
],
starttime
=
starttime
,
endtime
=
endtime
)
)
# Beneath is necessary code to correct the azimuth reported for the LF1(H) and LF2(E) Channels for a Stream Object.
# Beneath is necessary code to check the reported azimuth
azimuth
=
self
.
_get_azimuth_from_orientations
(
data
[
0
],
starttime
)
# for the LF1 (E or Y) and LF2 (H or X) channels and determine if intstrument axes have been reversed.
azi
,
dip
=
self
.
_get_orientations
(
data
[
0
],
starttime
)
# Checks Azimuth for LF2 channel
# Checks Azimuth for LF2 channel
if
270
>
azi
muth
[
0
]
and
azi
muth
[
0
]
>
90.0
and
data
[
0
].
stats
.
channel
==
"
LF2
"
:
if
270
>
azi
and
azi
>
90.0
and
data
[
0
].
stats
.
channel
==
"
LF2
"
:
data
[
0
].
data
*=
-
1
data
[
0
].
data
*=
-
1
# Checks Azimuth for LF1 channel
# Checks Azimuth for LF1 channel
elif
azi
muth
[
0
]
>
180
and
azi
muth
[
0
]
<
360
and
data
[
0
].
stats
.
channel
==
"
LF1
"
:
elif
azi
>
180
and
azi
<
360
and
data
[
0
].
stats
.
channel
==
"
LF1
"
:
data
[
0
].
data
*=
-
1
data
[
0
].
data
*=
-
1
# Checks Azimuth for LFZ channel
elif
azimuth
[
0
]
!=
0
and
data
[
0
].
stats
.
channel
==
"
LFZ
"
:
data
[
0
].
data
*=
0
# Checks Dip for LFZ channel
# Checks Dip for LFZ channel
elif
azimuth
[
1
]
>
0
and
azimuth
[
1
]
<
180
and
data
[
0
].
stats
.
channel
==
"
LFZ
"
:
elif
dip
>
0
and
dip
<
180
and
data
[
0
].
stats
.
channel
==
"
LFZ
"
:
data
[
0
].
data
*=
-
1
data
[
0
].
data
*=
-
1
self
.
_set_metadata
(
data
,
observatory
,
channel
,
type
,
interval
)
self
.
_set_metadata
(
data
,
observatory
,
channel
,
type
,
interval
)
...
@@ -228,7 +225,7 @@ class IRISFactory(MiniSeedFactory):
...
@@ -228,7 +225,7 @@ class IRISFactory(MiniSeedFactory):
###################################
###################################
def
_get_
azimuth_from_
orientations
(
def
_get_orientations
(
self
,
trace
:
Trace
,
starttime
:
UTCDateTime
self
,
trace
:
Trace
,
starttime
:
UTCDateTime
)
->
tuple
[
float
,
float
]:
)
->
tuple
[
float
,
float
]:
# Retrieve station orientation information using FDSN for each trace
# Retrieve station orientation information using FDSN for each trace
...
@@ -241,8 +238,7 @@ class IRISFactory(MiniSeedFactory):
...
@@ -241,8 +238,7 @@ class IRISFactory(MiniSeedFactory):
network
=
trace
.
stats
.
network
,
network
=
trace
.
stats
.
network
,
location
=
trace
.
stats
.
location
,
location
=
trace
.
stats
.
location
,
)
)
print
(
sncl
)
# station = trace.stats.station
FDSN
=
FDSNClient
(
"
IRIS
"
)
FDSN
=
FDSNClient
(
"
IRIS
"
)
inv
=
FDSN
.
get_stations
(
inv
=
FDSN
.
get_stations
(
...
@@ -252,23 +248,20 @@ class IRISFactory(MiniSeedFactory):
...
@@ -252,23 +248,20 @@ class IRISFactory(MiniSeedFactory):
level
=
"
channel
"
,
level
=
"
channel
"
,
)
)
if
inv
:
# Construct the channel code using the current trace's information
channel_code
=
(
f
"
{
sncl
.
network
}
.
{
sncl
.
station
}
.
{
sncl
.
location
}
.
{
sncl
.
channel
}
"
)
# Get orientation for the constructed channel code and time
# Construct the channel code using the current trace's information
print
(
channel_code
)
channel_code
=
(
orient
=
inv
.
get_orientation
(
channel_code
,
starttime
)
f
"
{
sncl
.
network
}
.
{
sncl
.
station
}
.
{
sncl
.
location
}
.
{
sncl
.
channel
}
"
)
# Get orientation for the constructed channel code and time
orient
=
inv
.
get_orientation
(
channel_code
,
starttime
)
if
orient
:
# Return the azimuth from orientation
azimuth
=
orient
[
"
azimuth
"
]
azimuth
=
orient
[
"
azimuth
"
]
dip
=
orient
[
"
dip
"
]
dip
=
orient
[
"
dip
"
]
# Return both azimuth and dip
# Return both azimuth and dip
return
azimuth
,
dip
return
azimuth
,
dip
return
0.0
# Default azimuth if metadata is not available
return
0.0
# Default azimuth if metadata is not available
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