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

Reviewed comments made by Josh and removed debugging print statements and...

Reviewed comments made by Josh and removed debugging print statements and changed _get_channel_start to get_channel_start within SNCL.py and any other script which references this function.
parent 5ab6495c
No related branches found
No related tags found
1 merge request!323Fixed the bugs cuasing interval to be defined as none. This required changes...
......@@ -362,22 +362,12 @@ class FDSNFactory(TimeseriesFactory):
) -> Tuple[float, float]:
# Retrieve station orientation information using FDSN for each trace
# sncl = _get_timeseries()
# data_type=trace.stats.location,
# element=self.channels,
# interval=self.interval,
# station=trace.stats.station,
# network=trace.stats.network,
# location=trace.stats.location,
# )
FDSN = FDSNClient("IRIS")
inv = FDSN.get_stations(
network=sncl.network,
station=sncl.station,
channel=sncl.channel,
# interval = sncl.interval,
level="channel",
)
......
from typing import Optional, Dict
from ..geomag_types import DataInterval, DataType
from .SNCL import (
SNCL,
get_channel,
get_location,
_get_location_start,
_get_channel_start,
)
from .SNCL import SNCL, get_channel, get_location, get_channel_start
class FDSNSNCL(SNCL):
......@@ -41,14 +35,6 @@ class FDSNSNCL(SNCL):
location=location,
)
# def parse_sncl(self) -> Dict:
# return {
# "station": self.station,
# "network": self.network,
# "data_type": self.data_type,
# "element": self.element,
# "interval": self.interval,
# }
@property
def data_type(self) -> str:
if self.location == "40" and self.network == "IU":
......@@ -61,26 +47,6 @@ class FDSNSNCL(SNCL):
return _get_FDSN_element(channel=self.channel)
return super().element
# @property
# def interval(self) -> str:
# if self.location == "40" and self.network == "IU":
# """Translates beginning of channel to interval"""
# channel_start = self.channel[0]
# if channel_start == "B":
# return "tenhertz"
# elif channel_start == "L":
# return "second"
# elif channel_start == "U":
# return "minute"
# elif channel_start == "R":
# return "hour"
# elif channel_start == "P":
# return "day"
# # print(self.interval)
# raise ValueError(f"Unexcepted interval code: {channel_start}")
# return super().interval
def _get_FDSN_element(channel: str) -> str:
channel_end = channel[1:]
......@@ -101,7 +67,7 @@ def get_FDSN_channel(
location: Optional[str] = None,
) -> str:
if location == "40" and network == "IU":
return _get_channel_start(interval=interval) + _get_channel_end(element=element)
return get_channel_start(interval=interval) + _get_channel_end(element=element)
return get_channel(element=element, interval=interval, data_type=data_type)
......
from typing import Optional
from ..geomag_types import DataInterval, DataType
from .SNCL import SNCL, get_channel, get_location, _get_channel_start
from .SNCL import SNCL, get_channel, get_location, get_channel_start
class IRISSNCL(SNCL):
......@@ -67,7 +67,7 @@ def get_iris_channel(
location: Optional[str] = None,
) -> str:
if location == "40" and network == "IU":
return _get_channel_start(interval=interval) + _get_channel_end(element=element)
return get_channel_start(interval=interval) + _get_channel_end(element=element)
return get_channel(element=element, interval=interval, data_type=data_type)
......
......@@ -94,7 +94,7 @@ class SNCL(BaseModel):
def get_channel(element: str, interval: str, data_type: str) -> str:
return _check_predefined_channel(element=element, interval=interval) or (
_get_channel_start(interval=interval)
get_channel_start(interval=interval)
+ _get_channel_end(element=element, data_type=data_type)
)
......@@ -112,7 +112,7 @@ def _check_predefined_element(channel: str) -> Optional[str]:
return None
def _get_channel_start(interval: str) -> str:
def get_channel_start(interval: str) -> str:
if interval == "tenhertz":
return "B"
if interval == "second":
......@@ -153,7 +153,7 @@ def _get_element(channel: str, location: str) -> str:
def _check_predefined_channel(element: str, interval: str) -> Optional[str]:
if element in ELEMENT_CONVERSIONS:
return _get_channel_start(interval=interval) + ELEMENT_CONVERSIONS[element]
return get_channel_start(interval=interval) + ELEMENT_CONVERSIONS[element]
elif len(element) == 3:
return element
# chan.loc format
......
......@@ -169,7 +169,6 @@ class IAGA2002Writer(object):
"""
prefix = " "
suffix = " |" + linesep
print("Prefix", prefix, "Name", name, "Value", value)
return "".join((prefix, name.ljust(23), value.ljust(44), suffix))
def _format_comment(self, comment):
......
......@@ -129,8 +129,8 @@ def test_get_sncl():
data_type="adjusted",
element="H",
interval="second",
station="BOU",
) # == FDSNSNCL(station="BOU", network="NT", channel="LFH", location="40")
station="ANMO",
) == FDSNSNCL(station="ANMO", network="NT", channel="LFH", location="40")
assert error.value == "Unsupported data type: adjusted"
......
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