Simple DHI Clients

This is a collection of very simple DHI clients that nevertheless do useful things. They are primarily aimed at showing basics of how to code a DHI client including finding a server, connecting to it and retrieving some useful information. Because they are meant to be as simple and independent as possible, much code is repeated. They should be used to get over the basic learning curve of writting DHI clients.

A tar or zip file with scripts and all needed jars can be downloaded here.

EventClient

Java Source

The EventClient makes a simple query to the IRIS EventDC to retrieve and print out recent earthquakes. Here is a sample of the output

INFO - got 42 events
INFO - 0th origin is at latitude 33.32 longitude 142.32 and its magnitude is 5.2
INFO - 1th origin is at latitude 33.32 longitude 142.32 and its magnitude is 5.6
INFO - 2th origin is at latitude 2.8423 longitude 93.5439 and its magnitude is 5.7
INFO - 3th origin is at latitude 2.84 longitude 93.54 and its magnitude is 5.7

NetworkClient

Java Source

The NetworkClient makes a simple query to the IRIS NetworkDC to retrieve and print out stations and channels. Here is a sample of the output

INFO - Network II has 44 stations
INFO - PFO, Pinon Flat, California, USA is located at 33.6092, -116.4553
INFO - Station II.PFO has 473 channels.

ResponseClient

Java Source

The ResponseClient makes a query to the IRIS NetworkDC to retrieve and print out the response for a channel. Here is a sample of the output

INFO - Got 44 stations
INFO - Got 473 channels from PFO
INFO - Channel: II.19861024T00:00:00.000Z.PFO.  .BHE.19950119T00:00:00.000Z
INFO - 
#
###################################################################################
#
B050F03     Station:       PFO
B050F16     Network:       II
B052F03     Location:        
B052F04     Channel:       BHE
B052F22     Start date:    1995,019,00:00:00
B052F23     End date:      1997,261,23:59:59
#
#                   +-----------------------------------+
#                   |     Response (Poles and Zeros)    |
#                   |        II  PFO      BHE           |
#                   |     01/19/1995 to 09/18/1997      |
#                   +-----------------------------------+
#

SacPoleZeroClient

Java Source

The SacPoleZeroClient is similar to the ResponseClient, but prints out the response as a Sac polezero file. Here is a sample of the output

INFO - Got 44 stations
INFO - Got 473 channels from PFO
INFO - Channel: II.19861024T00:00:00.000Z.PFO.  .BHE.19950119T00:00:00.000Z
INFO - PoleZero:
ZEROS       6              
-78.5398    0.0000         
-0.1525     0.0000         
-0.1525     0.0000         
POLES       12             
-0.0125     0.0122         
-0.0125     -0.0122        
-0.1284     0.0000         
-0.1811     0.0000         
-40.0569    48.4075        
-40.0569    -48.4075       
-303.4778   81.2234        
-303.4778   -81.2234       
-222.1445   222.1439       
-222.1445   -222.1439      
-81.3044    303.4559       
-81.3044    -303.4559      
CONSTANT    2.4538751E25  

SeismogramClient

Java Source

The SeismogramClient makes a simple query to the IRIS DataCenter to retrieve and print out a seismogram. Here is a sample of the output

INFO - querying for IU.HRV.  .BHE
INFO - seis[0] has 31450 points and starts at 2003-06-20T06:20:19.752Z

SacFileClient

Java Source

The SacFileClient is similar to the SeismogramClient, but saves the seismogram as a SAC file. Here is a sample of the output

INFO - querying for IU.HRV.  .BHE
INFO - Saved seismogram to IU.HRV.__.BHE.SAC.0 and it has 31450 points and starts at 2003-06-20T06:20:19.752Z