Data Services Newsletter

Volume 14 : No 1 : Spring 2012

Direct Data Access from within MATLAB®

Have you ever wished you could have your MATLAB programs interact seamlessly with the IRIS-DMC repository?

How would you like to reduce the steps required to work with data and metadata …


from this:
  1. request data from IRIS
  2. retrieve the results (perhaps minutes later)
  3. store them locally
  4. (perhaps) convert them
  5. import them into MATLAB
  6. do science!


to this:
  1. request data from IRIS
  2. do science!

Well, now you can. We have provided an .m file (irisFetch.m) that contains functions you would need to access station metadata, event metadata, and seismic traces. The retrieved data is placed directly into a MATLAB® variable and is available for immediate use. If you happen to use the GISMO or Waveform Suites for MATLAB (r339 or later), your existing codes can access waveforms directly from the DMC with minimal modification. All these abilities are available thanks to the new IRIS Java Web Service Library (IRIS-WS Library), but the best part is that you don’t need to know java to take advantage of it!.

Using the irisFetch.m file, you will be able to retrieve:

  • station metadata, down to the response level
  • trace data, which contains both time series data with associated station metadata
  • event parameters, including magnitudes, locations, and picks

A bare-bones example

These two lines of code are all that are required to grab and plot a seismic trace using irisFetch.m:

traces = irisFetch.Traces('IU','ANMO','00','BHZ', ...
        '2010-02-27 06:30:00','2010-02-27 07:30:00');
plot(traces(1).data);

with the resulting output:

Image returned from example code to grab and plot a seismic trace using irisFetch.m
Figure 1: Image returned from example code to grab and plot a seismic trace using irisFetch.m

That’s all there is to it.

For additional examples and to learn more about…

by Celso Reyes (IRIS Data Management Center)

Page built 20:06:52 | v.995c67d7