Skip to content

obspy.xseed: Parser._select() fails on certain dataless files #412

@claudiodsf

Description

@claudiodsf

Take this dataless file: https://dl.dropbox.com/u/168727/dataless.CL.TRIZ

It has quite a complex structure, since the station has had channels "BNE BNN BNZ HNE HNN HNZ " for its whole lifetime, while channels "HHE HHN HHZ " have temporary switched to "EHE EHN EHZ ", for then switching back to "HHE HHN HHZ " (with other minor changes)

You can check this by using, for example, rdseed:

rdseed -S -f dataless.CL.TRIZ

You get the file rdseed.stations containing the following lines:

TRIZ CL 38.3654 22.0727    59 "BNE BNN BNZ HNE HNN HNZ " "Trizonia, Dorida, Central Greece, Greece" 2005,294,00:00:00 2500,365,23:59:59.9999
TRIZ CL 38.3654 22.0727    59 "HHE HHN HHZ " "Trizonia, Dorida, Central Greece, Greece" 2005,294,00:00:00 2010,293,00:00:00
TRIZ CL 38.3654 22.0727    59 "EHE EHN EHZ " "Trizonia, Dorida, Central Greece, Greece" 2010,293,00:00:01 2011,168,10:20:00
TRIZ CL 38.3654 22.0727    59 "HHE HHN HHZ " "Trizonia, Dorida, Central Greece, Greece" 2011,168,10:20:01 2011,297,10:00:00
TRIZ CL 38.3654 22.0727    59 "HHE HHN HHZ " "Trizonia, Dorida, Central Greece, Greece" 2011,297,12:00:00 2500,365,23:59:59.9999

Now, if you do something like this:

from obspy.xseed import Parser
from obspy.core import UTCDateTime

sp = Parser('dataless.CL.TRIZ')
time = UTCDateTime('2012-04-16T11:24:00.754000Z')
paz=sp.getPAZ('CL.TRIZ.00.HHE', time)

You will get the exception:

More than one channel found with the given SEED id: CL.TRIZ.00.HHE

The problem is that the net.sta couple CL.TRIZ appears twice for the selected time. The first is for channels "BNE BNN BNZ HNE HNN HNZ " and the second for channels "HHE HHN HHZ ".
This makes Parser._select()fail, since there are two blockettes 50 (b50s) matching the query.

I made a patch (available at: https://dl.dropbox.com/u/168727/parser.py.diff) which solves this problem by selecting blockette 50 only if the corresponding blockette 52 matches the channel code.

I've checked the patch against the test suite, and it does not seem to break anything.

Let me know if it works for you.
Claudio

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions