Yoshi Nishikawa's Blog

データと知識、その調和平均。

WaveletCompを使って気象データの周期性を解析する

WaveletComp

以前読んだ論文を参考に、WaveletCompを使ってみた。

気象データ

www.data.jma.go.jp

ここからA村のデータをとってくる。

A村のデータ

5年間の気温、降水量、風速のデータを取得。以下で実装。

library(WaveletComp)
w.temp <- analyze.wavelet(data, "temp",
                            loess.span = 0,
                            dt = 1, dj = 1/250,
                            make.pval = T, n.sim = 10)
wt.image(w.temp, color.key = "quantile", n.levels = 250,
              legend.params = list(lab = "wavelet power levels", mar = 4.7))
reconstruct(w.temp, plot.waves = F, lwd = c(1,2), legend.coords = "bottomleft")
wt.avg(w.temp)

#wind

w.wind <- analyze.wavelet(data, "wind",
                            loess.span = 0,
                            dt = 1, dj = 1/250,
                            make.pval = T, n.sim = 10)
wt.image(w.wind, color.key = "quantile", n.levels = 250,
              legend.params = list(lab = "wavelet power levels", mar = 4.7))
reconstruct(w.wind, plot.waves = F, lwd = c(1,2), legend.coords = "bottomleft")
wt.avg(w.wind)

#rain

w.rain <- analyze.wavelet(data, "rain",
                            loess.span = 0,
                            dt = 1, dj = 1/250,
                            make.pval = T, n.sim = 10)
wt.image(w.rain, color.key = "quantile", n.levels = 250,
              legend.params = list(lab = "wavelet power levels", mar = 4.7))
reconstruct(w.rain, plot.waves = F, lwd = c(1,2), legend.coords = "bottomleft")
wt.avg(w.rain)

f:id:yoshi_nishikawa:20161202232255p:plain

f:id:yoshi_nishikawa:20161202232534p:plain

f:id:yoshi_nishikawa:20161204103613p:plain

これは気温データ。当たり前ですが、めちゃくちゃ1年周期。