Learn R Programming

IRISMustangMetrics (version 1.0.1)

spectrumMetric2Xml: Convert a SpecturmMetric into XML for the BSS

Description

The spectrumMetric2Xml function converts a SpectrumMetric into an XML structure appropriate for submitting to the MUSTANG Backend Storage System (BSS).

Usage

spectrumMetric2Xml(metricList)

Arguments

metricList
a list of SpectrumMetric objects

Value

A character string with BSS formatted XML is returned.

Examples

Run this code
  ## Not run: 
# # Open a connection to IRIS DMC webservices
# iris <- new("IrisClient")
# 
# # NOTE:  The following trace has 1.728 million points.
# # NOTE:  Downloading and calculating PSD may take a while.
# starttime <- as.POSIXct("2010-02-27",tz="GMT")
# endtime <- as.POSIXct("2010-02-28",tz="GMT")
#   
# # Get the waveform
# st <- getDataselect(iris,"IU","ANMO","00","BHZ",starttime,endtime)
# 
# # Make sure we're working with a single snclq
# unique_ids <- uniqueIds(st)
# if (length(unique_ids) > 1) {
#   stop(paste("PSDMetric: Stream has",unique_ids,"unique identifiers"))
# }
# snclq <- unique_ids[1]
# 
# # Calculate and plot the Power Spectral Density
# psd <- PSD(st)
#   
# # Create a Spectrum metric
# # TODO:  total revamp of PSD calculations to match Manochehr's needs
# phases <- rep(0,length(psd$freq))
# m <- new("SpectrumMetric", snclq=snclq, starttime=starttime, endtime=endtime,
#           metricName="psd", freqs=psd$freq, amps=psd$spec, phases=psd$phase)
# 
# # Show the XML version of the metric
# bssXml <- spectrumMetric2Xml(m)
# cat(bssXml)
#   ## End(Not run)

Run the code above in your browser using DataLab