Skip to content
Snippets Groups Projects
Commit 1b7e22e4 authored by Wilbur, Spencer Franklin's avatar Wilbur, Spencer Franklin
Browse files

Resolved comments regarding previous merge request.

parent c20a839e
No related branches found
No related tags found
1 merge request!286Updates to IRISFactory and channel conversions when using ASL variometers
...@@ -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 > azimuth[0] and azimuth[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 azimuth[0] > 180 and azimuth[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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment