obspy.iris: Use new FDSN web services and retire deprecated services #537

Merged
merged 58 commits into from Oct 4, 2013

Projects

None yet

5 participants

@barsch
Member
barsch commented Mar 28, 2013

The IRIS DMC has implemented the International Federation of Digital Seismograph Networks (FDSN) versions of their core web services that support access to time series data, related metadata and event parameters. The equivalent DMC services are now deprecated and will be retired, read more on that at http://www.iris.washington.edu/pipermail/webservices/2013-March/000378.html.

The FDSN web services are available from a dedicated host name with new web documentation: http://service.iris.edu/

Deprecation of equivalent IRIS services

With the release of the FDSN services they are deprecating the equivalent services.

These services will be turned off in approximately 6 months:

Differences between FDSN and the services they are replacing

The FDSN web services return HTTP status code 204 to indicate "No data" as opposed to status code 404 used by the services they are replacing. The behavior of returning a 404 can be restored by including the 'nodata=404' parameter and value in the request.

fdsnws-dataselect is a combination of the capabilities of ws-bulkdataselect and ws-dataselect:

  1. enhancement: the network, station, location and channel selections may be comma-separated lists (e.g. BHE,BHN)
  2. enhancement: the network, station, location and channel selections may contain * and ? wildcards
  3. should be a drop-in replacement for ws-bulkdataselect (accepts the same requests via POST).
  4. a near complete replacement for ws-dataselect (accepts GET requests with parameters) except that it does not support the 'ref' parameter and does not support caching in the internal ICAB system.

fdsnws-station is equivalent to ws-station with these important changes:

  1. the XML output is returned as FDSN StationXML, a different schema
  2. new 'matchtimeseries' parameter to limit results to channels with high probability of data at the DMC
  3. the 'output' parameter name is changed to 'format'

The FDSN StationXML schema (http://www.fdsn.org/xml/station/) is generally equivalent to the XML format previously used but it is a distinctly different schema that cannot be parsed with the same software parsing the XML from ws-station.

fdsnws-event is equivalent to ws-event with these differences:

  1. the FDSN service returns event depths in meters to conform to QuakeML 1.2 (the ws-event service used kilometers)
  2. the 'output' parameter name is changed to 'format'
  3. only a single catalog can be selected per-request, the default catalog is 'NEIC PDE'
  4. in addition to the default order of descending results, the 'orderby' parameter can be 'time-asc' or 'magnitude-asc' to set the order to ascending.
@barsch
Member
barsch commented Mar 28, 2013

just a rant: we should try to autogenerate our client by using the delivered WADL files (e.g. http://service.iris.edu/fdsnws/event/1/application.wadl ) to keep our clients up-to-date with IRIS - not dynamically on each client run, but once everytime we release a new version of ObsPy

@krischer
Member
krischer commented Apr 3, 2013

+1 for the WADL autogeneration if it is possible. Not sure though. For some query options they only specify the default value and not the possible options. Furthermore they do not seem to use xs:boolean for their flags but a string with either "yes" or "no".

Also they now appear to be using a QuakeML version > 1.0. No version number is included for some reason, but the origin depth unit appears to be meter. Judging from their documentation is appears to be QuakeML 1.2RC3.

@celso-iris

Before committing to using IRIS's WADL, you should know that the WADLs are in flux. More specifically, IRIS would love to hear recommendations for improving our WADLs and making them more useful. If we perfect the WADL that is used to describe our existing FDSN services, then hopefully future FDSN-based services will also provide better WADLs. Each service implementation may vary from each other in some minor way: some query parameters might not be relevant, or some may be augmented.

As a specific example, here the IRIS FDSN event service differs from the spec. in that IRIS offers a format parameter with two options, text and xml. However, the FDSN spec says nothing about format.

Another example might be if a data center doesn't store a particular type of metadata. Then the parameter used to filter upon that data will likely not be implemented. Hopefully a good WADL could be used to determine that ahead of time.

If you have any questions, feel free to contact us, as we would like to help make it easier for ObsPy to interface with the web services. Now that there are FDSN standardized versions of our core services, ObsPy should be able to nearly automatically / seamlessly interface with the equivalent services at other data centers.

Thanks,
Celso

@krischer
Member
krischer commented Apr 5, 2013

Hi Celso,

what is the best way to contact you? It is ok, if we discuss it here?

We are of course interested in being able to automatically access data from centers implementing the FDSN specification. Also if anyone at IRIS is interested in changing parts of obspy.iris feel free to do it and send us a pull request.

I am no expert in WADL and do not know how feasible my suggestions are but they should be valid WADL. From our point of view the following changes would facilitate the autogeneration of code based on your WADLs. It is just a short snippets based on your event WADL.

<request>
  <!--Document the different fields, just done for one example here-->
  <param name="starttime" style="query" type="xs:date">
      <doc xml:lang="english" title="limit to events occurring on or after the specified start time.">
          Example: starttime=2012-11-29T00:00:00
      </doc>
  </param>

  <param name="endtime" style="query" type="xs:date"/>

  <!--Indicate the used default values. Only done for some examples here-->
  <param name="minlatitude" style="query" type="xs:double" default="-90.0"/>
  <param name="maxlatitude" style="query" type="xs:double" default="90.0"/>
  <param name="minlongitude" style="query" type="xs:double" default="-180.0"/>
  <param name="maxlongitude" style="query" type="xs:double" default="180.0"/>

  <param name="minmagnitude" style="query" type="xs:double"/>
  <param name="maxmagnitude" style="query" type="xs:double"/>

  <param name="magtype" style="query" type="xs:string"/>
  <param name="catalog" style="query" type="xs:string"/>
  <param name="contributor" style="query" type="xs:string"/>
  <param name="maxdepth" style="query" type="xs:double"/>
  <param name="mindepth" style="query" type="xs:double"/>
  <param name="latitude" style="query" type="xs:double"/>
  <param name="longitude" style="query" type="xs:double"/>
  <param name="maxradius" style="query" type="xs:double"/>
  <param name="minradius" style="query" type="xs:double"/>
  <param name="orderby" style="query" type="xs:string" default="time"/>
  <param name="updatedafter" style="query" type="xs:date"/>
  <param name="eventid" style="query" type="xs:long"/>
  <param name="originid" style="query" type="xs:long"/>

  <!--Use booleans variables for flags-->
  <param name="includearrivals" style="query" type="xs:boolean" default="false"/>
  <param name="includeallmagnitudes" style="query" type="xs:boolean" default="false"/>
  <param name="includeallorigins" style="query" type="xs:boolean" default="false"/>

  <param name="limit" style="query" type="xs:int" default="1"/>
  <param name="offset" style="query" type="xs:int" default="1"/>
  <param name="output" style="query" type="xs:string" default="xml"/>

  <!--Indicate the available options. Just done for one example here-->
  <param name="format" style="query" default="xml">
   <option value="xml"/>
   <option value="text"/>
  </param>

</request>

Best wishes,

Lion

@celso-iris

Here's an example of a beefed up event wadl. It doesn't match the wadl we have on line yet, but we're working on getting everything synced. Nothing's written in stone yet (it can and probably will change), but how's this for wadl documentation of the FDSN event service?

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<application xmlns="http://wadl.dev.java.net/2009/02">
   <doc title="FDSN event web service 1.0"/>
   <resources base="http://service.iris.edu/fdsnws/event/1/">
      <resource path="/">
         <method id="index" name="GET">
            <response>
               <representation mediaType="text/plain"/>
               <representation mediaType="application/xml"/>
            </response>
         </method>
         <resource path="/counts">
            <method id="counts" name="GET">
               <request>
                  <param xmlns:xs="http://www.w3.org/2001/XMLSchema" name="starttime" style="query" type="xs:date">
                     <doc xml:lang="english" title="limit to events occurring on or after the specified start time">
                        Examples: starttime=2012-11-29 or 2012-11-29T00:00:00 or 2012-11-29T00:00:00.000
                     </doc>
                  </param>
                  <param xmlns:xs="http://www.w3.org/2001/XMLSchema" name="endtime" style="query" type="xs:date">
                     <doc xml:lang="english" title="limit to events occurring on or before the specified end time"/>
                  </param>
                  <param xmlns:xs="http://www.w3.org/2001/XMLSchema" name="minlatitude" style="query" type="xs:double" default="-90.0">
                     <doc xml:lang="english" title="southern boundary"/>
                  </param>
                  <param xmlns:xs="http://www.w3.org/2001/XMLSchema" name="maxlatitude" style="query" type="xs:double" default="90.0">
                     <doc xml:lang="english" title="northern boundary"/>
                  </param>
                  <param xmlns:xs="http://www.w3.org/2001/XMLSchema" name="minlongitude" style="query" type="xs:double" default="-180.0">
                     <doc xml:lang="english" title="western boundary"/>
                  </param>
                  <param xmlns:xs="http://www.w3.org/2001/XMLSchema" name="maxlongitude" style="query" type="xs:double" default="180.0">
                     <doc xml:lang="english" title="eastern boundary"/>
                  </param>
                  <param xmlns:xs="http://www.w3.org/2001/XMLSchema" name="minmagnitude" style="query" type="xs:double">
                     <doc xml:lang="english" title="Limit to events with a magnitude larger than or equal to the specified minimum"/>
                  </param>
                  <param xmlns:xs="http://www.w3.org/2001/XMLSchema" name="maxmagnitude" style="query" type="xs:double">
                     <doc xml:lang="english" title="Limit to events with a magnitude smaller than or equal to the specified maximum"/>
                  </param>
                  <param xmlns:xs="http://www.w3.org/2001/XMLSchema" name="magtype" style="query" type="xs:string">
                     <doc xml:lang="english" title="type of Magnitude used to test minimum and maximum limits (case insensitive)">
                     Examples: Ml,Ms,mb,Mw"</doc>
                  </param>
                  <param xmlns:xs="http://www.w3.org/2001/XMLSchema" name="catalog" style="query" type="xs:string" default="NEIC+PDE">
                     <doc xml:lang="english" title="Specify the catalog from which origins and magnitudes will be retrieved"/>
                  </param>
                  <param xmlns:xs="http://www.w3.org/2001/XMLSchema" name="contributor" style="query" type="xs:string">
                     <doc xml:lang="english" title="Limit to events contributed by a specified contributor"/>
                  </param>
                  <param xmlns:xs="http://www.w3.org/2001/XMLSchema" name="maxdepth" style="query" type="xs:double">
                     <doc xml:lang="english" title="Limit to events with depths equal to or less than the specified depth"/>
                  </param>
                  <param xmlns:xs="http://www.w3.org/2001/XMLSchema" name="mindepth" style="query" type="xs:double">
                     <doc xml:lang="english" title="Limit to events with depths equal to or greater than the specified depth"/>
                  </param>
                  <param xmlns:xs="http://www.w3.org/2001/XMLSchema" name="latitude" style="query" type="xs:double" default="0.0">
                     <doc xml:lang="english" title="Specify the central latitude point for a radial search"/>
                  </param>
                  <param xmlns:xs="http://www.w3.org/2001/XMLSchema" name="longitude" style="query" type="xs:double" default="0.0">
                     <doc xml:lang="english" title="Specify the central longitude point for a radial search"/>
                  </param>
                  <param xmlns:xs="http://www.w3.org/2001/XMLSchema" name="maxradius" style="query" type="xs:double" default="180.0">
                     <doc xml:lang="english" title="Specify maximum distance from the geographic point defined by latitude and longitude"/>
                  </param>
                  <param xmlns:xs="http://www.w3.org/2001/XMLSchema" name="minradius" style="query" type="xs:double" default="0.0">
                     <doc xml:lang="english" title="Specify minimum distance from the geographic point defined by latitude and longitude"/>
                  </param>
                  <param xmlns:xs="http://www.w3.org/2001/XMLSchema" name="updatedafter" style="query" type="xs:date">
                     <doc xml:lang="english" title="Limit to events updated after the specified time"/>
                  </param>
                  <!-- <param xmlns:xs="http://www.w3.org/2001/XMLSchema" name="output" style="query" type="xs:string" default="xml"/> -->
                  <param xmlns:xs="http://www.w3.org/2001/XMLSchema" name="format" style="query" type="xs:string" default="xml">
                     <doc xml:lang="english" title=""/>
                     <option value="xml" mediaType="application/xml"/>
                     <option value="text" mediaType="text/plain"/>
                  </param>
               </request>
               <response>
                  <representation mediaType="text/plain"/>
                  <representation mediaType="application/xml"/>
               </response>
            </method>
         </resource>

         <resource path="/query">
            <method id="query" name="GET">
               <request>
                  <param xmlns:xs="http://www.w3.org/2001/XMLSchema" name="starttime" style="query" type="xs:date">
                     <doc xml:lang="english" title="limit to events occurring on or after the specified start time">
                        Examples: starttime=2012-11-29 or 2012-11-29T00:00:00 or 2012-11-29T00:00:00.000
                     </doc>
                  </param>
                  <param xmlns:xs="http://www.w3.org/2001/XMLSchema" name="endtime" style="query" type="xs:date">
                     <doc xml:lang="english" title="limit to events occurring on or before the specified end time"/>
                  </param>
                  <param xmlns:xs="http://www.w3.org/2001/XMLSchema" name="minlatitude" style="query" type="xs:double" default="-90.0">
                     <doc xml:lang="english" title="southern boundary"/>
                  </param>
                  <param xmlns:xs="http://www.w3.org/2001/XMLSchema" name="maxlatitude" style="query" type="xs:double" default="90.0">
                     <doc xml:lang="english" title="northern boundary"/>
                  </param>
                  <param xmlns:xs="http://www.w3.org/2001/XMLSchema" name="minlongitude" style="query" type="xs:double" default="-180.0">
                     <doc xml:lang="english" title="western boundary"/>
                  </param>
                  <param xmlns:xs="http://www.w3.org/2001/XMLSchema" name="maxlongitude" style="query" type="xs:double" default="180.0">
                     <doc xml:lang="english" title="eastern boundary"/>
                  </param>
                  <param xmlns:xs="http://www.w3.org/2001/XMLSchema" name="minmagnitude" style="query" type="xs:double">
                     <doc xml:lang="english" title="Limit to events with a magnitude larger than or equal to the specified minimum"/>
                  </param>
                  <param xmlns:xs="http://www.w3.org/2001/XMLSchema" name="maxmagnitude" style="query" type="xs:double">
                     <doc xml:lang="english" title="Limit to events with a magnitude smaller than or equal to the specified maximum"/>
                  </param>
                  <param xmlns:xs="http://www.w3.org/2001/XMLSchema" name="magtype" style="query" type="xs:string">
                     <doc xml:lang="english" title="type of Magnitude used to test minimum and maximum limits (case insensitive)">
                     Examples: Ml,Ms,mb,Mw"</doc>
                  </param>
                  <param xmlns:xs="http://www.w3.org/2001/XMLSchema" name="catalog" style="query" type="xs:string" default="NEIC+PDE">
                     <doc xml:lang="english" title="Specify the catalog from which origins and magnitudes will be retrieved"/>
                  </param>
                  <param xmlns:xs="http://www.w3.org/2001/XMLSchema" name="contributor" style="query" type="xs:string">
                     <doc xml:lang="english" title="Limit to events contributed by a specified contributor"/>
                  </param>
                  <param xmlns:xs="http://www.w3.org/2001/XMLSchema" name="maxdepth" style="query" type="xs:double">
                     <doc xml:lang="english" title="Limit to events with depths equal to or less than the specified depth"/>
                  </param>
                  <param xmlns:xs="http://www.w3.org/2001/XMLSchema" name="mindepth" style="query" type="xs:double">
                     <doc xml:lang="english" title="Limit to events with depths equal to or greater than the specified depth"/>
                  </param>
                  <param xmlns:xs="http://www.w3.org/2001/XMLSchema" name="latitude" style="query" type="xs:double" default="0.0">
                     <doc xml:lang="english" title="Specify the central latitude point for a radial search"/>
                  </param>
                  <param xmlns:xs="http://www.w3.org/2001/XMLSchema" name="longitude" style="query" type="xs:double" default="0.0">
                     <doc xml:lang="english" title="Specify the central longitude point for a radial search"/>
                  </param>
                  <param xmlns:xs="http://www.w3.org/2001/XMLSchema" name="maxradius" style="query" type="xs:double" default="180.0">
                     <doc xml:lang="english" title="Specify maximum distance from the geographic point defined by latitude and longitude"/>
                  </param>
                  <param xmlns:xs="http://www.w3.org/2001/XMLSchema" name="minradius" style="query" type="xs:double" default="0.0">
                     <doc xml:lang="english" title="Specify minimum distance from the geographic point defined by latitude and longitude"/>
                  </param>
                  <param xmlns:xs="http://www.w3.org/2001/XMLSchema" name="orderby" style="query" type="xs:string" default="time">
                     <doc xml:lang="english" title="Specify the ordering of the returned results"/>
                     <option value="time">
                        <doc xml:lang="english" title="Sort by time, descending"/>
                     </option>
                     <option value="magnitude">
                        <doc xml:lang="english" title="Sort by magnitude, descending"/>
                     </option>
                     <option value="time-asc">
                        <doc xml:lang="english" title="Sort by time, ascending"/>
                     </option>
                     <option value="magnitude-asc">
                        <doc xml:lang="english" title="Sort by magnitude, ascending"/>
                     </option>
                  </param>
                  <param xmlns:xs="http://www.w3.org/2001/XMLSchema" name="updatedafter" style="query" type="xs:date">
                     <doc xml:lang="english" title="Limit to events updated after the specified time"/>
                  </param>
                  <param xmlns:xs="http://www.w3.org/2001/XMLSchema" name="eventid" style="query" type="xs:long">
                     <doc xml:lang="english" title="Retrieve an event based on the unique ID numbers assigned by the IRIS DMC"/>
                  </param>
                  <param xmlns:xs="http://www.w3.org/2001/XMLSchema" name="originid" style="query" type="xs:long">
                     <doc xml:lang="english" title="Retrieve an event based on the unique origin ID numbers assigned by the IRIS DMC"/>
                  </param>
                  <param xmlns:xs="http://www.w3.org/2001/XMLSchema" name="includearrivals" style="query" type="xs:boolean" default="false">
                     <doc xml:lang="english" title="Specify if phase arrivals should be included"/>
                  </param>
                  <param xmlns:xs="http://www.w3.org/2001/XMLSchema" name="includeallmagnitudes" style="query" type="xs:sboolean" default="false">
                     <doc xml:lang="english" title="Retrieve all magnitudes for the event, or only the primary magnitude from within the catalog"/>
                  </param>
                  <param xmlns:xs="http://www.w3.org/2001/XMLSchema" name="includeallorigins" style="query" type="xs:boolean" default="false">
                     <doc xml:lang="english" title="Retrieve all origins or only the primary origin associated with each event in a catalog"/>
                  </param>
                  <param xmlns:xs="http://www.w3.org/2001/XMLSchema" name="limit" style="query" type="xs:int">
                     <doc xml:lang="english" title="Limit the results to the specified number of events"/>
                  </param>
                  <param xmlns:xs="http://www.w3.org/2001/XMLSchema" name="offset" style="query" type="xs:int" default="1">
                     <doc xml:lang="english" title="Return results starting at the event count specified"/>
                  </param>
                  <!-- <param xmlns:xs="http://www.w3.org/2001/XMLSchema" name="output" style="query" type="xs:string" default="xml"/> -->
                  <param xmlns:xs="http://www.w3.org/2001/XMLSchema" name="format" style="query" type="xs:string" default="xml">
                     <doc xml:lang="english" title="Specify output format. This is an IRIS extension to the FDSN specification"/>
                     <option value="xml" mediaType="application/xml"/>
                     <option value="text" mediaType="text/plain"/>
                  </param>
                  <param xmlns:xs="http://www.w3.org/2001/XMLSchema" name="nodata" style="query" type="xs:int" default="204">
                     <doc xml:lang="english" title="Specify which HTML Status code is returned when no data is found. This is an IRIS extension to the FDSN specification"/>
                     <option value="204"/>
                     <option value="404"/>
                  </param>
               </request>
               <response>
                  <representation mediaType="text/plain"/>
                  <representation mediaType="application/xml"/>
               </response>
            </method>
         </resource>
         <resource path="/version">
            <method id="version" name="GET">
               <response>
                  <representation mediaType="text/plain"/>
               </response>
            </method>
         </resource>
         <resource path="/catalogs">
            <method id="catalogs" name="GET">
               <response>
                  <representation mediaType="application/xml"/>
               </response>
            </method>
         </resource>
         <resource path="/contributors">
            <method id="contributors" name="GET">
               <response>
                  <representation mediaType="application/xml"/>
               </response>
            </method>
         </resource>
      </resource>
   </resources>
</application>
@krischer
Member

Hi Celso,

this look very good in my opinion and should enable us to query the webservice without specifying every option by hand. We might encounter more subtle problems as soon as we start working on an implementation.

@barsch: Right now I would actually prefer to create a generic FDSN webservice that is able to query all datacenters providing one. The corresponding WADL can be downloaded on-the-fly during client initialization.

@celso-iris: I am currently working on StationXML support for ObsPy and noticed that the returned StationXML files do not validate against the schema. This should require only some very minor changes. Examples:

The QuakeML files are fine :)

@barsch
Member
barsch commented Apr 16, 2013

@krischer: obspy.fdsn is definitively the way to go - I wanted to propose that anyway ;)

@krischer
Member

+1

Orfeus is AFAIK currently also working on an implementation.

@megies
Member
megies commented Apr 17, 2013

@krischer: did you validate requested QuakeML files against the official schemas/relaxNG? So far, those accepted a lot that was not conform with the UML/pdf documentation, from my experience...

@megies
Member
megies commented Jun 23, 2013

Was thinking about starting work on this at some point. Just to make sure, this is supposed to go into a new module obspy.fdsn and the client should basically take an url at initialization which will default to the IRIS ws for now. Did I get this right?

@celso-iris

@megies : That sounds correct to me.
You might like to know that the USGS has their version of the FDSN event webservice up and running now.

http://comcat.cr.usgs.gov/fdsnws/event/1/
http://comcat.cr.usgs.gov/fdsnws/event/1/application.wadl

and RESIF has data and metadata services up and running:

http://ws.resif.fr/

These might be a good places to try alternate URLs. The USGS happens to have many extensions to the FDSN spec. I don't know how you might handle it. In the IRIS-WS java library, we added an "add" routine to the EventCriteria object that takes an arbitrary string pair, and adds the results to the query url.

@krischer
Member

I would suggest that we directly parse the WADL files upon client instantiation. We could also provide some kind of mapping for known services.

Something like this might work:

WADL_MAPPINGS = {
    "IRIS": "url to iris wadl",
    "USGS": "url to usgs wadl",
    "RESIF": "url to resif wadl",
    ...
}


class Client(object):
    def __init__(self, WADL):
        if WADL in WADL_MAPPINGS:
            self._parse_wadl(WADL_MAPPINGS[WADL])
        else:
            self._parse_wadl(WADL)


# Usage
from obspy.fdsn import Client
c = Client("IRIS")
...
@megies
Member
megies commented Jun 25, 2013

I thought we consented to not using WADL in the initial implementation?

edit: talked with @krischer, should probably parse the wadls right from the start..

megies and others added some commits Jun 27, 2013
@krischer
Member
krischer commented Aug 8, 2013

I worked on this the last two days and it is almost ready. It still needs some more tests and bugfixes but the grand total is there and it should work with all services. The station downloading will be completed once the obspy.station branch is ready. Furthermore it might require some parameter reshuffling and what not.

It works by first requesting the application.wadl files for all three different resources and then parsing them. It is fully dynamic and (thanks to the WADL parsing) always up-to-date. It should be fairly robust and can deal with missing and additional parameters.

Not ready to merge yet!

Some examples: (documentation is also still missing)

Automatic service discovery

>>> from obspy.fdsn import Client
>>> client1 = Client("IRIS")
>>> print client1
FDSN Webservice Client (base url: http://service.iris.edu)
Available Services: dataselect, station, event  
>>> client2 = Client("USGS")
>>> print client2
FDSN Webservice Client (base url: http://comcat.cr.usgs.gov)
Available Services: event

The docstrings for the different request functions cover the standardized parameters. To get an idea of the capabilities for a given server, use the Client.help() method.

>>> client1.help("station")
Parameter description for the 'dataselect' service of 'http://service.iris.edu':
    starttime (UTCDateTime), Required Parameter
    endtime (UTCDateTime), Required Parameter
    network (str)
    station (str)
    location (str)
    channel (str)
    quality (str), Default value: B, Choices: D, R, Q, M, B
    minimumlength (float)
    longestonly (bool)
>>> client2.help("event")
Parameter description for the 'event' service of 'http://comcat.cr.usgs.gov':
    starttime (UTCDateTime)
    endtime (UTCDateTime)
    minlatitude (float), Default value: -90.0
    maxlatitude (float), Default value: 90.0
    minlongitude (float), Default value: -180.0
    maxlongitude (float), Default value: 180.0
    ...
The service offers the following non-standard parameters:
    kmlcolorby (str), Default value: age, Choices: age, depth
    producttype (str), Choices: moment-tensor, focal-mechanism, shakemap, losspager, dyfi
    maxcdi (float)
    minfelt (int)
    callback (str)
    eventtype (str)
    mincdi (float)
    minsig (int)
    kmlanimated (bool)
    mingap (float)
    alertlevel (str), Default value: *, Choices: green, yellow, orange, red, *
    minmmi (float)
    reviewstatus (str), Choices: automatic, reviewed
    maxgap (float)
    maxsig (int)
    maxmmi (float)

Usage

>>> from obspy.fdsn import Client
>>> c = Client("IRIS")

>>> print c.get_waveform("2012-01-01T00:00:00", "2012-01-01T00:10:00", "IU", "ANMO", "10", "BH1")
1 Trace(s) in Stream:
IU.ANMO.10.BH1 | 2012-01-01T00:00:00.019500Z - 2012-01-01T00:09:59.994500Z | 40.0 Hz, 24000 samples

>>> print c.get_event("2013-01-01", "2013-01-10")
578 Event(s) in Catalog:

578 Event(s) in Catalog:
2013-01-09T23:44:45.370000Z | +19.962,  -64.235 | 3.4 MD
2013-01-09T23:35:06.600000Z | +38.045,  -78.004 | 1.9 MD
...
2013-01-01T01:34:01.320000Z | +19.679,  -64.282 | 3.2 MD
2013-01-01T00:14:16.890000Z | +51.975, -169.566 | 2.9 ML
To see all events call 'print CatalogObject.__str__(print_all=True)'
@megies
Member
megies commented Aug 9, 2013

I know it probably should always have been "get_waveform".. nevertheless, all other clients have "getWaveform".. how to handle this mismatch?

@petrrr
petrrr commented Aug 12, 2013

Well, without knowing anything about some possibly existing deprecation strategy for ObsPy, I could imaging something like this:

  1. Rename the occurrences of getWaveform to get_waveform in the existing clients;
  2. Create a compatibility "alias" with the deprecated name;
  3. Replace the name in the old name in all the documentation, examples, etc.

But I recognise that camel case naming is used extensively in the existing service clients.

@krischer krischer Better error handling.
Also fixed two small bugs.
1b6edf7
@celso-iris

quick note: fixed the WADL for fdsn-event: the reference to xs:sboolean has been changed to xs:boolean

megies added some commits Oct 3, 2013
@megies megies Merge branch 'master' into obspy.fdsn 91fd494
@megies megies pep8 ce86ad4
@megies megies add helper function to consistently wrap long strings with common pre…
…fix (e.g. indentation)
af37d33
@megies megies fdsn: modify client.help()
 - now works without parameters, too (shows help for all available services)
 - wrap long lines with common indentation so the help is easier to read
 - show note on help function in Client.__str__()
c9d87b4
@megies megies fdsn: fix default parameters cc2bc1e
@megies megies fdsn: change get_event into get_events
 - returns a catalog so get_event is misleading
 - same for get_station -> get_stations
2089a03
@megies megies fdsn: fix handling of parameter short aliases
also some refactoring, remove code duplication
a5d47ce
@megies megies fdsn: start adding tests for example queries c2e71fb
@megies megies fdsn: except ignored parameters, show warning e43f3d4
@megies
Member
megies commented Oct 3, 2013

@celso-iris, there seems to be another problem with the WADL: the parameter "magnitudetype" is missing, instead it's abbreviation "magtype" is used in the WADL (no other abbreviations are used in the WADLs it seems..).

megies added some commits Oct 3, 2013
@megies megies fdsn: finish example query tests for "event", "station" 14921aa
@megies megies fdsn: fix wadl parser, usgs test actually never ever passed since bei…
…ng added ;)

 - dicts aren't ordered (and who said the default namespace must come
   first in the xml attribute list?), not the default but a random
   namespace was picked as the default
 - much more robust xpath fix with default namespaces, would have
   failed in case of a mix of default and other namespaces in the
   expression (see
   https://github.com/barsch/seishub.core/pull/4/files#diff-3309b0bd72b4a630e196507be23e0e0cR11)
87427c8
@megies megies fdsn: fix a test that fails due to an issue with IRIS event WADL, should
be removed again, when IRIS updates the event WADL (and after updating
data/event.wadl)
ef4b5a3
@megies megies fdsn: fix failing tests
tests were running fine when executing the corresponding test. tests
were only failing with `obspy-runtests fdsn` because of prior warnings.
5e4fde2
@megies megies fdsn: change args order to match all other clients in get_waveform() c36316d
@megies megies fdsn: get_waveform tests d58a562
@megies megies fdsn: docstrings/examples/frontpage 658fec1
@krischer
Member

True, should've done a search I guess. ^^ too lazy to change it now..

@krischer
Member

I do not really have a particular preference here - the singular forms would map well to the resource names specified by the webservices but I agree that they are misleading and thus I agree with the change.

Should we also change the waveform method to get_waveforms() to be consistent?

Member

If you want, go ahead.. I don't care.
I left it because all other clients so far have getWaveform (and iris had getEvents btw) but of course plural would kind of make sense here, too.

@megies megies referenced this pull request Oct 4, 2013
Open

obspy.fdsn TODO list #646

5 of 7 tasks complete
@megies
Member
megies commented on 5afd537 Oct 4, 2013

You can just git pull --rebase if you can't push because somebody else commited upstream meanwhile.. avoids the merge commit.

@megies
Member
megies commented Oct 4, 2013

I'm OK with merging this. Open points are tracked in #646.

@krischer
Member
krischer commented Oct 4, 2013

@celso-iris I found a small bug: The event HTML page does not describe the originid parameter, but the WADL does.

@krischer krischer merged commit ff05839 into master Oct 4, 2013

1 check passed

default The Travis CI build passed
Details
@megies

hmm, @krischer, I think it is a bit strange to have catalogs/contributors in self.services, i.e. on the same level as event, station and dataselect (like in d173bc2#diff-ecac814d66ec7997e777fcb0fdeb43a7R36). They are just additional information for event after all.. (and some if/elses are necessary now, e.g.5510b06#diff-ecac814d66ec7997e777fcb0fdeb43a7R572)

Member

Yea I though so as well but at client initialization time all 5 resources (the three WADLs and catalog and contribs) are downloaded asynchronously so it is impossible to predict which one finishes first so one cannot simply append it to the event service without some additional logic. Stilll..changing it might be a good idea.

@mbyt mbyt deleted the obspy.fdsn branch Feb 16, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment