IRISMustangMetrics-package: Utilities for calculating seismic metrics from IRIS DMC data

IRISMustangMetrics-packageR Documentation

Utilities for calculating seismic metrics from IRIS DMC data


This package provides S4 classes and functions for calculating metrics from seismological data available from the IRIS Data Management Center (DMC) ( This package is part of the MUSTANG project and is intended for DMC internal use only.


The IRISMustangMetrics package depends upon the IRISSeismic package which defines new S4 classes and methods for manipulating seismic data. Please see the "seismic-intro" vignette for introductory examples on using IRISSeismic.


version 2.4.5

  • (typo fix for email address and updated link in documentation)

  • (improve error handling code to meet CRAN requirements)

version 2.4.4

  • (additional error handling for sample_rate_resp)

version 2.4.3

  • (improved error handling for functions that call IRIS web services)

  • (additional error handling for sample_rate_resp)

version 2.4.2

  • minor modification to ISPAQUtils.R for sample_rate_resp, sample_rate_channel

version 2.4.1

  • fix for max_range where trace length not evenly divided by window length

  • max_range now rounds window*samplerate and increment*samplerate to integer values

  • corrects typo error in ISPAQUtils.R

version 2.4.0

  • adds new metrics sample_rate_resp, sample_rate_channel, max_range

version 2.3.0

  • modifies PSD metrics for edge case involving metadata and trace start times

  • adds noCorrection option to PSDMetric, if noCorrection=TRUE it only returns uncorrected PSDs and not corrected PSD or PSD-derived metrics; default noCorrection=FALSE

version 2.2.0

  • removes dead_channel_exp, metric has been retired

  • renames pdf_aggregator in ISPAQUtils.R to pdf

version 2.1.3

  • fixed bug related to getGeneralValueMetrics,getMustangMetrics error handling

  • added pdf_aggregator to ISPAQUtils.R, for multi-day pdf plotting within ISPAQ

version 2.1.2

  • version 2.1.1 unintentionally removed the pct_above_nhnm metric. This version restores it.

  • made sample rate sanity rate check consistent between correlationMetric and crossCorrelationMetric

version 2.1.1

  • fixed bug in PSDMetrics that affected dead_channel_gsn results

version 2.1.0

  • transfer_function requires sample rates to be within a factor of 10 to avoid decimation effects on amplitude

  • transfer_function uses 7 order Chebyshev filter in the decimate function, to correct 1% error occurring with default 8 order Chebyshev

  • fixed bug in transfer_function trace start and end time comparisons

  • transfer_function when determining if sample rate < 1, round to 5 digits first

  • getGeneralValueMetrics added metric_error, ts_channel_continuity, ts_channel_up_time, ts_gap_length, ts_gap_length_total, ts_max_gap, ts_max_gap_total, ts_num_gaps, ts_num_gaps_total, ts_percent_availability, ts_percent_availability metrics

  • aliased the getGeneralValueMetrics function to getMustangMetrics

  • dailyDCOffsetMetric now returns error when result is NaN or NA

version 2.0.9

  • removed dependency on pracma package

  • removed channel restrictions for pct_above_nhnm,pct_below_nlm

  • cross correlation sampling rates of < 1 will round to 2 digits

  • getGeneralValueMetrics better handles case of no targets found

  • improved error handling in spikesMetric.R

version 2.0.8

  • minor bug fix to ISPAQUtils.R, spikes=numSpikes

version 2.0.7

  • fixed bug in getGeneralValueMetrics that didn't return measurements if there was more than one for any day

  • crossCorrelationMetric filter now defaults to a butterworth 2 pole 0.1Hz (10 second) low pass filter

version 2.0.6

  • fixed bug related to NA -> NULL replacement in Class-Metric

version 2.0.5

  • fixed dplyr version dependencies

version 2.0.4

  • adds additional sanity check to getGeneralValueMetrics()

  • createBssUrl() adds "&nodata=404" to url

version 2.0.2

  • updates to ISPAQUtils.R

version 2.0.1

  • removed dependency on tidyr package

version 2.0.0 – GeneralValueMetrics

  • GeneralValueMetric class introduced, SingleValueMetric class deprecated. All metrics that previously returned SingleValueMetric now return GeneralValueMetric

  • getGeneralValueMetrics() function added. Retreives metrics measurements from BSS database

  • crossCorrelationMetric() does not return timing_drift. The metric proved unreliable

  • users can now supply instrument response information in the form of frequency, amplitude, phase to the function PSDMetric, in place of the getEvalresp webservice call

version 1.3.1 – PSDs

  • getPsdMetrics reworked

version 1.3.0 – latency

  • getLatencyValuesXML() removed from package.

  • documentation improvements.

  • additional error checking for getSingleValueMetrics().

version 1.2.7 – PSDs

  • PSDMetrics() metrics percent_above_nhnm and percent_below_nlnm limited to frequencies less than nyquist/1.5.

version 1.2.6 – PSDs

  • Depends on IRISSeismic (>= 1.3.0).

  • dead_channel_exp and dead_channel_lin metrics will only return values for station channel codes matching "BH|HH".

version 1.2.5 – ISPAQUtils

  • ISPAQUtils.R contains functions for use with the ISPAQ standalone metrics system.

version 1.2.4 – package version dependencies

  • Depends on IRISSeismic (>= 1.2.3). Imports seismicRoll (>=1.1.2).

version 1.2.2 – correlationMetric tweak

  • correlationMetric() allows trace sample lengths to differ by 2 samples without stopping.

version 1.2.1 – PSDs

  • Better fix to very low powers issue in PSDMetrics() dead_channel_gsn metric.

  • PSDMetrics() shifts PDF bin centers by 0.5 dB.

version 1.2.0 – PSDs

  • PSDMetric() returns corrected PSD and PDF dataframes in addition to uncorrected PSDs and PSD derived metrics.

  • Depends on R (>= 3.2.0) and IRISSeismic (>=1.1.7).

  • Imports tidyr, dplyr.

version 1.1.3 – bug fix, import version increased

  • Fixes typo in SNRMetric() function windowSecs argument default value.

  • Imports seismicRoll (>=1.1.1)

version 1.1.2 – modifications

  • Improves error handling messages.

  • dailyDCOffsetMetric() removes unused selectivity argument and adds argument controlling output type.

  • Fixes bug in dailyDCOffsetMetrics() related to outlier removal and vector length.

  • Fixes bug in PSDMetrics() dead_channel_gsn metric related to very low power values.

  • PSDMetrics() only returns metrics that generate numeric values.

version 1.1.1 – bug fix

  • crossCorrelationMetric() exits if either input trace is flatlined (all values equal).

version 1.1.0 – updates package dependencies

  • Depends on IRISSeismic (>= 1.1.0).

version 1.0.8 – new metric and bug fix

  • Improves error handling messages.

  • Adds new dead_channel_gsn metric to PSDMetric() function output.

  • Fixes bug in STALTAMetric() involving required trace length.

version 1.0.7 – bug fix

  • Fixes issue with spikesMetric() passing argument values to findOutliers.

version 1.0.6 – function argument changes

  • Changes spikesMetric() default argument values thresholdMin=10,selectivity=NA,fixedThreshold=TRUE.

  • transferFunctionMetric() now requires input of evalresp fap spectra, new arguments evalresp1 and evalresp2.

  • Additional sanity checks for transferFunctionMetric() and PSDMetric().

  • Depends on IRISSeismic (>= 1.0.10). Imports seismicRoll (>=1.1.0). Imports stats.

version 1.0.5 – new PSD metric

  • Changes URL syntax for MUSTANG web services to use "format=..." instead of "output=...".

  • Adds new sample_unique metric to PSDMetric() output.

version 1.0.3 – new functionality and bug fixes

  • Adds new metricList2DF() function.

  • Adds new dead_channel_lin metric to PSDMetric() output.

  • Fixes typo in Class-Metric.R value string format.

version 1.0.0 – First Public Release


Jonathan Callahan


IRIS DMC web services:


# Open a connection to IRIS DMC webservices
iris <- new("IrisClient", debug=TRUE)

# Get the seismic data
starttime <- as.POSIXct("2010-02-27 06:45:00",tz="GMT")
endtime <- as.POSIXct("2010-02-27 07:45:00",tz="GMT")
result <- try(st <- getDataselect(iris,"IU","ANMO","00","BHZ",starttime,endtime))
if (class(result) == "try-error" ) {
} else {
   # Apply a metric and show the results
   metricList <- basicStatsMetric(st)
   dummy <- lapply(metricList, show)

IRISMustangMetrics documentation built on April 28, 2022, 1:06 a.m.