def to_obspy_trace(trace):
    """
    Convert Pyrocko trace to ObsPy trace.

    :param trace:
        :py:class:`pyrocko.trace.Trace`
    """
    import obspy
    pyrocko_trace = trace
    obspy_trace = obspy.Trace(data=pyrocko_trace.ydata, header=obspy.core.
        trace.Stats(dict(npts=len(pyrocko_trace.ydata), network=
        pyrocko_trace.network, station=pyrocko_trace.station, location=
        pyrocko_trace.location, channel=pyrocko_trace.channel, delta=
        pyrocko_trace.deltat, starttime=pyrocko_trace.tmin, endtime=
        pyrocko_trace.tmax)))
    return obspy_trace
