aux_obspyeseis: Convert ObsPy object to eseis object

View source: R/aux_obspyeseis.R

aux_obspyeseisR Documentation

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)

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.

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)

Value

eseis object.

Author(s)

Michael Dietze

Examples


## Not run: 

## 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)

## End(Not run)


eseis documentation built on Aug. 10, 2023, 5:08 p.m.

Related to aux_obspyeseis in eseis...