Thank you, Lion.
I completely understand the concept of your answer, and yes, I do want to keep the original trace headers, once the whole point is just to find and delete the traces with source coordinate x/y valued 0, and no further processing was made.
but I’m not managing to access the original trace headers, where should I do it? In the data I just brought with ‘_read_segy’? Its confusing because it doesn’t have the attribute ‘stats’. So I might pass one of the modules to it before?
I might a workaround, but it would be nice for me to get this clear and manage headers properly.
excuse my late answer.
When you read anything with ObsPy it will be read to a Stream object, basically a collection of Traces. Only the traces have the stats attribute. I hope that answer’s your question.
A simpler way to do what you want to do would be to just filter the Stream like this:
st = obspy.read(“filename.segy”) # or use _read_segy()
indices_to_keep = … some logic …
traces = [tr for i, tr in enumerate(st.traces) if i in indices_to_keep]
st.traces = traces
Then you preserve all the meta-information and don’t really have to worry about this aspect.