obspy.core.stream.Stream.write¶
-
Stream.
write
(filename, format=None, **kwargs)[source]¶ Save stream into a file.
- Parameters
filename (str) – The name of the file to write.
format (str, optional) – The file format to use (e.g.
"MSEED"
). See the Supported Formats section below for a list of supported formats. If format is set toNone
it will be deduced from file extension, whenever possible.kwargs – Additional keyword arguments passed to the underlying waveform writer method.
Example
>>> from obspy import read >>> st = read() # doctest: +SKIP >>> st.write("example.mseed", format="MSEED") # doctest: +SKIP
The
format
argument can be omitted, and the file format will be deduced from file extension, whenever possible.>>> st.write("example.mseed") # doctest: +SKIP
Writing single traces into files with meaningful filenames can be done e.g. using trace.id
>>> for tr in st: #doctest: +SKIP ... tr.write(tr.id + ".MSEED", format="MSEED") #doctest: +SKIP
Supported Formats
Additional ObsPy modules extend the parameters of the
write()
method. The following table summarizes all known formats currently available for ObsPy.Please refer to the Linked Function Call of each module for any extra options available.
Format
Used Module
Linked Function Call
AH
GSE2
MSEED
PICKLE
Q
SAC
SACXY
SEGY
SH_ASC
SLIST
SU
TSPAIR
WAV