[R] Singular Spectrum Analysis Plotting Skipping in a loop, but individually it works

കുഞ്ഞായി kunjaai dileepkunjaai at gmail.com
Mon Sep 28 08:01:11 CEST 2015

```Dear all,

I am trying to plot  Spectrum of Singular Values using "Rssa" package.

I am trying to plot singular spectrum plot  inside a loop, it is not
plotting, but when I am trying to plot individually in terminal it works,
and I can save this as png files.

My code is given below:

*# --------------Calculating and plotting  Spectrum of Singular Values of
Control---------#*
library(ncdf)
season_list <-c('YEAR', 'DJF', 'JJA', 'SON', 'MAM')
zone_list <-c('ALLIN', 'WCIND', 'IPIND', 'ECIND', 'NEIND', 'NCIND',
'NWIND', 'WHIND')

for (sns in 1:length(season_list)){
for (rgn in 1:length(zone_list)){
var_noise<-paste(zone_list[rgn], "_",  season_list[sns], sep = "")
noise1<-get.var.ncdf(f_noise1, var_noise)
noise2<-get.var.ncdf(f_noise2, var_noise)
# Calculating Covariance Matrix from 'noise1' matrix
cv_noise_1 = noise1%*%t(noise1)
sigular_spectrum = ssa(cv_noise_1, svd.method = c("eigen"))

out_ssa_png =
paste("/home/dileep/WORK/Research_wind/CMIP_PiCOntrol_Expiriments/Homogenious_zone/homogenious_tempreture_zone/Homogenous_temp_Codes/Optimal_fingerprint_code/R/ECOF-package/SSA_noise_plots/SSA_",
zone_list[rgn], "_",  season_list[sns], "_SET_1.png", sep = "")

png(out_ssa_png, width= 6, height    = 7.0, units = "in", res= 1200,
pointsize = 3)
print ("Created PNG file")
titl = paste(zone_list[rgn],  season_list[sns], sep = " ")
plot(sigular_spectrum , main=titl)
dev.off()
print ("Done !")
}
}
*#####----------------------------------------------------------------------------------------###*