Learn R Programming

RSEIS (version 3.3-3)

makeDB: Create a seismic Waveform Database

Description

Create a seismic Waveform Database

Usage

makeDB(path=".", pattern="R", dirs="", kind = 1,
Iendian=1, BIGLONG=FALSE)
FmakeDB(LF2, kind =1, Iendian=1, BIGLONG=FALSE)

Arguments

path
character, Path to directory where files and directories exist
pattern
character, pattern for listing of files
dirs
character, vector of directories to be scanned
kind
kind of data: R(DAT)=0, segy=1; sac=2
Iendian
default=1Endian-ness of the data: 1,2,3: "little", "big", "swap". Default = 1 (little)
BIGLONG
logical, TRUE means long=8 bytes
LF2
list of files

Value

  • list:
  • fnfile name
  • yryear
  • jdjulian day
  • hrhour
  • miminute
  • secsecond
  • durduration, seconds
  • t1time 1 in Epoch days
  • t2time 2 in Epoch days
  • stastation name
  • compcomponent name
  • dtsample rate, seconds

Details

The files are typically located in a directory structure created by programs like ref2segy, a PASSCAL program for downloading data in the field. Each file contains one seismogram, with a header. makeDB reads in all the headers and creates a list of meta-data for later use in RSEIS.

Uses readBin to extract data in SAC format. user must know what kind of machine the data was created on for I/O purposes.

If data was created on a little endian machine but is being read on big endian machine, need to call the endian "swap" for swapping.

If data was created on a machine with LONG=4 bytes, be sure to call the program with BIGLONG=FALSE.

If the base directory, or the subdirectories, contain files that are not seismic data then care must be taken. Perhaps use FmakeDB to explicitly names the files for the DataBase.

If using FmakeDB a simple vecotr of files (full path names) should be provided.

The origin year, used for getting the Epoch year, is stored as attribute origyr.

See Also

setupDB, Mine.seis , getseis24, plotseis24, EPOCHday, swig

Examples

Run this code
#####  set directory
path <- '/home/lees/Site/Santiaguito/SG09'
pattern <- "R0*"

###   get DB information
XDB  <-  makeDB(path, pattern, kind =1)

##### select a station
usta <- "CAL"
acomp <- "V"

#####   extract 24 hours worht of data
JJ <- getseis24(DB, 2009, 2, usta, acomp, kind = 1)


#####  plot 24 hours worth of data

pjj <- plotseis24(JJ, dy=1/18, FIX=24, SCALE=0,
FILT=list(ON=FALSE, fl=0.05 , fh=20.0, type="BP", proto="BU"),
RCOLS=c(rgb(0.2, .2, 1), rgb(.2, .2, .2))  )


###  window a small portion on 24 hour display
w <- winseis24(pjj)

###  open a new window
X11()
VNE <- c("V", "N", "E")
###  IJK <- c("I", "J", "K")

gsta <- c("CAL", "KAM", "DOM",  "LAV")

ucomp<-VNE

###  or:   ucomp<-IJK

###   set epoch day and get the times
 eday <- EPOCHday(w$yr, jd = w$jd, origyr = DB$origyr)

##  using epoch day, set times for beginning and end of window
        at1 <- eday$jday + (w$hr[1])/24
        at2 <- eday$jday + (w$hr[2])/24
###  extract data from the data base:
        GH <- Mine.seis(at1, at2, DB, gsta, ucomp)

###  show data:
        swig(GH)

Run the code above in your browser using DataLab