################################################################################### # Date: 2014-04-30 # Time series analysis # listening to Climate history ################################################################################### source("scripts/rmean.R") library(audio) # interpolated 10-year resolution # CO2 concentrations buffer<-read.csv("data/norm.daily.pna.index.b500101.current.ascii_20140226") x<-buffer$pnai n<-length(x) # approximate time scale dt<-(2014-1950+1)/n time<-seq(1,n,1)*dt+1950 plot(time,x,xlab="time [years]", ylab="PNA index", typ='l') #wait<-readline("press enter to listen to the time series") #rate<-22050 #play(x,rate=rate) #wait<-readline("press enter to continue") # how does weather variability sound? window<-c(5,11,31,51,181,365,(7*365+1)) nw<-length(window) xmean<-matrix(NA,n,nw) tmean<-matrix(NA,n,nw) xoff<-(-2) plot(time,x+xoff,xlab="time [years]", ylab="PNA index", typ='l', ylim=c(-5,20)) for (m in 1:nw) { xmean[,m]<-rmean(x,w=window[m]) tmean[,m]<-rmean(time,w=window[m]) lines(tmean[,m],xmean[,m]+2*m,col=m+1) }