obspy/obspy — pull request #569 by krischer (2013-05-08 15:56:34+00:00)
Title: Rotation of non-standard orientations to ZNE

Added functionality to rotate arbitrarily oriented components to a vertical (Z), North (N), and East (E) coordinate system. This is useful e.g. for borehole sensors where the vertical components are not necessarily oriented towards the North and East.

It is even possible to rotate components that are not orthogonal to each other (the SEED standard does not really permit that but apparently there are sensors that do that) to the orthogonal ZNE system - it does a full base change. The only requirement is that the three components are linearly independent to each other.

It consists of two parts: A new function in `obspy.signal.rotate` performing the actual low level rotation and a convenience method attached to the `obspy.xseed.parser.Parser` object. This method can extract the dip and azimuth of each component from e.g. a SEED file and fully automatically rotate the three components of a Stream objects. It outputs a new Stream objects with rotated components and changed channel names.

This is not really a good place for the method but the best I could think of. Should be moved to `obspy.station` once `obspy.station` is ready for prime-time.

It has some tests but could potentially use some more. I could not really think of a really good test case. If someone is aware of one, please let me know or implement it. Otherwise I think this can be merged.

Example usage:

```python
In [1]: import obspy

In [2]: st = obspy.read("./II_COCO_three_channel_borehole.mseed")

In [3]: print st
3 Trace(s) in Stream:
II.COCO.10.BH1 | ... | 40.0 Hz, 401 samples
II.COCO.10.BH2 | ... | 40.0 Hz, 401 samples
II.COCO.10.BHZ | ... | 40.0 Hz, 401 samples

In [4]: from obspy.xseed import Parser

In [5]: p = Parser("./dataless.seed.II_COCO")

In [6]: st_rotated = p.rotateToZNE(st)

In [7]: print st_rotated
3 Trace(s) in Stream:
II.COCO.10.BHZ | ... | 40.0 Hz, 401 samples
II.COCO.10.BHN | ... | 40.0 Hz, 401 samples
II.COCO.10.BHE | ... | 40.0 Hz, 401 samples
```