[obspy-users] obspy-users Digest, Vol 76, Issue 7

Tobias Megies megies at geophysik.uni-muenchen.de
Mon Mar 6 13:27:33 CET 2017


Also compare current exchanges about "eventid" vs QuakeML publicID on
FDSN mailing list..

 fdsn-wg3-products at lists.fdsn.org

It's about exactly this topic..

cheers,
T


On 03/06/2017 09:47 AM, Alberto Michelini wrote:
> Dear Lion,
> thanks for the reply.  
> I have just written to USGS (Lynda, llastowka at usgs.gov
> <mailto:llastowka at usgs.gov>) and Paul Earle (pearle at usgs.gov
> <mailto:pearle at usgs.gov>) if they can fix the problem.
> Best wishes
> Alberto
>  
> 
> On Mon, Mar 6, 2017 at 9:20 AM, <obspy-users-request at lists.swapbytes.de
> <mailto:obspy-users-request at lists.swapbytes.de>> wrote:
> 
>     Send obspy-users mailing list submissions to
>             obspy-users at lists.swapbytes.de
>     <mailto:obspy-users at lists.swapbytes.de>
> 
>     To subscribe or unsubscribe via the World Wide Web, visit
>             http://lists.swapbytes.de/mailman/listinfo/obspy-users
>     <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
>     <mailto:obspy-users-request at lists.swapbytes.de>
> 
>     You can reach the person managing the list at
>             obspy-users-owner at lists.swapbytes.de
>     <mailto: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. Re: writing USGS/NEIC QuakeML files (Lion Krischer)
> 
> 
>     ----------------------------------------------------------------------
> 
>     Message: 1
>     Date: Mon, 6 Mar 2017 09:19:54 +0100
>     From: Lion Krischer <krischer at geophysik.uni-muenchen.de
>     <mailto:krischer at geophysik.uni-muenchen.de>>
>     To: users at obspy.org <mailto:users at obspy.org>
>     Subject: Re: [obspy-users] writing USGS/NEIC QuakeML files
>     Message-ID:
>            
>     <708c9dbd-0326-22d9-3ca8-08d47e0e2577 at geophysik.uni-muenchen.de
>     <mailto:708c9dbd-0326-22d9-3ca8-08d47e0e2577 at geophysik.uni-muenchen.de>>
>     Content-Type: text/plain; charset="windows-1252"
> 
>     Hi Alberto,
> 
>     the resource ids in the file are not valid.
> 
>     Upon writing ObsPy checks if the URI validates according to the URI
>     regex defined in the QuakeML standard. If not it tries to make it
>     validate but that is of course only possible for some limited cases. In
>     other cases it raises the error you see.
> 
>     The original QuakeML from the USGS also fails to validate against the
>     schema.
> 
>     The allowed resource URIs are defined in section 3.1 of the QuakeML
>     spec.
> 
>     You could "fix" this by looping through the file and setting all
>     resource_ids to valid identifiers. A proper fix would have to be done by
>     the USGS on the server side.
> 
>     Cheers!
> 
>     Lion
> 
> 
> 
>     On 04/03/2017 20:32, Alberto Michelini wrote:
>     > Dear all,
>     >
>     > as you know already USGS/NEIC stepped to https starting March 1st.
>     > Since then I have been experiencing problems with the event FDSN web
>     > service script that writes the QuakeML file.
>     >
>     > I just  updated to 1.03 but I am still experiencing the same problem
>     > as with the previous version of obspy 1.02.
>     >
>     > In practice, just try to run the following commands  that are nothing
>     > else than a global search
>     >
>     > In [*1*]: from obspy.clients.fdsn import Client
>     > In [*2*]: from obspy.clients.fdsn.header import URL_MAPPINGS
>     > In [*3*]: from obspy import UTCDateTime, Catalog
>     > In [*4*]: starttime = UTCDateTime("2010-01-01")
>     > In [*5*]: endtime = UTCDateTime("2011-01-01")
>     > In [*6*]: client = Client("USGS?)
>     > In [*7*]: minmag = 7.0
>     > In [*8*]: maxmag = 9.9
>     > In [*9*]: cat = client.get_events(starttime=starttime,
>     > endtime=endtime,minmagnitude=minmag, maxmagnitude=maxmag)
>     > In [*10*]: len(cat)
>     > Out[*10*]: 24
>     >
>     > In [*11*]: cat.write("output_USGS.qml",format="QUAKEML")
>     >
>     ---------------------------------------------------------------------------
>     > ValueError                                Traceback (most recent call
>     > last)
>     > <ipython-input-16-9edfe4c285e1>in <module>()
>     > ----> 1cat.write("output_USGS.qml",format="QUAKEML")
>     >
>     >
>     /Users/michelini/anaconda/lib/python2.7/site-packages/obspy/core/event/catalog.pycin
>     > write(self, filename, format, **kwargs)
>     > *    500*            msg ="Format \"%s\" is not supported. Supported
>     > types: %s"
>     > *    501*            raiseTypeError(msg %(format,',
>     > '.join(EVENT_ENTRY_POINTS)))
>     > --> 502        write_format(self,filename,**kwargs)
>     > *    503*
>     > *    504*    def plot(self, projection='global', resolution='l',
>     >
>     >
>     /Users/michelini/anaconda/lib/python2.7/site-packages/obspy/io/quakeml/core.pycin
>     > _write_quakeml(catalog, filename, validate, nsmap, **kwargs)
>     > *   1813*    ifnsmap:
>     > *   1814*        nsmap_.update(nsmap)
>     > -> 1815    xml_doc =Pickler(nsmap=nsmap_).dumps(catalog)
>     > *   1816*
>     > *   1817*    ifvalidate isTrue andnot_validate(io.BytesIO(xml_doc)):
>     >
>     >
>     /Users/michelini/anaconda/lib/python2.7/site-packages/obspy/io/quakeml/core.pycin
>     > dumps(self, catalog)
>     > *   1073*        :returns:QuakeML formatted string.
>     > *   1074*        """
>     > -> 1075        returnself._serialize(catalog)
>     > *   1076*
>     > *   1077*    def_id(self,obj):
>     >
>     >
>     /Users/michelini/anaconda/lib/python2.7/site-packages/obspy/io/quakeml/core.pycin
>     > _serialize(self, catalog, pretty_print)
>     > *   1710*            ifhasattr(event,"preferred_origin_id"):
>     > *   1711*                self._str(event.preferred_origin_id,
>     event_el,
>     > -> 1712                          'preferredOriginID')
>     > *   1713*            ifhasattr(event,"preferred_magnitude_id"):
>     > *   1714*                self._str(event.preferred_magnitude_id,
>     event_el,
>     >
>     >
>     /Users/michelini/anaconda/lib/python2.7/site-packages/obspy/io/quakeml/core.pycin
>     > _str(self, value, root, tag, always_create, attrib)
>     > *   1083*   
>     def_str(self,value,root,tag,always_create=False,attrib=None):
>     > *   1084*        ifisinstance(value,ResourceIdentifier):
>     > -> 1085            value =value.get_quakeml_uri()
>     > *   1086*        ifalways_create isFalse andvalue isNone:
>     > *   1087*            return
>     >
>     >
>     /Users/michelini/anaconda/lib/python2.7/site-packages/obspy/core/event/base.pycin
>     > get_quakeml_uri(self, authority_id)
>     > *    702*        ifresult isNone:
>     > *    703*            msg ="Failed to create a valid QuakeML
>     > ResourceIdentifier."
>     > --> 704            raiseValueError(msg)
>     > *    705*        returnid
>     > *    706*
>     >
>     > ValueError: Failed to create a valid QuakeML ResourceIdentifier.
>     >
>     > In [*17*]:
>     >
>     > It seems that it has problems with the uri but I am not sure what the
>     > problem is. It is easily possible, however, to obtain the resource_id
>     > as usual by
>     >
>     > In [*22*]: cat.resource_id
>     > Out[*22*]:
>     >
>     quakeml:https//earthquake.usgs.gov/fdsnws/event/1/query?minmagnitude=7.0&endtime=2011-01-01T00%3A00%3A00.000000&maxmagnitude=9.9&starttime=2010-01-01T00%3A00%3A00.000000
>     <http://earthquake.usgs.gov/fdsnws/event/1/query?minmagnitude=7.0&endtime=2011-01-01T00%3A00%3A00.000000&maxmagnitude=9.9&starttime=2010-01-01T00%3A00%3A00.000000>
>     >
>     <http://earthquake.usgs.gov/fdsnws/event/1/query?minmagnitude=7.0&endtime=2011-01-01T00%3A00%3A00.000000&maxmagnitude=9.9&starttime=2010-01-01T00%3A00%3A00.000000
>     <http://earthquake.usgs.gov/fdsnws/event/1/query?minmagnitude=7.0&endtime=2011-01-01T00%3A00%3A00.000000&maxmagnitude=9.9&starttime=2010-01-01T00%3A00%3A00.000000>>
>     >
>     > In [*23*]: cat[0].resource_id
>     > Out[*23*]:
>     >
>     quakeml:https//earthquake.usgs.gov/fdsnws/event/1/query?eventid=usp000hrw0&format=quakeml
>     <http://earthquake.usgs.gov/fdsnws/event/1/query?eventid=usp000hrw0&format=quakeml>
>     >
>     <http://earthquake.usgs.gov/fdsnws/event/1/query?eventid=usp000hrw0&format=quakeml
>     <http://earthquake.usgs.gov/fdsnws/event/1/query?eventid=usp000hrw0&format=quakeml>>
>     >
>     >
>     > Can anybody help ?
>     >
>     > Ciao,
>     >
>     > Alberto
>     >
>     >
>     >
>     >
>     >
>     > _______________________________________________
>     > obspy-users mailing list
>     > obspy-users at lists.swapbytes.de <mailto:obspy-users at lists.swapbytes.de>
>     > http://lists.swapbytes.de/mailman/listinfo/obspy-users
>     <http://lists.swapbytes.de/mailman/listinfo/obspy-users>
> 
>     -------------- next part --------------
>     An HTML attachment was scrubbed...
>     URL:
>     <http://lists.swapbytes.de/pipermail/obspy-users/attachments/20170306/a0e1818f/attachment.html
>     <http://lists.swapbytes.de/pipermail/obspy-users/attachments/20170306/a0e1818f/attachment.html>>
> 
>     ------------------------------
> 
>     _______________________________________________
>     obspy-users mailing list
>     obspy-users at lists.swapbytes.de <mailto:obspy-users at lists.swapbytes.de>
>     http://lists.swapbytes.de/mailman/listinfo/obspy-users
>     <http://lists.swapbytes.de/mailman/listinfo/obspy-users>
> 
>     End of obspy-users Digest, Vol 76, Issue 7
>     ******************************************
> 
> 
> 
> 
> -- 
> **************************************************************
> Alberto Michelini
> Istituto Nazionale di Geofisica e Vulcanologia (INGV)
> Via di Vigna Murata, 605
> 00143 ROMA, Italy
> Ph. +39 06 51860611, e-mail: alberto.michelini at ingv.it
> <mailto:alberto.michelini at ingv.it>
> **************************************************************
> 
> 
> _______________________________________________
> 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