ValueError: "No matching response information found."

I am trying to manually process UDP data that is being sent from a shake with obspy.

At first, I was not using UDP, and was polling the waveform directly, attaching an inventory file and removing the inventory file. This worked, but I do not want to request a pull each time, I want to passively accept the data via UDP.

In order to do this, I’m using this code:

def UDPGet():
'''
This will read a broadcasted UDP stream and split the incoming byte stream into chewable unit-less pieces

'''

host = <host>
port = <port>								# Port to bind to

HP = host + ":" + str(port)
print ("  Opening socket on (HOST:PORT) ", HP)

sock = s.socket(s.AF_INET, s.SOCK_DGRAM | s.SO_REUSEADDR)
sock.bind((host, port))

print ("Waiting for data on (HOST:PORT) ", HP)

inv = read_inventory('./R1A9C-no_location-dummyfile.xml')

while (True):							# loop forever
    bData, addr = sock.recvfrom(1024)	# wait to receive data

    sData = bData.decode("utf-8")       # converting bytes to string
    lsData = sData.strip('}{').split(', ')  # converting string to list of strings


    ilsData = lsData[2:27]
    ilsData = [int(i) for i in ilsData]     # converting list of strings to list of integers

    trace = Trace(data=numpy.array(ilsData))
    trace.stats.channel = lsData[0].strip("'")
    print (trace.stats.channel, trace.data)
    
    trace.attach_response(inv)
    trace.remove_response(output='ACC')

    print (trace.stats.channel, max(abs(trace.data)))

The “data” looks identical to the output when get_waveform, i.e.:

However, when using get_waveform the response file works, but when manually populating the data, it does not. Please point me in the correct direction!

Note: I understand rsudp exists, but I just want to convert UDP control voltage to acceleration and write it to a database. I do not need all the other bells and whistles.

After installing a debugger and debugging for a bit, I was able to find a solution. I was missing the network, station and location values in the trace.

After adding them:

trace = Trace(data=numpy.array(ilsData))
trace.stats.channel = lsData[0].strip("'")
trace.stats.starttime = UTCDateTime('2021-01-03 11:59:59')
trace.stats.network = 'AM'
trace.stats.station = 'R1A9C'
trace.stats.location = '00'

It worked and I believe I have usable data now. All that’s left is cleanup.