[obspy-users] phases2hypoellipse (VICIC BLAZ [PHD0900016])

Tobias Megies megies at geophysik.uni-muenchen.de
Thu Oct 6 10:39:47 CEST 2016


You should consider using a dictionary structure..

e.g.

station_phases = {
 "ABC": {'P': t1, 'S': t2},
 "XYZ": {'P': t3}}

for station, phases in station_phases.items():
    if "P" in phases:
        if "S" in phases:
            # write both
        else:
            # only write P
    ....

Of course if phase types get more complex you need more detailed checks..

T


On 10/06/2016 07:54 AM, VICIC BLAZ [PHD0900016] wrote:
> Thank you. 
> 
> I managed to do it, sadly not so straight forward due to my beginners
> knowledge of python, but it does the trick.
> 
> ------------------------------------------------------------------------
> *From:* obspy-users-bounces at lists.swapbytes.de
> <obspy-users-bounces at lists.swapbytes.de> on behalf of Anthony Lomax
> <alomax at free.fr>
> *Sent:* Wednesday, October 5, 2016 5:30:49 PM
> *To:* obspy-users at lists.swapbytes.de
> *Subject:* [obspy-users] phases2hypoellipse (VICIC BLAZ [PHD0900016])
>  
> 
> Hello Blaž,
> 
> The mixing of P and S on one line can be problematic with modern data
> sets containing many phases and phase types.  But if you have only P and
> S, then, if you can sort on station and then phase (P or S), or if your
> phases already come out of NonLinLoc in this order, then you should be
> able to write the hypo phase format:  For each P phase, check the
> following phase to see if it is S from the same station, if so, add the
> S reading to the current line, and skip over the S reading to continue.
> 
> Best regards,
> 
> Anthony
> 
> 
> On 05/10/2016 12:00, obspy-users-request at lists.swapbytes.de wrote:
>> Send obspy-users mailing list submissions to
>> 	obspy-users at lists.swapbytes.de
>>
>> To subscribe or unsubscribe via the World Wide Web, visit
>> 	http://lists.swapbytes.de/mailman/listinfo/obspy-users
>> or, via email, send a message with subject or body 'help' to
>> 	obspy-users-request at lists.swapbytes.de
>>
>> You can reach the person managing the list at
>> 	obspy-users-owner at lists.swapbytes.de
>>
>> When replying, please edit your Subject line so it is more specific
>> than "Re: Contents of obspy-users digest..."
>>
>>
>> Today's Topics:
>>
>>    1. phases2hypoellipse (VICIC BLAZ [PHD0900016])
>>
>>
>> _______________________________________________
>> obspy-users mailing list
>> obspy-users at lists.swapbytes.de
>> http://lists.swapbytes.de/mailman/listinfo/obspy-users
> 
> -- 
> Sent from my iClayTablet
> 
> ------------------------------------------------------------------------
> 
>    *Anthony Lomax*
>    *320 Chemin des Indes, 06370 Mouans-Sartoux, France*
>    *tel: +33 (0)4 92 92 29 79    e-mail: anthony at alomax.net
> <mailto:anthony at alomax.net>    web: http://www.alomax.net
> <http://www.alomax.net/> *
> 
>    *Twitter: **@ALomaxNet <http://twitter.com/ALomaxNet>*
>    *Science & Special Topics: **http://www.alomax.net/science*
>    *Software: **http://www.alomax.net/software* *- updates:
> **https://twitter.com/ALomaxNet*
> ------------------------------------------------------------------------
> 
> 
> _______________________________________________
> 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