# stream rotation

**URL:** https://discourse.obspy.org/t/stream-rotation/504
**Category:** Users Mailing List Archive
**Tags:** archive
**Created:** [March 11, 2016, 3:18pm UTC](https://discourse.obspy.org/t/stream-rotation/504 "2016-03-11T15:18:08Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Nikolaos\_Triantafyll](https://discourse.obspy.org/user_avatar/discourse.obspy.org/nikolaos_triantafyll/32/264_2.png) [@Nikolaos\_Triantafyll](https://discourse.obspy.org/u/Nikolaos_Triantafyll)
#### Post date: [March 11, 2016, 3:18pm UTC](https://discourse.obspy.org/t/stream-rotation/504/1 "2016-03-11T15:18:08Z")

</div>

Dear all,

I'm trying to rotate stream (containing 3 traces -Z,N,E) to the ZNE system.

Code:

from obspy import read\_inventory  
from obspy import read  
from obspy.signal.rotate import rotate2zne

\_mseed="NETWORK.STATION.LOCATION\*"  
\_xml="NETWORK.STATION.xml"

st = read(\_mseed)  
inv = read\_inventory(\_xml)  
st.attach\_response(inv)

data=  
azm=  
dip=  
orientations=['Z','N','E']

for orientation in orientations:  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;data.append(st.select(channel='\*'+orientation).traces[0].data)  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;dip.append(inv.select(channel='\*'+orientation)[0][0][0].dip)  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;azm.append(inv.select(channel='\*'+orientation)[0][0][0].azimuth)

\_results = rotate2zne(data[0], azm[0], dip[0], data[1], azm[1], dip[1], data[2], azm[2], dip[2])

But I get the following error:

Traceback (most recent call last):  
&nbsp;&nbsp;&nbsp;File "new\_rotate.py", line 27, in \<module\>  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\_results = rotate2zne(data[0], azm[0], dip[0], data[1], azm[1], dip[1], data[2], azm[2], dip[2])  
&nbsp;&nbsp;&nbsp;File "/usr/local/lib/python2.7/dist-packages/obspy/signal/rotate.py", line 257, in rotate2zne  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;x, y, z = np.dot(\_t, [data\_1, data\_2, data\_3])  
ValueError: setting an array element with a sequence.

Any ideas?

Thank you in advance,  
Nikos

---

<div class="post-metadata">

### Author: ![megies](https://discourse.obspy.org/user_avatar/discourse.obspy.org/megies/32/9_2.png) [@megies](https://discourse.obspy.org/u/megies)
#### Post date: [March 11, 2016, 5:35pm UTC](https://discourse.obspy.org/t/stream-rotation/504/2 "2016-03-11T17:35:26Z")

</div>

Hi Nikos,

hard to tell what's happening, I'd recommend jumping in there with  
IPython debugger and checking types (could be e.g. empty data slices, ...).  
You can also have a look at [Make Stream.rotate() take an Inventory object / Stream.rotate from unaligned to ZNE by megies · Pull Request #1310 · obspy/obspy · GitHub](https://github.com/obspy/obspy/pull/1310).

cheers,  
T
