read_inventory station.xml from gempa's station management portal SMP

Dear people of ObsPy,

thanks for nice tools to display sensor characteristics like [1] or [2]. But
sometimes I'm not able to import station.xml files created by Gempa's station
management portal SMP, see attached file.

In case of appended file complete inventory was created using SMP. Same error
messages I get after adding a new epoche to other existing stations using SMP.

In contrary to this error I successfully can read station.xml files exported
from SMP without added epoches.

In all cases I use version 0.7 to export station.xml from SeisComP.

Some additional facts:
* ubuntu 16.04.3
* python 2.7.12 installed using apt-get install

Do you need some further details?

Best Regards
Sigward Funke

$
$ python
Python 2.7.12 (default, Nov 19 2016, 06:48:10)
[GCC 5.4.0 20160609] on linux2
Type "help", "copyright", "credits" or "license" for more information.

from obspy import read_inventory

inv = read_inventory("./SigwardFunke_Sachsennetz_LEUT.xml")

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<decorator-gen-45>", line 2, in read_inventory
  File "/usr/lib/python2.7/dist-packages/obspy/core/util/decorator.py", line
301, in _map_example_filename
    return func(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/obspy/core/inventory/inventory.py",
line 98, in read_inventory
    format=format, *args, **kwargs)[0]
  File "/usr/lib/python2.7/dist-packages/obspy/core/util/base.py", line 412,
in _read_from_plugin
    list_obj = read_format(filename, **kwargs)
  File "/usr/lib/python2.7/dist-packages/obspy/io/seiscomp/inventory.py", line
83, in _read_sc3ml
    networks.append(_read_network(inv_element, net_element, _ns))
  File "/usr/lib/python2.7/dist-packages/obspy/io/seiscomp/inventory.py", line
136, in _read_network
    stations.append(_read_station(inventory_root, sta_element, _ns))
  File "/usr/lib/python2.7/dist-packages/obspy/io/seiscomp/inventory.py", line
199, in _read_station
    channels.append(_read_channel(inventory_root, channel, _ns))
  File "/usr/lib/python2.7/dist-packages/obspy/io/seiscomp/inventory.py", line
389, in _read_channel
    _read_float_var(temp / channel.sample_rate, ClockDrift)
TypeError: unsupported operand type(s) for /: 'NoneType' and 'SampleRate'

[1] http://docs.obspy.org/packages/autogen/
obspy.core.inventory.inventory.Inventory.plot_response.html
[2] http://docs.obspy.org/packages/autogen/
obspy.core.inventory.response.Response.plot.html

SigwardFunke_Sachsennetz_LEUT.xml (29 KB)

Sfunke.vcf (168 Bytes)

Hi Sigward,

this is a bug, I've opened an issue on github for this:
https://github.com/obspy/obspy/pull/1993

As a workaround you should be able to specify information on
"Clock">"Max drift" in SMP, or add "maxClockDrift" tag manually in the
SC3ML file inside data loggers.

best,
T

Hi Tobias,

thanks for fast and useful reaction.

Your workaround works fine; at least read_inventory works in all 4 tested
cases.

Best Regards
Sigward