From 154ab8095f44eaa401ba313aa58e89abdfcf012e Mon Sep 17 00:00:00 2001 From: spencer <swilbur@usgs.gov> Date: Mon, 16 Sep 2024 09:47:32 -0600 Subject: [PATCH] Resolved Josh's comments. --- geomagio/edge/FDSNFactory.py | 14 ++++++-------- geomagio/edge/FDSNSNCL.py | 2 +- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/geomagio/edge/FDSNFactory.py b/geomagio/edge/FDSNFactory.py index 068cb722..3fc76297 100644 --- a/geomagio/edge/FDSNFactory.py +++ b/geomagio/edge/FDSNFactory.py @@ -363,22 +363,21 @@ class FDSNFactory(TimeseriesFactory): # Determine if the requested channel is X, Y, or Z # Pull the LF* channels needed for rotation - f_channels = ["?F1", "?F2", "?FZ"] + f_channels = sncl.channel + print("the sncl channel is", sncl.channel) inv = FDSN.get_stations( network=sncl.network, station=sncl.station, location=sncl.location, # Use location if necessary - channel=",".join(f_channels), # Request *F1, *F2, and *FZ + channel=sncl.channel, # Request *F1, *F2, and *FZ starttime=starttime, endtime=endtime, level="response", ) # Rotate the stream to ZNE - print(f"Before rotation: {[tr.stats.channel for tr in data]}") data.rotate(method="->ZNE", inventory=inv) - print(f"After rotation: {[tr.stats.channel for tr in data]}") # After rotation, extract the correct channel based on requested_channel if requested_channel == "X": @@ -391,11 +390,10 @@ class FDSNFactory(TimeseriesFactory): raise ValueError(f"Invalid channel {requested_channel}") # Filter the rotated stream to return only the trace for the selected channel - filtered_stream = data.select(channel=selected_channel) + rotated_stream = data.select(channel=selected_channel) # If no data found for the selected channel, return an empty stream - if len(filtered_stream) == 0: - print(f"No data found for channel: {requested_channel}") + if len(rotated_stream) == 0: return Stream() - return filtered_stream + return rotated_stream diff --git a/geomagio/edge/FDSNSNCL.py b/geomagio/edge/FDSNSNCL.py index 1cbd380b..a5663280 100644 --- a/geomagio/edge/FDSNSNCL.py +++ b/geomagio/edge/FDSNSNCL.py @@ -74,7 +74,7 @@ def get_FDSN_channel( return ",".join([f"{channel_start}{suffix}" for suffix in ["F1", "F2", "FZ"]]) # Handle the case when location is "40" and network is "IU" - if location == "40" and network == "IU": + if location == "40" and network in ["IU", "N4", "US"]: return channel_start + _get_channel_end(element=element) # Default case -- GitLab