SeisFile

SeisFile is a library for reading and writing seismic file formats in java. Currently support exists for SAC, MiniSEED and PSN with limited support for full SEED. Partial support for the IRIS DMC Station web service, which returns StationXML exists to the resp level. Support for the IRIS DMC DataSelect web service, USGS LISS, USGS CWB and Geofon SeedLink protocols are also included. These are low level routines that provide basic connection to the services and basic parsing of the file formats into objects that closely mirror those formats. Hence they are intended to be used as a library rather than an application. The clients, althugh functional, mainly serve as an example of how to connect to these services. Full SEED support was also not intended. However there are cases of almost miniseed, such as one or two control records before the data records. SeisFile can handle the basic structure of these control records, allowing these mixed files to be read without crashing, but not all blockettes are parsed into fields. Support for the many blockette types in full SEED could be added in the future, although there is a large amount of bookkeeping to implement that and seisFile was intended to be small and focused.

The developer page for seisFile is now hosted at http://code.google.com/p/seisfile.

SeisFile is released under the GNU Public License, v3 or later.


Example Apps

There are several example applications included, showing how to use seisFile in different ways. The clients, located in the bin directory, are:

  1. saclh - prints all the header fields of sac files, see edu/sc/seis/seisFile/sac/ListHeader.java
  2. mseedlh - prints the header and blockettes of seed control and data records, see edu/sc/seis/seisFile/mseed/ListHeader.java
  3. seedlinkclient - connects to a SeedLink server and retrieves miniseed data from it
  4. lissclient - connects to a liss server and retrieves miniseed data from it
  5. dswsclient - connects to the IRIS DMC data select web service and retrieves miniseed data from it
  6. stationxmlclient - connects to the IRIS DMC station web service and retrieves information about networks, stations and channels from it.
  7. cwbclient - connects to the USGS CWB service and retrieves miniseed data from it.

SAC

SAC supports both reading of binary SAC datafiles, as well as poles and zeros.

SacTimeSeries sac = new SacTimeSeries(filename);
or
DataInput dis = ...
SacTimeSeries sac = new SacTimeSeries(dis)
and reading a polezero file:
SacPoleZero spz = new SacPoleZero(filename);


SEED and MiniSEED

Miniseed support is good for straight miniseed, ie only binary "data records" and no ascii "control records". It is less complete for the control blockettes in full SEED. SeisFile also does not include routines to decompress seed data, please see SeedCodec for these routines. A miniseed file can be read like this.

DataInput dis = new DataInputStream(new BufferedInputStream(new FileInputStream(filename)));
PrintWriter out = new PrintWriter(System.out, true);
try {
    while (true) {
        SeedRecord sr = SeedRecord.read(inStream, 4096);
        // maybe print it out...
        sr.writeASCII(out);
        if (sr instanceof DataRecord) {
            DataRecord dr = (DataRecord)sr;
            // now do something with the data...
        }
    }
} catch (EOFException e) {
}


PSN

PSNDataFile psnData = new PSNDataFile(filename);

SeedLink

An example of seedlink support is in src/main/java/edu/sc/seis/seisFile/seedlink/Client.java which can also be run as a client. For example:

bin/seedlinkclient -n II -c BHZ  -m 8
will print a summary of 8 packets from the II network and
bin/seedlinkclient -n IU -s KONO -c BHZ -o kono.mseed  -m 8
will store the next 8 packets for KONO in a miniseed file.

Usage is:


java edu.sc.seis.seisFile.seedlink.Client [-n net][-s sta][-l loc][-c chan][-h host][-p port][-o outfile][-m maxpackets][--verbose][--version][--help]


DataSelect

An example of support for the new IRIS DMC dataSelect web service is in src/main/java/edu/sc/seis/seisFile/dataSelectWS/Client.java which can also be run as a client. For example:

bin/dswsclient -n IU -s BBSR -l 00 -c BHZ -b 2010-10-01T00:00:00.0 -d 120
downloads 120 seconds of miniseed data for IU.BBSR.00.BHZ.

Usage is:


java edu.sc.seis.seisFile.dataSelectWS.Client [-n net][-s sta][-l loc][-c chan][-b yyyy-MM-ddTHH:mm:ss.SSS][-d seconds][-u url][-o outfile][-m maxpackets][--verbose][--version][--help]

CWB

An example of support for the USGS CWB service is in src/main/java/edu/sc/seis/seisFile/usgsCWB/Client.java which can also be run as a client. For example:

bin/cwbclient -n US -s DUG -l 00 -c BHZ -b 2010-10-01T00:00:00.0 -d 120
downloads 120 seconds of miniseed data for US.DUG.00.BHZ.

Usage is:


java edu.sc.seis.seisFile.dataSelectWS.Client [-n net][-s sta][-l loc][-c chan][-b yyyy-MM-ddTHH:mm:ss.SSS][-d seconds][-u url][-o outfile][-m maxpackets][--verbose][--version][--help]

StationXML

An example of support for the new IRIS DMC station web service is in src/main/java/edu/sc/seis/seisFile/station/StationXMLClient.java which can also be run as a client. For example:

bin/stationxmlclient -u 'http://www.iris.edu/ws/station/query?net=IU&sta=SNZO&chan=BHZ&level=chan'
StaMessage
Source: IRIS-DMC
Sender: IRIS-DMC
Module: IRIS WEB SERVICE: http://www.iris.edu/ws/station Networks: [IU] Stations: [SNZO] Channels: [BHZ] level:[chan]
SentDate: 2011-06-03T16:00:41
Network: IU Global Seismograph Network (GSN - IRIS/USGS) 1988-01-01T00:00:00 2500-12-12T23:59:59
  Station: IU.SNZO 4
    Station Epoch: IU.SNZO  1992-04-07T00:00:00 to 1997-11-19T00:00:00
      Channel Epoch:   .BHZ  1992-04-09T00:00:00 to 1997-11-19T00:00:00
    Station Epoch: IU.SNZO  1997-11-19T00:00:00 to 2009-09-18T00:00:00
      Channel Epoch:   .BHZ  1997-11-19T00:00:00 to 1999-02-14T22:00:00
      Channel Epoch: 00.BHZ  1999-02-14T22:00:00 to 2003-01-28T06:00:00
      Channel Epoch: 00.BHZ  2003-01-28T06:00:00 to 2009-09-18T00:00:00
      Channel Epoch: 10.BHZ  1999-02-14T22:10:00 to 2006-01-25T22:00:00
      Channel Epoch: 10.BHZ  2006-01-25T22:00:00 to 2009-09-18T00:00:00
    Station Epoch: IU.SNZO  2009-09-18T00:00:00 to 2010-12-10T00:00:00
      Channel Epoch: 00.BHZ  2009-09-18T00:00:00 to 2010-12-10T00:00:00
      Channel Epoch: 10.BHZ  2009-09-18T00:00:00 to 2010-12-10T00:00:00
    Station Epoch: IU.SNZO  2010-12-10T00:00:00 to 2599-12-31T23:59:59
      Channel Epoch: 00.BHZ  2010-12-10T00:00:00 to 2599-12-31T23:59:59
      Channel Epoch: 10.BHZ  2010-12-10T00:00:00 to 2599-12-31T23:59:59
gets the BHZ channels for IU.SNZO.

Usage is:


bin/stationxmlclient -u url

Because the URL will have ampersands and question marks, it might need to be enclosed in single quotes


Download

The distribution can be downloaded here: http://www.seis.sc.edu/downloads/seisFile. Source is included and a precompiled jar file will be in the lib subdirectory.

seisFile can be recompiled with the gradlew script, like ./gradlew jar which will place a recompiled jar in the build/libs directory. See gradle.org for more information.

SeisFile comes with several extra jars in the lib directory. However, these are only used by the XML parsing needed by for stationXML. Applications using only the other file/server types within seisFile do not need to include them.

If you have any comments, please email us.

SeisFile is a product of the University of South Carolina.