Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
claudiodsf opened this issue Sep 27, 2012 · 7 comments
Closed

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

claudiodsf opened this issue Sep 27, 2012 · 7 comments
Assignees

Comments

@claudiodsf
Copy link
Member

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

@barsch
Copy link
Member

barsch commented Sep 27, 2012

you should have now rights to directly merge or do a pull requests - patch looks good for me

@claudiodsf
Copy link
Member Author

Thanks Robert for the upgraded rights :)

I'll try to push the patch to the main repo. I still have to understand how pull requests work...

@barsch
Copy link
Member

barsch commented Sep 27, 2012

welcome to the club ;) a good git documentation can be found at http://git-scm.com/documentation

the prefered way for patches is to create a pull request so everyone can review it and someone else merges it

@megies
Copy link
Member

megies commented Sep 27, 2012

If you fork obspy/obspy and push your change to your fork you can than open a pull request at obspy/obspy, asking other people to review your change and include it in obspy's master branch. As I understand the cleanest way would be to work on a branch in your fork and request a pull from your branch to obspy/obspy's master branch. This way other changes could be added to the pull request before merging it by pushing to the branch you have been working on.

claudiodsf added a commit that referenced this issue Sep 27, 2012
@claudiodsf
Copy link
Member Author

Fixed by commit 8c9e869

@ghost ghost assigned claudiodsf Sep 27, 2012
@megies
Copy link
Member

megies commented Sep 27, 2012

@claudiodsf, thanks for the fix! Can you please leave a short note on the change in the CHANGELOG.txt. I think this is important enough to be included in the next release notes.

@claudiodsf
Copy link
Member Author

@megies Ok, done!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants