Learn R Programming

IRISSeismic (version 1.6.7)

IRISSeismic-package: Classes and methods for seismic data analysis

Description

This package provides S4 classes for downloading and processing seismological data available from Earthscope Consortium (https://www.earthscope.org) (formerly IRIS) or other data centers offering FDSN web services. Core classes Trace, Stream and IrisClient and their associated methods are inspired by the functionality available in the python ObsPy package (https://obspy.org/).

Arguments

Introduction

The "IRISSeismic-intro" vignette gives introductory examples on using the package.

In 2023, IRIS (Incorporated Research Institutions for Seismology) and UNAVCO merged to form EarthScope Consortium. IRIS (now EarthScope) webservices are unchanged but can now be accessed at https://service.earthscope.org as well as https://service.iris.edu.

Author

Jonathan Callahan jonathan@mazamascience.com

History

version 1.6.7

  • update maintainer contact information

  • update IRIS references to EarthScope

version 1.6.6

  • for web service calls that support the nodata=<204|404> option, use nodata=204

  • corrected the crossSpectrum documentation, Pxy is the cross-periodogram for ts1 and ts2

version 1.6.5

  • examples and vignette updated for better error handling when accessing internet resources

version 1.6.4

  • updated to (modified version of) libmseed-2.19.8

version 1.6.3

  • Stream object @ timing_quality now averages the values of the miniSEED blockette 1001 timing quality values, instead of summing the blockette 1001 values and dividing by the number of records

version 1.6.2

  • getDataselect, modified default time out values

  • fixed url in documentation

version 1.6.0

  • irisNetrc definition moved inside getDataselect function

  • restored getTimeseries function

  • default values for class Trace InstrumentSensitivity and SensitivityFrequency changed to NA from 1.0

  • added transferFunctionSpectra function

version 1.5.2

  • updated getDataAvailablity to use new fdsnws availability web service specification https://service.iris.edu/fdsnws/availability/1/

  • fixed bug in getDataAvailability when mergequality=FALSE

  • fixed bug in getDataAvailability affecting start/end times, introduced in version 1.5.1

  • fixed bug in mergeTraces when trace has gap at end, introduced in version 1.5.1

version 1.5.1

  • changed a subset of time format OS to OS6

  • fixed bug in mergeTraces when fdsnws/dataselect implementation cuts on records instead of sample

version 1.5.0

  • added spacing as an option to getEvalresp

  • modified getEvalresp to use IrisClient service_type

  • new getDataAvailability() to return dataframe of miniseed data extents in the IRIS archive using IRIS web service https://service.iris.edu/irisws/availability/1/

  • minor change to src code to pass CRAN checks

version 1.4.9

  • additional error handling

  • minor updates to the plot.Trace and plot.Stream functions

  • updated src/libmseed to version 2.19.6

version 1.4.8

  • updated src/libmseed to version 2.19.5

  • fix bug related to leap seconds

  • functions that call web services now follow redirects

  • some error outputs have changed slightly

  • rmsVariance function, na.rm=TRUE calculates data length minus NA values

  • rmsVariance.Stream now honors na.rm=TRUE

  • getGaps() error handling now checks for negative sample rates

  • getEvent, getEvalresp now truncates start and end input times to seconds (time format OS0 instead of OS) to fix error when user set options(digits.secs=) > 3

version 1.4.7

  • additional error handling for getDistaz

  • added input service_type to IrisClient, defaults to fdsnws

  • plot.Trace x-axis labels are "MM dd" instead of days of week for traces > 1 day and < 1 week

  • getDataselect will retry once if it encounters http code 401

  • additional error handling for spectralUtils

version 1.4.6

  • bug fix for IRISSeismic::slice

version 1.4.5

  • fixed bug in noiseModels for low noise model results at periods > 10000 seconds

  • retry if getEvent returns a service unavailable message

version 1.4.4

  • modified error messages for getEvalresp() and getDistaz()

version 1.4.3

  • changed getEvent default url from https://earthquake.usgs.gov/fdsnws/event/1/ to https://earthquake.usgs.gov/fdsnws/event/1/

version 1.4.2

  • updated libmseed version to 2.19

version 1.4.1

  • updated libmseed version to 2.18

  • fix for reading miniseed with out of order records

version 1.4.0

  • addition of repository argument to getDataselect and getSNCL, to match change in fdsnws-dataselect web service

version 1.3.9

  • fixes compile warning generated by clang

  • removes followlocation=TRUE from getDataselect RCurl options

version 1.3.8

  • getDataselect does not add a quality indicator to url by default. IRIS webservices itself defaults to quality="M"

  • getStation and getChannel do not add includerestricted indicator to url by default. IRIS webservices itself defaults to TRUE

  • better handling of textConnections

version 1.3.7

  • users can now supply instrument response information in the form of frequency, amplitude, phase to the functions psdStatistics, psdList2NoiseMatrix, psdPlot, in place of the getEvalresp webservice call. Function argument order for psdPlot is changed.

  • added showMedian option to psdPlot

version 1.3.5

  • added ignoreEpoch option to getDataselect

version 1.3.4 -- webservices and plotting

  • getEvent forwards https://service.iris.edu/fdsnws/event/1/ calls to https://earthquake.usgs.gov/fdsnws/event/1/

  • getDistaz changes output dataframe column name ellipsoid..attrs to ellipsoid.name

  • plot.Trace allows for user supplied ylab and xlab input

version 1.3.3 -- documentation

  • Updated documentation and corrected outdated links

version 1.3.2 -- bug fix

  • noiseModels(), minor correction to the New High Noise Model

version 1.3.1 -- bug fixes

  • psdStatistics() correctly handles NA values when calculating high and low PDF bin limits and returns pct_above and pct_below vectors of correct length

version 1.3.0 -- compatibility with IRIS webservices

  • getDistaz() returns new variables from output of https://services.iris.edu/irisws/distaz/1/

version 1.2.2 -- PDF bug fix

  • psdList2NoiseMatrix() adds 1 second to start time in getEvalresp call to work around a quirk in https://services.iris.edu/irisws/evalresp/1/ webservice that will not return a response if the start time is exactly on a metadata epoch boundary.

version 1.2.1 -- PDF

  • psdPlot() now compatible with changes to psdStatistics() in previous version. Adds ylo, yhi arguments to customize y-axis limits in plot.

version 1.2.0 -- PDF

  • psdStatistics() changes method of setting PDF bins from fixed values to bins based on the high and low PSD values and shifts bin centers by 0.5 dB. The result now matches output from https://services.iris.edu/mustang/noise-pdf.

verison 1.1.7 -- improved error handling

  • getDataselect(), getNetwork(), getStation(), getChannel(), getAvailability(), getEvalresp(), getTraveltime() error handling now report unexpected http status codes.

version 1.1.6 -- bug fixes

  • getGaps() fixes issues with multiple sample rates and setting minimum gap length.

  • mergeTraces.Stream() relaxes criteria for acceptable sample rate jitter.

version 1.1.5 -- trace rotation

  • rotate2D() changes orthogonality test tolerance from 5 degrees to 3 degrees.

version 1.1.4 -- trace rotation

  • rotate2D() exits if traces are not orthogonal.

version 1.1.3 -- bug fix

  • psdStatistics() fixes bug in calculation of pct_above and pct_below.

version 1.1.1 -- bug fixes

  • getGaps() minor bug fix.

  • mergeTraces.Stream() minor bug fix.

version 1.0.10 -- new data request argument and bug fixes

  • Imports seismicRoll (>= 1.1.0).

  • getGaps() fixes bugs in calculation of initial and final gap of Trace.

  • getDataselect(), getSNCL() adds "inclusiveEnd" argument, a logical that determines whether a data point that falls exactly on the requested endtime is included in the Trace.

  • libmseed change, when multiple sample rates exist in miniseed records use the mode of all sample rates instead of using the sample rate in the first record.

  • psdList() added rule for octave generation for channel codes that start with "V".

version 1.0.9 -- Trace class expansion and bug fixes

  • Improved error handling for getAvailability(), getChannel(), getDataselect(), getEvalresp(), miniseed2Stream().

  • parseMiniSEED.c, unpackdata.c updated. Fixes protection stack overflow issue.

  • getGaps() includes a 0.5/sampling_rate tolerance factor.

  • miniseed2Stream() uses endtime from parseMiniSEED instead of calculating from the sample rate.

  • Trace class now contains slots for optional metadata "latitude", "longitude", "elevation", "depth", "azimuth", "dip", "SensitivityFrequency".

  • rotate2D() uses Trace class "azimuth" slot information to identify channel orientation before rotation instead of assuming lead and lag channel from trace input order.

version 1.0.8 -- fixes required by ISPAQ

  • Removed 'maps' and 'mapdata' from Suggested: packages.

  • Changed URL syntax for FDSN web services to use "format=..." instead of "output=...".

  • Fixed bug in getSNCL() so that it works when the "quality" argument is missing.

version 1.0.6 -- CRAN updates required

  • Removed "mode" argument form Trace.as.vector() signature.

version 1.0.4 -- name change to IRISSeismic

  • Name change required because 'seismic' was recently taken.

  • Using explicit references for 'utils' and 'stats' package functions as this is now required for CRAN.

version 1.0.3 -- cleanup for submission to CRAN

  • Updated libmseed to version 2.16

version 0.2.8.0 -- minor tweaks to 0.2.7

  • Updated links to IRIS web services in the documentation.

  • McNamaraBins() ignores bin #0 (~= DC)

  • McNamaraPSD() conversion to dB occurs after binning, not before

version 0.2.7.0 -- hilbert transform

  • New hilbertFFT() function.

  • New hilbert() trace method.

version 0.2.6.0 -- cross correlation

  • Added surfaceDistance() function.

  • Added rotate2D() function.

version 0.2.5.0 -- channel orientation

  • Jumping to version 0.2.5 to match project milestone names.

  • Added getSNCL() convenience wrapper for getDataselect() method.

  • Added getDistaz() method of IrisClient.

  • Added miniseed2Stream() and readMiniseedFile() functions.

  • Added getRotation() method of IrisClient.

version 0.2.3.0 -- cross spectrum

  • Moved McNamaraPSD() from trace method to spectral utility function.

  • Added spectral utility functions:

    • crossSpectrum()

    • McNamaraBins()

  • All get~ methods that return dataframes now guarantee a default ordering of rows.

version 0.2.2.0 -- PSD and friends

  • Add dependency on pracma package.

  • Use pracma::detrend() function in DDT.Trace().

  • Added "increment" parameter to STALTA.Trace().

  • Removed STALTA.Trace() algorithm "classic_LR2".

  • Fixed URL generation for getEvalresp() when location="".

  • Added NamaraPSD.Trace() method.

  • Added PSD/PDF utility functions:

    • noiseMatrix2PdfMatrix()

    • noiseModels()

    • psdDF2NoiseMatrix()

    • psdList()

    • psdList2NoiseMatrix()

    • psdStatistics()

    • psdPlot()

version 0.2.1.1 -- Bug fix release

  • Removed dependcy on signal, XML packages.

version 0.2.1.0 -- FDSN web services

  • Conversion to FDSN web services including the following new/rewritten methods: getNetwork, getStation, getChannel, getAvailability, getUnavailability

  • Updated version of getEvent to return a dataframe with columns named "latitude" and "longitude" for consistency with all other web services

  • Updated documentation and Rscripts to match the API changes in the conversion to FDSN web services.

  • Removal of all StationXML classes in favor of storing that information in slots of the Trace class.

  • Updates to Trace object slots @Sensor, @InstrumentSensitivity and @InputUnits to store information as character, numeric and character instead of StationXML classes.

  • The TraceHeader@quality slot now reflects the data quality returned in the miniSEED record rather than the quality that was requested by getDataselect. (Requests with quality=B for "Best" typically return quality=M.)

  • Improved STALTA.Trace() method removes experimental algorithms and now uses C++ code from package rollSeismic to calculate rolling means.

  • Updated IrisClient now uses web services from https://service.iris.edu for the following methods: getDataselect, getEvalresp, getEvent

version 0.2.0.0

  • Removed PSD methods of Stream and Trace. PSD algorithms are now part of the PSD metric.

  • Improved mergeTraces.Stream() method now accepts fillMethod="fillZero".

version 0.1.9.0

  • New rollSeismic package for fast rolling algorithms implemented in C++/Rcpp.

  • New num_spikes metric based on seismicRoll::roll_hampel outlier detection.

  • New correlation metric.

  • New scripts glitchMetrics.Rscript, correlationMetric.Rscript, pressureCorrelation.Rscript

  • New trace@stats@processing slot for data processing information.

  • New Stream methods: mergeTraces, plot

  • Improved getGaps.Stream() method properly handles initial and final gaps.

  • Improved MCR error messing.

version 0.1.8.0 -- IrisClient methods getEvent and getTraveltime, improved SNR metric

version 0.1.7.0 -- PSD

version 0.1.6.0 -- improved errors, miniSEED parser

version 0.1.5.0 -- code cleanup, improved errors, package vignette

version 0.1.4.0 -- STA/LTA, upDownTimes, basic plotting

version 0.1.3.0 -- SNR, memory profiling

version 0.1.2.0 -- ...

version 0.1.1.0 -- ...

References

ObsPy: https://obspy.org/

EarthScope web services: https://service.earthscope.org/

See Also

IrisClient-class, Trace-class, Stream-class,

Examples

Run this code
# Open a connection to EarthScope webservices
iris <- new("IrisClient", debug=TRUE)

starttime <- as.POSIXct("2010-02-27 06:45:00", tz="GMT")
endtime <- as.POSIXct("2010-02-27 07:45:00", tz="GMT")

# Get the seismic data
result <- try(st <- getDataselect(iris,"IU","ANMO","00","BHZ",starttime,endtime))
if (inherits(result,"try-error")) {
  message(geterrmessage())
} else {

# Extract the first trace, display the metadata and plot it
  tr1 <- st@traces[[1]]
  show(tr1@stats)
  plot(tr1)
}

Run the code above in your browser using DataLab