### sacWriter

The seismograms are written to sac files in the location indicated by location. If multiple seismograms are found for a channel seismograms past the first will be written out with a number appended to their file name. ie the second seismogram will be filename.1 and the third will be filename.2.

The phaseTimeHeader element will cause the travel time of the given phase to be placed in the sac header corresponding to the tHeader element. tHeader can be 0-9 as well as a. In the case of 0-9, the ray parameter is inserted into the corresponding userX header as rad/sec. In the case of triplicated phases, the arrivalIndex can be used to pick an arrival different from the first. The default is 1, yeilding the first arrival. If this is set to 2, the second arrival is used and if it is set to -1 then the last arrival is used. See the TauP user manual, http://www.seis.sc.edu/TauP, for the phase naming convention.

If the littleEndian element is added to the sacWriter, it will write out sac files in Intel processor style little endian byte order. It defaults to writing in big endian order.

The sacHeaderScript allows manipulation of the sac file before it is written. This is a type of script similar to seismogramScript. The event is put as "event", the channel as "channel" and the sac file as "sac".

Because of the limitations of the SAC header in specifying the data units, this will not set the idep header. In the case of having applied the response via transferResponse, the units will be displacement in meters in most cases, but setting the idep header to IDISP would imply the units are nanometers. Similarly for a velocity seismogram where only the overall gain has been applied, the units are most likely to be velocity in meters per second, but the IVEL value implies nanometers per second. Should you wish to set this header, you should be careful that the output data is scaled appropriately for the header value you use.

### Example

    <sacWriter>
        <workingDir>seismograms</workingDir>
        <location>${network.code}.${station.code}/${event.filizedTime}/${site.code}.${channel.code}.sac</location>
        <phaseTimeHeader>
            <model>prem</model>
            <phaseName>ttp</phaseName>
            <tHeader>a</tHeader>
        </phaseTimeHeader>
        <phaseTimeHeader>
            <model>prem</model>
            <phaseName>tts</phaseName>
            <tHeader>1</tHeader>
            <arrivalIndex>2</arrivalIndex>
        </phaseTimeHeader>
        <sacHeaderScript type="jython">
            from edu.sc.seis.seisFile.sac import SacConstants
            h = sac.getHeader()
            h.idep=SacConstants.IDISP
            h.ievtyp=SacConstants.IEQ
            h.iqual=SacConstants.IGOOD
            h.evdp = h.evdp/1000 # to make depth in km instead of meters
        </sacHeaderScript>
    </sacWriter>

### This consists of

<sacWriter>

seisWriterBase
<phaseTimeHeader> Any number of times
phaseTimeContents
</phaseTimeHeader>
<sacHeaderScript> Any number of times
An attribute named type with a value of Any Text Any text
</sacHeaderScript>
<littleEndian/> optional
</sacWriter>

### Places this can be found

In seismogramProcess there is a choice between all of the following

- printlineSeismogramProcess
- sacWriter
- mseedWriter
- asciiWriter
- wavWriter
- recordSectionDisplayGenerator
- responseGain
- phaseCut
- requestCut
- merge
- gapFill
- rMean
- rTrend
- taper
- externalWaveformProcess
- seismogramScript
- localSeismogramTemplateGenerator
- filter
- rms
- oregonDSPFilter
- forkProcess
- alwaysSuccess
- phaseSignalToNoise
- compoundPhaseSignalToNoise
- seismogramImageProcess
- legacyExecute
- seismogramAND
- seismogramOR
- seismogramNOT
- someDataCoverage
- noDataGaps
- fullDataCoverage
- integrate
- differentiate
- transferResponse
- collapseOverlaps
- div
- mul
- invertFlippedChannels
- seismogramSampling
- decimate
- stddev
- rms
- mean
- minMax
- compressionType
- availableDataPlus