Learn R Programming

RSEIS (version 3.3-3)

write1sac: Write one SAC file to disk.

Description

Write one time series trace to a disk. The time series must have header information available.

Usage

write1sac(a1, BIGLONG = FALSE, fn = NULL)

Arguments

a1
BIGLONG
logical, TRUE=long=8 bytes
fn
character, output file name (if null, program will generate file name from date-time

Value

  • Side effects, writes file on disk

Details

Creates a binary SAC format file on disk for sharing and transfer. The header information for the SAC file is fairly limited.

References

http://www.iris.edu/software/sac/manual/file_format.html

See Also

JSAC.seis, rseis2sac

Examples

Run this code
data(GH)
theENDIAN <-  .Platform$endian
    for(i in 1:length(GH$dt))
      {
        fn <- "GH"
        thesta <- GH$STNS[i]
        thecomp <- GH$COMPS[i]
        dt <- GH$dt[i]
        
        tstart <- list(yr=GH$info$yr[i]  ,
          jd = GH$info$jd[i]  ,
          mo = GH$info$mo[i]  ,
          dom = GH$info$dom[i]  ,
          hr = GH$info$hr[i]  ,
          mi = GH$info$mi[i]  ,
          sec = GH$info$sec[i]  ,
          msec = GH$info$msec[i]  ,
          dt = GH$info$dt[i]  ,
          t1 = GH$info$t1[i]  ,
          t2 = GH$info$t2[i]  ,
          off = GH$info$off[i]  
          )
        N <- GH$info$n[i]

        sig <- GH$JSTR[[i]]
        
        a1 <- list(fn=fn, sta=thesta,  comp=thecomp, dt=dt, DATTIM=tstart,
          N=N, units=aunits , amp=sig , IO=list(kind=2,
         Iendian=theENDIAN,  BIGLONG=BIGLONG))
        write1sac(a1, BIGLONG=FALSE  , fn=NULL)
      }

Run the code above in your browser using DataLab