[obspy-users] Rotate function

Tobias Megies megies at geophysik.uni-muenchen.de
Fri Jan 12 09:53:19 CET 2018


Hi Florian,

what you did should work, I think:

>> stream.rotate(method='->ZNE', inventory=inv, components='Z23')

Ordering of Traces should not matter at all.

So if that doesn't work, please open an issue with a self-contained
example (including the data to reproduce the issue).

cheers,
T


On 12/01/18 08:35, Joachim Wassermann wrote:
> Dear Florian,
> 
> this code snipped works for me... a bit clumsy but it works
> 
>  sz1 ist the 3 component stream....
> 
>     sz1.reverse()
>     for tr in sz1:
>         for channel in inv[0].stations[0].channels:
>             if tr.stats.channel == channel.code:
>                 tr.stats.align = AttribDict(dict(azimuth=channel.azimuth,
>                               dip=channel.dip))
>                 print tr.stats.align
>                 break
> 
>     z,n,e =
> rotate2zne(sz1[0].data,sz1[0].stats.align.azimuth,sz1[0].stats.align.dip,\
>                
> sz1[1].data,sz1[1].stats.align.azimuth,sz1[1].stats.align.dip,\
>                
> sz1[2].data,sz1[2].stats.align.azimuth,sz1[2].stats.align.dip)
> 
>     sz1[0].data = z
>     sz1[0].stats.channel = "HHZ"
>     sz1[1].data = n
>     sz1[1].stats.channel = "HHN"
>     sz1[2].data = e
>     sz1[2].stats.channel = "HHE"
> 
> Best Jo
> 
> 
> On 11/01/18 16:17, Florian Fuchs wrote:
>> Dear all,
>>
>> I am struggling with the rotate function of ObsPy. 
>>
>> I have a Stream with 3 Traces - one for each channel. The channels are
>> labeleld HHZ, HH2 and HH3:
>>
>> 3 Trace(s) in Stream:
>> Z3.A333A.00.HH2 | 2017-12-12T07:46:39.165000Z -
>> 2017-12-12T07:46:41.155000Z | 100.0 Hz, 200 samples
>> Z3.A333A.00.HH3 | 2017-12-12T07:46:39.165000Z -
>> 2017-12-12T07:46:41.155000Z | 100.0 Hz, 200 samples
>> Z3.A333A.00.HHZ | 2017-12-12T07:46:39.165000Z -
>> 2017-12-12T07:46:41.155000Z | 100.0 Hz, 200 samples
>>
>> Channels are 2+3 instead of N+E because the sensor is not pointing to
>> the North. Now I want to rotate this Stream such that I actually do
>> get ZNE data. I have the inventory file with the correct orientation
>> specified. Still, I cannot get my data rotated.
>>
>> If I use only 
>>
>> stream.rotate(method='->ZNE', inventory=inv)
>> or
>> stream._rotate_to_zne(inv)
>>
>> it doesn't do anything. No error message either. Certainly the data is
>> not rotated. I figured I should indicate the components, since my
>> channels are not Z12 or 123. So I tried specifying the components:
>>
>> First of all I now wonder if the order of the channels matter and if
>> they relate to the order of Traces in the Stream? Anyways, whatever
>> order I chose, I end up with an error message:
>>
>> stream.rotate(method='->ZNE', inventory=inv, components='Z23')
>> or
>> stream._rotate_to_zne(inv, components='23Z')
>>
>> -> IndexError: list index out of range
>>
>> The error occurs in this part of the function code:
>> # to be used in rotation
>>    3294         st = self.select(network=network, station=station,
>> location=location)
>> -> 3295         st = (st.select(channel=channels[0]) +
>> st.select(channel=channels[1]) +
>>    3296               st.select(channel=channels[2]))
>>    3297         # remove the original unrotated traces from the stream
>>
>> This makes me wonder if there is maybe a bug in the function and that
>> rearranging the Traces doesn't work correctly? Or do I mess it up by
>> not setting the right channel order?
>>
>> Any help is much appreciated.
>>
>> Thank you very much,
>> Florian
>>
>>
>> _______________________________________________
>> obspy-users mailing list
>> obspy-users at lists.swapbytes.de
>> http://lists.swapbytes.de/mailman/listinfo/obspy-users
> 
> -- 
> -----------------------------------------------------------------
>    Dr. Joachim Wassermann
> 
>    Geophysikalisches Observatorium   
>    Ludwigshoehe 8                   
>    82256 Fuerstenfeldbruck           
>                                     
>    Tel.: +49 89 2180-739-62          
>    FAX.: +49 89 2180-739-70          
> 
>  email: j.wassermann at lmu.de
>  www: www.erdbeben-in-bayern.de | www.geophysik.uni-muenchen.de
> ..................................................................
> 
>    Department fuer Geo- & Umweltwissenschaften
>    Sektion Geophysik
>    Theresienstrasse 41/IV
>    80333 Muenchen
> 
>   Tel.: +49 089 2180 4237
>   FAX.: +49 089 2180 4205
> ------------------------------------------------------------------
> 
> 
> 
> _______________________________________________
> obspy-users mailing list
> obspy-users at lists.swapbytes.de
> http://lists.swapbytes.de/mailman/listinfo/obspy-users
> 

-- 
Dipl.-Geophys. Tobias Megies

EMail: tobias.megies at lmu.de
WWW: https://www.geophysik.uni-muenchen.de

Geophysikalisches Observatorium
Ludwigshöhe 8
82256 Fürstenfeldbruck

Tel: +49 (0) 89 2180-73981
Fax: +49 (0) 89 2180-73970

Ludwig-Maximilians-Universität
Department für Geo- und Umweltwissenschaften
Sektion Geophysik
Theresienstrasse 41/IV
80333 München

Tel: +49 (0) 89 2180-4326
Fax: +49 (0) 89 2180-4205


More information about the obspy-users mailing list