本文整理汇总了Python中obspy.core.AttribDict.cmt_code方法的典型用法代码示例。如果您正苦于以下问题:Python AttribDict.cmt_code方法的具体用法?Python AttribDict.cmt_code怎么用?Python AttribDict.cmt_code使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类obspy.core.AttribDict
的用法示例。
在下文中一共展示了AttribDict.cmt_code方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: read_xh_0_98
# 需要导入模块: from obspy.core import AttribDict [as 别名]
# 或者: from obspy.core.AttribDict import cmt_code [as 别名]
#.........这里部分代码省略.........
header["ot_month"],
header["ot_day"],
header["ot_hour"],
header["ot_minute"],
header["ot_second"])
starttime = obspy.UTCDateTime(
header["tstart_year"],
header["tstart_month"],
header["tstart_day"],
header["tstart_hour"],
header["tstart_minute"],
header["tstart_second"])
data = np.frombuffer(fh.read(header["ndata"] * 4),
dtype=byte_order + "f4")
tr = obspy.Trace(data=data)
tr.stats.network = header["netw"]
tr.stats.station = header["stnm"]
tr.stats.channel = header_0_98.CHANNEL_MAP[header["chid"]]
tr.stats.location = header_0_98.LOCATION_MAP[header["locc"]]
# The name 'delta' for the sampling rate is a bit odd but it
# appears to be interpreted correctly here.
tr.stats.sampling_rate = header["delta"]
tr.stats.starttime = starttime
# The reason why this is here is a bit complicated and has to do
# with ObsPy interna. It can be anywhere if one uses a stable ObsPy
# version or does not jump between ObsPy versions which most users
# don't do.
from obspy.station.response import (InstrumentSensitivity,
Response,
PolesZerosResponseStage)
# Build the instrument response.
# XXX: The instrument response definition in XH is very basic and
# so the definition is not complete and might not work with ObsPy.
response = Response()
sensitivity = InstrumentSensitivity(
# Random choice, but not really used by anything so it should
# be ok.
frequency=1.0,
# Assume the DS field is the total sensitivity.
value=header["DS"],
# This is true for most commonly used instruments.
input_units="M/S",
input_units_description="Velocity in Meters Per Second",
output_units="COUNTS",
output_units_description="Digital Counts")
paz = PolesZerosResponseStage(
stage_sequence_number=1,
# We assume DS is somehow the total sensitivity. As we have
# only one stage we also make it he gain of this stage.
stage_gain_frequency=1.0,
stage_gain=header["DS"],
input_units="M/S",
output_units="V",
pz_transfer_function_type="LAPLACE (RADIANS/SECOND)",
# Arbitrary frequency. Usually 1 for most instruments. Must be
# correct to assure everything works as expected!
normalization_frequency=1.0,
normalization_factor=header["A0"],
zeros=[CustomComplex(_i) for _i in header["zero"]],
poles=[CustomComplex(_i) for _i in header["pole"]])
response.instrument_sensitivity = sensitivity
response.response_stages.append(paz)
# Attach to trace object.
tr.stats.response = response
# Assemble XH specific header.
xh_header = AttribDict()
xh_header.reference_time = ref_origin_time
xh_header.source_latitude = header["elat"]
xh_header.source_longitude = header["elon"]
xh_header.source_depth_in_km = header["edep"]
xh_header.source_body_wave_magnitude = header["Mb"]
xh_header.source_surface_wave_magnitude = header["Ms"]
xh_header.source_moment_magnitude = header["Mw"]
xh_header.receiver_latitude = header["slat"]
xh_header.receiver_longitude = header["slon"]
xh_header.receiver_elevation_in_m = header["elev"]
xh_header.sensor_azimuth = header["azim"]
xh_header.sensor_inclination = header["incl"]
xh_header.maximum_amplitude = header["maxamp"]
xh_header.waveform_quality = header["qual"]
# XXX: Should this be applied to the seismogram start time?
xh_header.static_time_shift_in_sec = header["tshift"]
xh_header.comment = header["rcomment"]
xh_header.event_code = header["evtcd"]
xh_header.cmt_code = header["cmtcd"]
xh_header.phase_picks = header["tpcks"]
xh_header.floats = header["flt"]
xh_header.integers = header["intg"]
xh_header.waveform_type = header["wavf"]
tr.stats.xh = xh_header
st.traces.append(tr)
return st