segy > sac

I'm reading in a segy file that contains a number of traces, from
multiple shots, which I will write out as single trace sac files.

I want to populate the sac meta data fields (example, evla, evlo,
stla, stlo) before I write out the sac file, using values I've
calculated from the segy.trace_header.

Is there anyway to convert a segy trace to a sac trace, without
writing out a temporary file?

I can do it if I write the segy file out as a sac using;
tr.write(filename, format="SAC")
and then read it back in and populate the necessary fields, but Id
rather not have to write out this temporary file.

Appending the keys to an empty sac class for the segy trace didnt work.

Suggestions?

thanks
ashton

Hi Ashton,

Could you please provide a code example, and what your obspy.__version__ is? Appending SAC coordinates fields to trace.stats.sac should work, but there have been some issues about this recently. Some of them have been fixed in recent ObsPy versions.

Best,
Jonathan