Learn R Programming

eseis (version 0.6.0)

read_sac: Read sac files.

Description

This function reads sac files.

Usage

read_sac(
  file,
  append = TRUE,
  signal = TRUE,
  time = TRUE,
  meta = TRUE,
  header = TRUE,
  eseis = TRUE,
  get_instrumentdata = FALSE,
  endianness = "little",
  biglong = FALSE,
  type = "waveform"
)

Value

List object, optionally of class eseis.

Arguments

file

Character vector, input file name(s), with extension.

append

Logical value, option append single files to one continuous file, keeping only the header information of the first file, default is TRUE.

signal

Logical value, option to import the signal vector, default is TRUE.

time

Logical value, option to create the time vector. The timezone is automatically set to "UTC", default is TRUE.

meta

Logical value, option to append the meta data part, default is TRUE.

header

Logical value, option to append the header part, default is TRUE.

eseis

Logical value, option to read data to an eseis object (recommended, see documentation of aux_initiateeseis), default is TRUE

get_instrumentdata

Logical value, option to fill meta information (sensor name, logger name, logger gain) from SAC user fields (field 127-129, KUSER0-KUSER2). Default is FALSE.

endianness

Logical value, endianness of the sac file. One out of "little", "big" and "swap". Default is "little".

biglong

Logical value, number coding format. Default is FALSE.

type

Character value, type keyword of the data. One out of "waveform", "envelope", "fft", "spectrum", "spectrogram", "other", hilbert, hvratio. Default is "waveform".

Author

Michael Dietze

Details

The function reads one or more sac-files. If append = TRUE, all files will be appended to the first one in the order as they are provided. In the append-case the function returns a either a list with the elements signal, time, meta and header or a list of the class eseis (see documentation of aux_initiateeseis). If append = FALSE and more than one file is provided, the function returns a list of the length of the input files, each containing the above elements.

The sac data format is implemented as descibed on the IRIS website (https://ds.iris.edu/files/sac-manual/manual/file_format.html).

Examples

Run this code

if (FALSE) {
## read one file
file1 <- "~/Data/sac/EXMP01.14.213.01.00.00.BHE.SAC"

sac1 <- read_sac(file = file1)

## read two (or more files) without meta and header parts
file2 <- c("~/Data/sac/EXMP01.14.213.01.00.00.BHE.SAC",
           "~/Data/sac/EXMP01.14.213.02.00.00.BHE.SAC")

sac2 <- read_sac(file = file2, 
                 meta = FALSE, 
                 header = FALSE,
                 eseis = FALSE)
}

Run the code above in your browser using DataLab