compressed xml files

Hi all,

Can obspy somehow read and write gzip stationxml/quakeml output?

Bye,

Matthias

Hi Matthias,

yea ObsPy currently does not do that. It only does it for waveforms. That is an oversight on our side and we should fix it. I created a new issue to track it here: Reading zipped files should work for inventory and event files · Issue #1174 · obspy/obspy · GitHub

Until then you can just read them like this:

In [1]: import obspy

In [2]: import tarfile

In [3]: inv = obspy.station.inventory.Inventory(networks=, source="")

In [4]: with tarfile.open("Archive.tar.gz") as fh:
    ...: for i in fh:
    ...: inv += obspy.read_inventory(i.tobuf())

Similar for zip files but use the zipfile module in that case.

Cheers!

Lion