XML creating from sratch

Dear Obspy Forum,
I am working on creating the XML file for a seismic station wich has a CEA-DASE sensor and a Generic datalogger. This is the code (following the web page).

inv = Inventory(
networks=[],
source=“moi”)
net = Network(
code=“BO”,
stations=[],
description=“test”,
start_date=obspy.UTCDateTime(2019, 1, 1))
sta = Station(
code=“BBOB”,
latitude=-16.14100,
longitude=-68.1324,
elevation=3875.0,
creation_date=obspy.UTCDateTime(2019, 1, 1),
site=Site(name=“Banderani”))
cha = Channel(
code=“SHZ”,
location_code="–",
latitude=-16.14100,
longitude=-68.1324,
elevation=3875.0,
depth=0.0,
azimuth=0.0,
dip=-90.0,
sample_rate=50)
nrl = NRL()
response = nrl.get_response( # doctest: +SKIP
sensor_keys=[‘CEA-DASE’, ‘CP H/ZM-500 short period’],
datalogger_keys=[‘Generic’, ‘Unity’])

cha.response = response
sta.channels.append(cha)
net.stations.append(sta)
inv.networks.append(net)

inv.write(“BBOB.xml”, format=“stationxml”, validate=True)

Unfortunately I got an error that says:
//////////////////////////////////

Traceback (most recent call last): File “F:\Grant_2019\inches.py”, line 56, in
datalogger_keys=[‘Generic’, ‘Unity’])
File “C:\Python27\lib\site-packages\obspy\clients\nrl\client.py”, line 214, in get_response
sensor_resp = self.get_sensor_response(sensor_keys)
value = super(NRLDict, self).getitem(name)
KeyError: 1
///////////////////////////////////////////////////

I aaplied the NRL codes from web page (http://www.seis.sc.edu/~crotwell/nrlBrowser/) but also I got the error.
I think it depends the way I write the “datalogger_keys=[‘Generic’, ‘Unity’])”.
Would you mind give a hand, thank you for yor time.
Best Regards
tonino

Hi Tonino,
I think the way to go about this is to find key words progressively one at a time. You first do a

print(nrl.sensors[‘Generic’]) and find out what sensor types are available, lets say you have ‘ABC’ and ‘EFG’ available. If your logger is ‘ABC’, you do

print(nrl.sensors[‘Generic’][‘ABC’]) and you continue this process until you find all keys required to define your data logger.

Januka

Januka Attanayake

Research Fellow | Earthquake Seismology
Homepage: https://sites.google.com/site/janukaattanayake

School of Earth Sciences | McCoy Bldg. 200
University of Melbourne | Parkville 3010 VIC
Australia

Dear ObsPy users,

for creating the inventory XML files I can recommend SMP [1] which is free for everyone. With SMP you can create, visualize and maintain SeisComP3 XML (SC3ML) which you can load in your ObsPy scripts.

Happy scripting!

Dirk

[1]

Dear Dirk

I would love to see SMP export to the FDSN stationXML format, are you implying that this is in the pipeline, great!

\p

När du har kontakt med oss på Uppsala universitet med e-post så innebär det att vi behandlar dina personuppgifter. För att läsa mer om hur vi gör det kan du läsa här: http://www.uu.se/om-uu/dataskydd-personuppgifter/ E-mailing Uppsala University means that we will process your personal data. For more information on how this is performed, please read here: http://www.uu.se/en/about-uu/data-protection-policy

Hi Peter,

currently not. For this you can use tools which actually make use of FDSN stationXML. Not sure if ObsPy can? However, you can convert to dataless SEED from SC3ML using inv2dlsv which ships with SeisComP3.

Dirk

Hi Dirk

I think if you specify format=“stationxml” in the write method of an ObsPy Inventory object what you get is FDSN stationXML (a bit unfortunate that there now are three stationXML around). For the two SC3 stationXML formats the format tag should be INVENTORYXML or SC3ML if I read the online documentation for ObsPy 1.1.1 correct (actually not clear if there is write support for INVENTORYXML or SC3ML but there seems to read support)

best \p

Hi Peter and Dirk,

correct - ObsPy can read the FDSN, Seiscomp and old Arclink versions of inventory XML files. But it can currently only write out the FDSN stationXML version. Thus it would be suitable for a combined SMP + ObsPy workflow to output fdsn stationxml files.

Cheers!

Lion