[obspy-devs] 'ObSpy' question

Hi Gazi,

I'm moving this to the users mailing list as it's not really related to
development..

Modifying the dataless directly is pretty messy IMO (see
http://docs.obspy.org/tutorial/code_snippets/clone_dataless_seed.html),
I would try to avoid that.

Here's two things you could do:

1. Convert the generated dataless file to XML SEED using
obspy-dataless2xseed command line program. The xml file you could change
using an xml parser or in plain text.

2. Convert the dataless to stationxml using IRIS java converter
(https://seiscode.iris.washington.edu/projects/stationxml-converter/wiki).
Then you could read the StationXML with obspy and modify the inventory
in python in an automated fashion. At the end if necessary you can
convert the new StationXML file(s) back to dataless if necessary.

I'd try the second approach probably.

hope it helps,
Tobias

1. Convert the generated dataless file to XML SEED using
obspy-dataless2xseed command line program. The xml file you could change
using an xml parser or in plain text.

2. Convert the dataless to stationxml using IRIS java converter
(https://seiscode.iris.washington.edu/projects/stationxml-converter/wiki).
Then you could read the StationXML with obspy and modify the inventory
in python in an automated fashion. At the end if necessary you can
convert the new StationXML file(s) back to dataless if necessary.

I'd try the second approach probably.

Just a note of caution: SEED <-> StationXML conversion is not 1 to 1. You probably won’t loose information but it might be structured a bit differently. SEED <-> XSEED on the other hand can be converted without any problems. I don’t know of any other XSEED tools so you are stuck with ObsPy for that task.

$ obspy-dataless2xseed
and
$ obspy-xseed2dataless

can perform the conversions.

If you want to do it in code, you have to directly access the blockettes and change the values. Please refer to the SEED manual for additional details.

In [1]: from obspy.xseed import Parser

In [2]: p = Parser("./dataless.seed.BW_FURT")

In [3]: p.blockettes[52][0].latitude = 10

In [4]: p.writeSEED("out.seed”)

Cheers!

Lion