Read SAC with R

Harold Nelson

11/11/2021

Setup

Get the packages we need.

library(eseis)
library(tidyverse)

Read the Data

Also get the structure and look at the metadata.

sac1 <- read_sac("puertorico2.SAC")

str(sac1,max.level = 1)
## List of 4
##  $ signal : num [1:47520] -495 -632 -684 -689 -657 -612 -561 -492 -411 -315 ...
##  $ meta   :List of 15
##  $ header : chr [1:133] "0.025000000372529" "-12345" "-12345" "2447800064" ...
##  $ history:List of 2
##  - attr(*, "class")= chr "eseis"
sac1$meta
## $station
## [1] "ANWB"
## 
## $network
## [1] "CU"
## 
## $component
## [1] "BH1"
## 
## $n
## [1] 47520
## 
## $sensor
## [1] NA
## 
## $logger
## [1] NA
## 
## $gain
## [1] NA
## 
## $starttime
## [1] "2020-01-07 08:24:37 UTC"
## 
## $dt
## [1] 0.025
## 
## $latitude
## [1] 17.66853
## 
## $longitude
## [1] -61.78557
## 
## $elevation
## [1] 37
## 
## $depth
## [1] 2
## 
## $filename
## [1] "puertorico2.SAC"
## 
## $type
## [1] "waveform"

Look at the data.

the_data = sac1$signal
plot(the_data)