resource_id problem with obspy.core.event.Pick

Hi Obspy users,

I am trying to write a quakeml file from a coincidence trigger in obspy. I got the following example from Tobias this morning.

https://github.com/obspy/docs/blob/master/workshops/2016-03-07_ipgp/06_Event_metadata-with_solutions.ipynb

This works just fine and I can create an xml file that contains a catalog with multiple events. Each event has origin and magnitude objects in it.

But when I try to add picks to each event I get a resource_id error when attempting to write the quakeml file. As soon as I append this pick to the event object and then add the event object to the catalog object, my quakeml write fails.

Traceback (most recent call last):

File “”, line 38, in
cat.write( fileNameOut, format=“QUAKEML”)

File “/Users/dmikesell/anaconda/lib/python2.7/site-packages/obspy/core/event/catalog.py”, line 501, in write

File “/Users/dmikesell/anaconda/lib/python2.7/site-packages/obspy/io/quakeml/core.py”, line 1810, in _write_quakeml

File “/Users/dmikesell/anaconda/lib/python2.7/site-packages/obspy/io/quakeml/core.py”, line 1067, in dumps

File “/Users/dmikesell/anaconda/lib/python2.7/site-packages/obspy/io/quakeml/core.py”, line 1740, in _serialize

File “/Users/dmikesell/anaconda/lib/python2.7/site-packages/obspy/io/quakeml/core.py”, line 1486, in _pick

AttributeError: ‘str’ object has no attribute ‘resource_id’

Any ideas what the problem is? I have looked around all morning to figure out this resource_id stuff, but I am not sure what I am missing. I tried today with the output from the streamPick() module (https://github.com/miili/wavePicker) and it works just fine. I am not sure how because I made the to Picks look identical. But the one I created using Pick() failed and the one created with streamPick.getPicks() worked.

Thanks,

Dylan

import os
from obspy.core.event import Catalog, Event, Origin, Magnitude, Pick, WaveformStreamID
from obspy.core.utcdatetime import UTCDateTime
from streamPick import *
from obspy.core import read

solved. Need to write as

cat[0].picks = [p]

instead of

cat[0].picks = p

Dylan