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