当前位置: 首页>>代码示例>>Python>>正文


Python AttribDict.receiver_latitude方法代码示例

本文整理汇总了Python中obspy.core.AttribDict.receiver_latitude方法的典型用法代码示例。如果您正苦于以下问题:Python AttribDict.receiver_latitude方法的具体用法?Python AttribDict.receiver_latitude怎么用?Python AttribDict.receiver_latitude使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在obspy.core.AttribDict的用法示例。


在下文中一共展示了AttribDict.receiver_latitude方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _read_SES3D

# 需要导入模块: from obspy.core import AttribDict [as 别名]
# 或者: from obspy.core.AttribDict import receiver_latitude [as 别名]
def _read_SES3D(fh, headonly=False):
    """
    Internal SES3D parsing routine.
    """
    # Import here to avoid circular imports.
    from obspy.core import AttribDict, Trace, Stream

    # Read the header.
    component = fh.readline().split()[0].lower()
    npts = int(fh.readline().split()[-1])
    delta = float(fh.readline().split()[-1])
    # Skip receiver location line.
    fh.readline()
    rec_loc = fh.readline().split()
    rec_x, rec_y, rec_z = map(float, [rec_loc[1], rec_loc[3], rec_loc[5]])
    # Skip the source location line.
    fh.readline()
    src_loc = fh.readline().split()
    src_x, src_y, src_z = map(float, [src_loc[1], src_loc[3], src_loc[5]])

    # Read the data.
    if headonly is False:
        data = np.array(map(float, fh.readlines()),
                        dtype="float32")
    else:
        data = np.array([])

    ses3d = AttribDict()
    ses3d.receiver_latitude = rotations.colat2lat(rec_x)
    ses3d.receiver_longitude = rec_y
    ses3d.receiver_depth_in_m = rec_z
    ses3d.source_latitude = rotations.colat2lat(src_x)
    ses3d.source_longitude = src_y
    ses3d.source_depth_in_m = src_z

    header = {
        "delta": delta,
        "channel": COMPONENT_MAP[component],
        "ses3d": ses3d,
        "npts": npts
    }

    # Setup Obspy Stream/Trace structure.
    tr = Trace(data=data, header=header)

    # Small check.
    if headonly is False and npts != tr.stats.npts:
        msg = "The sample count specified in the header does not match " + \
            "the actual data count."
        warnings.warn(msg)
    return Stream(traces=[tr])
开发者ID:Phlos,项目名称:LASIF,代码行数:53,代码来源:ses3d_file_parser.py

示例2: read_xh_0_98

# 需要导入模块: from obspy.core import AttribDict [as 别名]
# 或者: from obspy.core.AttribDict import receiver_latitude [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
开发者ID:krischer,项目名称:obspy_xh,代码行数:104,代码来源:core.py


注:本文中的obspy.core.AttribDict.receiver_latitude方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。