Learn R Programming

eseis (version 0.8.0)

aux_obspyeseis: Convert ObsPy object to eseis object

Description

The function converts an ObsPy stream object to an eseis object. The functionality is mainly useful when running ObsPy through R using the package 'reticulate'.

Usage

aux_obspyeseis(data, simplify = TRUE)

Value

eseis object.

Arguments

data

obspy stream object, list element, created by running ObsPy through R using the package 'reticulate'.

simplify

Logical value, option to simplify output when possible. This basically means that if there is only trace object in the ObsPy stream, the list object will have one level less. Default is TRUE.

Author

Michael Dietze

Details

Initiation of the reticulate-based python toolbox support can be cumbersome. The following suggestions from Guthub (https://github.com/rstudio/reticulate/issues/578) helped in a case study:

library(reticulate) use_condaenv("r-reticulate") py_install("obspy", pip = TRUE)

Examples

Run this code

if (FALSE) {

## load ObsPy library with package 'reticulate'
## (requires ObsPy to be installed on the computer)
obspy <- reticulate::import("obspy")

## set seismic data directory
dir_data <- paste0(system.file("extdata", package="eseis"), "/")

## read miniseed file to stream object via ObsPy
x <- obspy$read(pathname_or_url = "dir_data/2017/99/RUEG1.17.99.00.00.00.BHZ.SAC")

## convert ObsPy stream object to eseis object
y <- aux_obspyeseis(data = x)

## plot eseis object
plot_signal(y)
}

Run the code above in your browser using DataLab