NCEDC News/Blog

SWC - perl program for downloading waveform data from the NCEDC

Categories:   Metadata  |  Northern California Earthquake Data Center (NCEDC)  |  Waveform Data  |  Data Distribution

May 18, 2011 

The NCEDC is pleased to announce the introduction of the Simple Waveform Client (SWC), a command-line program for easily dowloading waveform retrieval from the NCEDC Archive and NCEDC DART (Data Available in Real Time). The NCEDC Simple Wave Client (SWC) and and companion program Simple Wave Server (SWS) at the NCEDC provide a simple interface for retrieving segments of continuous or event time series data in MiniSEED format. Data can be requested by SEED Station, Network, Channel, Location, time interval, and/or eventid.

SWC is a perl program and accomanying perl module that runs on Linux, Solaris/Unix, and MacOS systems. The NCEDC provides 2 Simple Wave Servers:

  • an sws server for archived data in the NCEDC Data Archive
  • an sws server for real-time data in the NCEDC DART (Data Available in Real Time)

Dataless SEED volumes with complete metadata for all channels are available by FTP or HTTP from the NCEDC Metadadir Directories which are organized by network code.

The swc program can be downloaded from the swc program directory. After downloading the distribution file, install the program with the following steps:

    tar xvf swc-dist-108.tar
    cd swc-dist-108
    perl INSTALL_SWC.pl

You will be prompted for several options for personal vs system-wide installation.

The syntax for the swc program is shown below.

Syntax:
swc  [-h] [-M] [-T|-K] [-f starttime [ -t endtime | -s timespan ]]  
	[-E eventid -D eventid_domain] [-o - | outputfile] [-e] [-d N]  
	[-S server] [-H hostname ][-P port] sncl1 ... snclN
where:
    -h      Help - prints this help message.
    -I      Request channel Inventory (menu list) instead of waveform data.
    -T|-K   Trim waveforms to specified time (-T) or Keep data from records 
            within specified time interval (-K).  Default is -T.
    -f starttime

            Start time of waveform.
            The date and time are specified in a single string, and can
                 can be provided in one of several formats:
                        yyyy/mm/dd,hh:mm:ss.ffff
                        yyyy.doy,hh:mm:ss.ffff
                The date must be fully specified.  The time portion is optional,
                and may be specified to hour, minute, second, or subsecond
                resolution.
    -t endtime
            End time of waveform.
    -s timespan
            Timespan of request.  Timespan is an integer string terminated 
            with one of the following characters (case sensitive).  
            If no terminater character is used, seconds are assumed.
                        S = seconds     d = days
                        M = minutes     m = months
                        H = hours       y = years
    -E eventid
            Specify an eventid for retrieving event waveforms.  
            Not all Simple Waveform Servers support retrieval by event.  
            The NCEDC DART does NOT know about events.
    -D event_domain
            Specify the domain for the eventid (NC or SC).
    -o - | outputfile
            Specifies an explicit output file, or '-' for stdout.  
            If this option is not specified, an output 
            file based on the SNCL and date_time will be created.
    -e    Output event data into a directory 
            instead of the current directory.  Does NOT override '-o' option.
    -S servername
            Generic name of waveform server. Valid servernames are:
                dart, ncedc_archive.
            Default servername is ncedc_archive.  See .swc-init.pl file 
            in home directory for configuration.
    -H hostname
            Explicit hostname or IP address of waveform server.
    -P portnumber
            Port number or port name of server.  Default port number is 4999.
    -d N    Debug value.  Current values are:
            1 = display request and response.
    sncl1 ... snclN
            A list of one or more SNCL-strings, each containing 
            dot-separated sections:
                Station.Network.Channel.Location
            Each section may be a single component (eg BKS) or a
	    comma-delimited list of components such as BKS,CMB or HHE,HHN,HHZ.
	    If any section contains a comma-delimited list, the SNCL-string is
	    expanded to multiple SNCLs by performing a cross-product of the
	    each components the the section with every other other section of
	    the SNCL-string.  For blank location codes, you may optionally
	    omit the .Location portion of the SNCL-string.
Notes:
1.  Wildcard characters used within a SNCL must be quoted to avoid having the Unix/Linux shell 
    perform the wildcard expansion.   For Unix/Linux, use a backslash character before the  wildcard 
    character, or enclose the SNCL string in quotes.

Examples:

1.  swc -S ncedc_archive -T -f 2010/02/24,05:15 -s 5M HOPS.BK.HHZ CMB.BK.HHZ

2.  swc -S ncedc_archive -T -f 2010.123,12:05:15.67 -s 5M 'HOPS,CMB.BK.BHE,BHN,BHZ.*'
       expands to the list of SNCLs:
                HOPS.BK.BHE.* HOPS.BK.BHN.* HOPS.BK.BHE.*
                CMB.BK.BHE.*  CMB.BK.BHN.*  CMB.BK.BHE.*
        The waveform server will perform the wildcard expansion.

3.  swc -S dart -T -f 2011.054,12:05:15.67 -s 5M 'CMB.BK.BHZ.*'

4.  swc -S ncedc_archive -E 71365875 -e

The NCEDC is a joint project of the University of California, Berkeley and the USGS, with facilities located at the University of California, Berkeley. Please send us email at ncedcinfo@ncedc.org or fill out our comments form if you have questions or comments about these changes.