├── favicon.ico ├── .gitignore ├── images ├── dice.gif ├── nino3.gif ├── chi_sqr.gif ├── morlet.gif ├── gaussian.gif ├── monte_time.gif ├── monte_wave.gif ├── nino3_wave.png ├── wl_eqn2.1.gif ├── wl_eqn2.2.gif ├── wl_eqn2.3.gif ├── wl_eqn3.1.gif ├── wl_eqn3.1b.gif ├── wl_eqn3.2.gif ├── wl_eqn3.3.gif ├── wl_eqn3.4.gif ├── monte_chisqr.gif ├── nino3_title.gif ├── wave_bias_faq.gif ├── morlet.pro └── wave_bias_faq.pro ├── interdecadal.pdf ├── bams_79_01_0061.pdf ├── bams_79_01_0061.ps.zip ├── webplot-do-not-use ├── util.o ├── nino3sst.gif ├── waveplot.cgi ├── waveplot.sav ├── make_waveplot ├── wavemake.idl ├── README.md ├── index.html ├── util.h ├── waveplot.html ├── waveploteqn.html ├── util.c ├── waveplot.c ├── data │ ├── soi.dat │ ├── mauna.dat │ ├── nino3sst.dat │ └── monsoon.dat └── waveopt.html ├── wave_idl ├── nino_sst_wavelet.png ├── soi.txt ├── sst_nino3.dat ├── mauna.txt ├── nino3sst.txt ├── monsoon.txt ├── wavetest.pro ├── wave_coherency.pro └── wave_signif.pro ├── wave_matlab ├── chisquare_solve.m ├── chisquare_inv.m ├── wave_bases.m ├── wavetest.m ├── sst_nino3.dat ├── wavelet.m └── wave_signif.m ├── LICENSE ├── wave_python ├── README_python.txt ├── sst_nino3.dat └── waveletAnalysis.py ├── applications.html ├── errata.html ├── history.html ├── README.md ├── analysis.html ├── index.html ├── references.html ├── bams_abstract.html ├── wave_fortran ├── wavetest_output.txt ├── sst_nino3.dat └── wavetest.f ├── software.html ├── montecarlo.html ├── wavelet1.html ├── wavelet3.html └── wavelet2.html /favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ct6502/wavelets/HEAD/favicon.ico -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | .DS_Store 3 | __pycache__ 4 | DO_NOT_DELETE_THIS_DIRECTORY 5 | -------------------------------------------------------------------------------- /images/dice.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ct6502/wavelets/HEAD/images/dice.gif -------------------------------------------------------------------------------- /images/nino3.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ct6502/wavelets/HEAD/images/nino3.gif -------------------------------------------------------------------------------- /interdecadal.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ct6502/wavelets/HEAD/interdecadal.pdf -------------------------------------------------------------------------------- /images/chi_sqr.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ct6502/wavelets/HEAD/images/chi_sqr.gif -------------------------------------------------------------------------------- /images/morlet.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ct6502/wavelets/HEAD/images/morlet.gif -------------------------------------------------------------------------------- /bams_79_01_0061.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ct6502/wavelets/HEAD/bams_79_01_0061.pdf -------------------------------------------------------------------------------- /images/gaussian.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ct6502/wavelets/HEAD/images/gaussian.gif -------------------------------------------------------------------------------- /images/monte_time.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ct6502/wavelets/HEAD/images/monte_time.gif -------------------------------------------------------------------------------- /images/monte_wave.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ct6502/wavelets/HEAD/images/monte_wave.gif -------------------------------------------------------------------------------- /images/nino3_wave.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ct6502/wavelets/HEAD/images/nino3_wave.png -------------------------------------------------------------------------------- /images/wl_eqn2.1.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ct6502/wavelets/HEAD/images/wl_eqn2.1.gif -------------------------------------------------------------------------------- /images/wl_eqn2.2.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ct6502/wavelets/HEAD/images/wl_eqn2.2.gif -------------------------------------------------------------------------------- /images/wl_eqn2.3.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ct6502/wavelets/HEAD/images/wl_eqn2.3.gif -------------------------------------------------------------------------------- /images/wl_eqn3.1.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ct6502/wavelets/HEAD/images/wl_eqn3.1.gif -------------------------------------------------------------------------------- /images/wl_eqn3.1b.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ct6502/wavelets/HEAD/images/wl_eqn3.1b.gif -------------------------------------------------------------------------------- /images/wl_eqn3.2.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ct6502/wavelets/HEAD/images/wl_eqn3.2.gif -------------------------------------------------------------------------------- /images/wl_eqn3.3.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ct6502/wavelets/HEAD/images/wl_eqn3.3.gif -------------------------------------------------------------------------------- /images/wl_eqn3.4.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ct6502/wavelets/HEAD/images/wl_eqn3.4.gif -------------------------------------------------------------------------------- /bams_79_01_0061.ps.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ct6502/wavelets/HEAD/bams_79_01_0061.ps.zip -------------------------------------------------------------------------------- /images/monte_chisqr.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ct6502/wavelets/HEAD/images/monte_chisqr.gif -------------------------------------------------------------------------------- /images/nino3_title.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ct6502/wavelets/HEAD/images/nino3_title.gif -------------------------------------------------------------------------------- /images/wave_bias_faq.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ct6502/wavelets/HEAD/images/wave_bias_faq.gif -------------------------------------------------------------------------------- /webplot-do-not-use/util.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ct6502/wavelets/HEAD/webplot-do-not-use/util.o -------------------------------------------------------------------------------- /wave_idl/nino_sst_wavelet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ct6502/wavelets/HEAD/wave_idl/nino_sst_wavelet.png -------------------------------------------------------------------------------- /webplot-do-not-use/nino3sst.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ct6502/wavelets/HEAD/webplot-do-not-use/nino3sst.gif -------------------------------------------------------------------------------- /webplot-do-not-use/waveplot.cgi: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ct6502/wavelets/HEAD/webplot-do-not-use/waveplot.cgi -------------------------------------------------------------------------------- /webplot-do-not-use/waveplot.sav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ct6502/wavelets/HEAD/webplot-do-not-use/waveplot.sav -------------------------------------------------------------------------------- /webplot-do-not-use/make_waveplot: -------------------------------------------------------------------------------- 1 | #!/bin/sh -f 2 | gcc -c util.c 3 | gcc -c waveplot.c 4 | gcc waveplot.c util.o -o waveplot.cgi 5 | -------------------------------------------------------------------------------- /webplot-do-not-use/wavemake.idl: -------------------------------------------------------------------------------- 1 | .compile waveplot 2 | RESOLVE_ALL 3 | SAVE,FILENAME='waveplot.sav',/ROUTINES,/VERBOSE 4 | EXIT 5 | -------------------------------------------------------------------------------- /webplot-do-not-use/README.md: -------------------------------------------------------------------------------- 1 | # Torrence & Compo Wavelet Analysis Software 2 | 3 | *Note*: This folder contains the old Interactive Wavelet Plot software. 4 | We had to remove the old Interactive Wavelet site for security reasons. 5 | It relied on IDL's ION software package which is now defunct. 6 | This will not produce wavelet plots. Do not use. 7 | -------------------------------------------------------------------------------- /webplot-do-not-use/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 10 |

Interactive Wavelets in ION 11 |

12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /webplot-do-not-use/util.h: -------------------------------------------------------------------------------- 1 | 2 | void getword(char *word, char *line, char stop); 3 | char *makeword(char *line, char stop); 4 | char *fmakeword(FILE *f, char stop, int *cl); 5 | char x2c(char *what); 6 | void unescape_url(char *url); 7 | void plustospace(char *str); 8 | int rind(char *s, char c); 9 | int getline(char *s, int n, FILE *f); 10 | void send_fd(FILE *f, FILE *fd); 11 | int ind(char *s, char c); 12 | void escape_shell_cmd(char *cmd); 13 | -------------------------------------------------------------------------------- /wave_matlab/chisquare_solve.m: -------------------------------------------------------------------------------- 1 | function PDIFF = chisquare_solve(XGUESS,P,V); 2 | %CHISQUARE_SOLVE Internal function used by CHISQUARE_INV 3 | % 4 | % PDIFF=chisquare_solve(XGUESS,P,V) Given XGUESS, a percentile P, 5 | % and degrees-of-freedom V, return the difference between 6 | % calculated percentile and P. 7 | 8 | % Uses GAMMAINC 9 | % 10 | % Written January 1998 by C. Torrence 11 | 12 | % extra factor of V is necessary because X is Normalized 13 | PGUESS = gammainc(V*XGUESS/2,V/2); % incomplete Gamma function 14 | 15 | PDIFF = abs(PGUESS - P); % error in calculated P 16 | 17 | TOL = 1E-4; 18 | if (PGUESS >= 1-TOL) % if P is very close to 1 (i.e. a bad guess) 19 | PDIFF = XGUESS; % then just assign some big number like XGUESS 20 | end 21 | 22 | return 23 | 24 | % end of code 25 | 26 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 1998-2018 Christopher Torrence and Gilbert P. Compo 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /images/morlet.pro: -------------------------------------------------------------------------------- 1 | 2 | 3 | FUNCTION psi,k,t,WAVE_PART=wave_part,AMP_PART=amp_part 4 | 5 | wave_part = COMPLEX(COS(k*t),SIN(k*t)) ; exp(ikt) = cos(kt) + i*sin(kt) 6 | amp_part = EXP( -ABS(t)^2/2.) ; exp(-|t|^2/2) 7 | RETURN,wave_part*amp_part ; morlet 8 | 9 | END 10 | 11 | 12 | k0 = 6.0 13 | time = FINDGEN(401)/20. - 10. 14 | 15 | a = 2 16 | b = 0 17 | 18 | morlet = (1./SQRT(a))*PSI(k0,(time - b)/a,WAVE=wave,AMP=amp) 19 | 20 | WINDOW,0,COLOR=256,XSIZE=512,YSIZE=128 21 | LOADCT,42 22 | !P.BACKGROUND = 255 23 | !P.COLOR = 0 24 | !P.FONT = -1 25 | !P.CHARSIZE = 1.5 26 | !X.STYLE = 5 27 | !Y.STYLE = 5 28 | !P.MULTI = [0,2,1] 29 | !X.MARGIN = [2,2] 30 | !Y.MARGIN = [0,0] 31 | !Y.RANGE = [MIN(FLOAT(wave))*0.95, MAX(amp)*1.05] 32 | dy = (!Y.CRANGE(1) - !Y.CRANGE(0))/5. 33 | 34 | PLOT,time,FLOAT(morlet), $ 35 | THICK=2,COLOR=50 36 | XYOUTS,!X.CRANGE(0),!Y.CRANGE(1) - dy,'(a)',CHARSIZE=1.2,ALIGN=0.5 37 | 38 | PLOT,time,FLOAT(wave)/SQRT(2), $ 39 | COLOR=128,THICK=2 40 | OPLOT,time,amp,COLOR=208,THICK=2 41 | OPLOT,time,FLOAT(morlet),THICK=2,LINES=2,COLOR=50 42 | XYOUTS,!X.CRANGE(0),!Y.CRANGE(1) - dy,'(b)',CHARSIZE=1.2,ALIGN=0.5 43 | 44 | 45 | 46 | END 47 | -------------------------------------------------------------------------------- /wave_python/README_python.txt: -------------------------------------------------------------------------------- 1 | ------- Forwarded Message -------- 2 | Subject: 3 | Wavelet Python Software 4 | Date: Wed, 24 Dec 2014 00:54:00 +0300 5 | From: Evgeniya Predybaylo gmail.com> 6 | To: chrisrsinc.com, compocolorado.edu 7 | CC: Georgiy Stenchikov kaust.edu.sa> 8 | 9 | Dear Dr. Torrence and Dr. Compo, 10 | 11 | my name is Evgeniya and I am a PhD Student under the supevision of Prof. Georgiy Stenchikov at King Abdullah University of Science and Technology (KAUST). 12 | 13 | I am writing to say a great thank you for the wavelet paper and software you have provided on the website (http://paos.colorado.edu/research/wavelets/). I have found them very useful for my research! However, as I am mostly using Python, I have rewritten the code for Python environment. I have attached two Python files that contain all needed functions and the example, exactly as you have it for the other environments. I hope they can be somehow useful. Please let me know if you encounter any troubles running these codes. 14 | 15 | Thank you for your time and attention! 16 | 17 | Sincerely, 18 | 19 | Evgeniya Predybaylo 20 | 21 | -- 22 | PhD Student, Earth Sciences and Engineering Program 23 | Chair of Graduate Student Council 24 | King Abdullah University of Science and Technology 25 | -------------------------------------------------------------------------------- /applications.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Wave:Applications 5 | 6 | 7 | 8 | 9 |

Wavelet Applications

10 | 11 |  

12 | 13 | 14 |

    15 |
  • Image processing [Mallat (1988)] 16 |

    17 |

  • Irregularly-spaced data (stellar activity) 18 | [Frick et al. (1997)] 19 |

    20 | 21 |

  • 2D turbulence prediction; wavelet packet compression [Farge et al. (1992)] 22 |

    23 | 24 |

  • Coherent structure detection [Farge (1992), Gamage (1990)] 25 |

    26 | 27 |

  • Wave breaking & front detection [Liu (1994), Gamage & Blumen (1993)] 28 |

    29 | 30 |

  • Wavelet bases for partial differential equations 31 | [Farge et al. (1992), Bacry et al. (1993)] 32 |

    33 | 34 |

  • Paleoclimate [Bolton et al. (1995), Yiou et al. (1995)] 35 |
36 | 37 |  

38 |

Summary

39 |  

40 | 41 |

42 |
¤
Wavelet analysis is a useful addition to methods of 43 | geophysical data analysis.
44 |
¤
Most helpful in situations of locally-coherent signals, 45 | or non-stationary time series.
46 |
¤
More research is needed on the perils & pitfalls, 47 | choice of wavelet bases, and on statistical significance. 48 |
49 | 50 |

54 | 55 | 56 | 57 | -------------------------------------------------------------------------------- /images/wave_bias_faq.pro: -------------------------------------------------------------------------------- 1 | 2 | dt = 1 3 | n = 128 4 | t = FINDGEN(n)*dt 5 | t1 = 8 6 | t2 = 32 7 | x = SIN(2*!PI*t/t1) + SIN(2*!PI*t/t2) 8 | ; x = RANDOMN(s,n) 9 | 10 | f = SPECTRUM(x,dt,PERIOD=fperiod) 11 | w = WAVELET(x,dt,PERIOD=wperiod,DJ=0.125) 12 | gws = TOTAL(ABS(w)^2,1)/n^2 13 | 14 | WINDOW,XSIZE=240,YSIZE=350 15 | LOADCT,39 16 | !P.COLOR = 192 17 | !P.MULTI = [0,1,3] 18 | !X.STYLE = 9 19 | !Y.STYLE = 9 20 | !X.MARGIN = [8,2] 21 | !Y.MARGIN = [4,3] 22 | !Y.MINOR = 1 23 | !X.TICKLEN = -0.04 24 | !P.CHARSIZE = 1.75 25 | xticks = FIX(ALOG(n)/ALOG(2))-1 26 | xtickv = 2L^(LINDGEN(xticks+1)+1) 27 | xrange = [MAX(xtickv),MIN(xtickv)] 28 | 29 | PLOT,t,x, $ 30 | XRANGE=[0,n], $ 31 | XMINOR=1,XTICKS=xticks-2, $ 32 | XTITLE='Time (days)', $ 33 | TITLE='Time series with two sine waves' 34 | OPLOT,t,x,COLOR=254 35 | 36 | PLOT,fperiod,f,/XTYPE, $ 37 | XRANGE=xrange,YRANGE=[0,0.5],YTICKS=2, $ 38 | XTICKS=xticks,XTICKV=xtickv, $ 39 | XTITLE='Period (days)',YTITLE='Power', $ 40 | TITLE='Fourier power spectrum' 41 | OPLOT,fperiod,f,PSYM=-4,/NOCLIP,COLOR=254,SYMSIZE=0.75 42 | 43 | PLOT,wperiod,gws,/XTYPE, $ 44 | XRANGE=xrange,YRANGE=[0,0.25],YTICKS=2, $ 45 | XTICKS=xticks,XTICKV=xtickv, $ 46 | XTITLE='Period (days)',YTITLE='Power', $ 47 | TITLE='Global wavelet spectrum' 48 | OPLOT,wperiod,gws,PSYM=-4,/NOCLIP,COLOR=254,SYMSIZE=0.75 49 | 50 | TVLCT,r,g,b,/GET 51 | WRITE_GIF,'wave_bias_faq.gif',TVRD(),r,g,b 52 | END 53 | -------------------------------------------------------------------------------- /wave_matlab/chisquare_inv.m: -------------------------------------------------------------------------------- 1 | function X = chisquare_inv(P,V); 2 | %CHISQUARE_INV Inverse of chi-square cumulative distribution function (cdf). 3 | % 4 | % X = chisquare_inv(P,V) returns the inverse of chi-square cdf with V 5 | % degrees of freedom at fraction P. 6 | % This means that P*100 percent of the distribution lies between 0 and X. 7 | % 8 | % To check, the answer should satisfy: P==gammainc(X/2,V/2) 9 | 10 | % Uses FMIN and CHISQUARE_SOLVE 11 | % 12 | % Written January 1998 by C. Torrence 13 | 14 | if (nargin < 2), error('Must input both P and V');, end 15 | if ((1-P) < 1E-4), error('P must be < 0.9999');, end 16 | 17 | if ((P==0.95) & (V==2)) % this is a no-brainer 18 | X = 5.9915; 19 | return 20 | end 21 | 22 | MINN = 0.01; % hopefully this is small enough 23 | MAXX = 1; % actually starts at 10 (see while loop below) 24 | X = 1; 25 | TOLERANCE = 1E-4; % this should be accurate enough 26 | vers = version; 27 | vers = str2num(vers(1)); 28 | 29 | while ((X+TOLERANCE) >= MAXX) % should only need to loop thru once 30 | MAXX = MAXX*10.; 31 | % this calculates value for X, NORMALIZED by V 32 | % Note: We need two different versions, depending upon the version of Matlab. 33 | if (vers >= 6) 34 | X = fminbnd('chisquare_solve',MINN,MAXX,optimset('TolX',TOLERANCE),P,V); 35 | else 36 | X = fmin('chisquare_solve',MINN,MAXX,[0,TOLERANCE],P,V); 37 | end 38 | MINN = MAXX; 39 | end 40 | 41 | X = X*V; % put back in the goofy V factor 42 | 43 | return 44 | 45 | % end of code 46 | 47 | -------------------------------------------------------------------------------- /errata.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Torrence and Compo (1998): Errata 5 | 6 | 7 | 8 | 9 | Bulletin of the American Meteorological Society: 10 | Vol. 79, No. 1, pp. 61–78. 11 |

12 | 13 |

A Practical Guide to Wavelet Analysis

14 | 15 | Christopher Torrence and Gilbert P. Compo
Program in 16 | Atmospheric and Oceanic Sciences, University of Colorado, 17 | Boulder, Colorado
18 |

19 | Errata 20 |

21 | 22 | 23 |
24 |
    25 |
  • Figure 3: N/(2 sigma2) should just be N/sigma2.

    26 |

  • Equation (17), left-hand side: Factor of 1/2 27 | should be removed.

    28 |

  • Table 1, DOG, Psi-hat (third column, bottom row): 29 | Should be a minus sign in front of the equation.

    30 |

  • Sec 3f, last paragraph: Plugging N=506, dt=1/4yr, s0=2dt, and dj=0.125 31 | into Eqn (10) actually gives J=64, not J=56 as stated in the text.
    32 | However, in Figure 1b, the scales are only plotted 33 | out to J=56 since the power is so low at larger scales. 34 |
35 |
36 |

37 | 38 | 39 | Additional information 40 |

41 | Table 3: Cross-wavelet significance levels, from Eqn.(30)-(31). 42 | (DOF = degrees of freedom) 43 | 44 |
Significance levelReal wavelet (1 DOF)Complex wavelet (2 DOF) 45 |
0.101.5953.214 46 |
0.052.1823.999 47 |
0.013.6045.767 48 |
49 |

50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /history.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Wave:History 5 | 6 | 7 | 8 |

9 | Sketchy History of Wavelet Analysis 10 |

11 | 12 | 13 |
1800'sJoseph Fourier 14 | Fourier transform & series; heat diffusion 15 |
16 |
1909Alfred Haar 17 | rectangular Haar basis functions 18 |
19 |
1946Dennis Gabor 20 | time-frequency Gabor wavelets; communication theory 21 |
22 |
1947 23 | Jean Ville & Hermann Wigner 24 | Wigner-Ville transform; quantum mechanics 25 |
26 |
1965Cooley & Tukey 27 | Fast Fourier Transform (FFT) 28 |
29 |
1984Grossman & Morlet 30 | synthesis of theory; geophysics & earthquakes 31 |
32 |
1985Yves Meyer 33 | family of wavelets for complex phenomena 34 |
35 |
1988-89 36 | Stephane Mallat & Ingrid Daubechies 37 | discrete wavelet transform 38 |
39 |  

40 | 41 | Adapted from ``Signal processing: A historical perspective''
42 | (http://www.monash.edu.au/cmcm/wavelet/whistory.htm) 43 |
44 | 45 |


46 | 48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Torrence & Compo Wavelet Analysis Software 2 | 3 | http://atoc.colorado.edu/research/wavelets/ 4 | 5 | # Papers 6 | 7 | ### [Torrence & Compo 1998](bams_79_01_0061.pdf) 8 | A practical step-by-step guide to wavelet analysis is given, with examples taken from time series of the El Niño-Southern Oscillation (ENSO). The guide includes a comparison to the windowed Fourier transform, the choice of an appropriate wavelet basis function, edge effects due to finite-length time series, and the relationship between wavelet scale and Fourier frequency. New statistical significance tests for wavelet power spectra are developed by deriving theoretical wavelet spectra for white and red noise processes and using these to establish significance levels and confidence intervals. Extensions to wavelet analysis such as filtering, the power Hovmöller, cross-wavelet spectra, and coherence are described. 9 | 10 | ### [Torrence & Webster 1999](interdecadal.pdf) 11 | The method of wavelet coherency is applied to the ENSO and monsoon indexes. 12 | 13 | # IDL, Matlab, Fortran Code 14 | 15 | Please acknowledge the use of this software in any publications: 16 | ``` 17 | "Wavelet software was provided by C. Torrence and G. Compo, and is available at URL: http://atoc.colorado.edu/research/wavelets/". 18 | ``` 19 | Please send a copy of such publications to: 20 | ``` 21 | chris.torrence[AT]l3harris[DOT]com 22 | compo[AT]colorado[DOT]edu 23 | ``` 24 | 25 | # Python Code 26 | Wavelet analysis code translated to Python and provided here courtesy of: 27 | ``` 28 | Evgeniya Predybaylo 29 | predybaylo[DOT]evgenia[AT]gmail[DOT]com 30 | Earth Sciences and Engineering Program 31 | King Abdullah University of Science and Technology 32 | Kingdom of Saudi Arabia 33 | ``` 34 | Please include the following acknowledgement in any publication: 35 | ``` 36 | "Python wavelet software provided by Evgeniya Predybaylo based on Torrence and Compo (1998) and is available at URL: "http://atoc.colorado.edu/research/wavelets/" 37 | ``` 38 | 39 | # Datasets 40 | * NINO3 sea surface temperature 1871-1996 (in °C; from the UKMO GISST2.3) 41 | - Seasonally-averaged, minus the annual cycle 42 | - Monthly-averaged, raw data and anomalies 43 | * Southern Oscillation Index 44 | * All-India Monsoon Rainfall 45 | * Mauna Loa CO2 46 | * Wolf Sunspot Number 47 | -------------------------------------------------------------------------------- /analysis.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Wave:Data Analysis 5 | 6 | 7 | 8 | 9 |

Geophysical Data Analysis

10 |

11 |

12 | 13 |
    14 | ¤ To reduce a set of time series to a few parameters that 15 | capture a large variance percentage, and,
    16 | ¤ To use these dominant parameters to explain the 17 | behavior of the time series. 18 |
19 |
20 |
21 | 22 | 23 | 24 | 45 |
Method 25 | Single Time Series 26 | Multi-series 27 | 28 |
29 |
30 |      |
31 |      |
32 |      |
33 | Increasing
34 | Complexity
35 | (more
36 | variables)
37 |      |
38 |      |
39 |      |
40 |      |
41 |     \|/
42 |      V
43 | 
44 |
46 | Statistics 47 |
  • mean, variance, skew, kurtosis 48 |
  • curve-fitting 49 |
  • autocorrelation 50 |
51 |
  • multiple linear regression 52 |
  • covariance, cross-correlation 53 |
54 | 55 |
56 | Spectrum 57 |
  • Fourier power spectrum (FFT) 58 |
  • Maximum Entropy Method (MEM) 59 |
  • Multi-Taper Method (MTM) 60 |
61 |
  • Cross-spectrum, phase spectrum 62 |
  • Coherency 63 |
64 | 65 |
66 | Wavelet Transform 67 |
  • Wavelet power spectrum 68 |
  • Sliding FFT; evolutionary spectra 69 |
70 |
  • Cross-wavelet spectrum, phase 71 |
  • Wavelet coherency 72 |
73 | 74 |
75 | Orthogonal Modes 76 |
  • Singular Spectrum Analysis (SSA) 77 |
78 |
  • Empirical Orthogonal Functions (EOF) 79 | & Singular Value Decomposition (SVD) 80 |
81 |
82 | 83 | 88 | 89 | 90 | 91 | -------------------------------------------------------------------------------- /webplot-do-not-use/waveplot.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Wave:Interactive Wavelets:Choose data 5 | 6 | 7 | 8 |
9 | 10 | 12 |
13 | 14 | 15 | 32 | 33 |
16 | 17 |
18 | Interactive Wavelets
19 | Please send comments or suggestions to 20 | C.Torrence: torrence@NOSPAMmonsoon.colorado.edu 21 | 22 |
23 | 24 |       25 |   or   26 | 27 |       28 | 29 |
30 | 31 |
34 | 35 | Choose a dataset and press "Submit":

36 | 43 | 44 |

45 |

46 | 47 |
48 | 49 |
50 | 51 | Or enter new data: 52 | 53 | 54 |
Long name: 55 | 56 | 57 |
58 |
Data source: 59 | 60 | 61 |
62 |
Short name: 63 | 64 | 65 |
66 |
Data units: 67 | 68 | 69 |
70 |
Initial time t0 = 71 | 72 | 73 |
74 |
time between data values dt = 75 | 76 | 77 |
78 |
Time units: 79 | 80 | 81 |
Data Values: 82 |

83 | Data values should be separated by spaces
or returns, 84 | maximum of 2048 values. 85 |

86 | If this field is left empty, then the default dataset (to the left) 87 | will be used. 88 |

89 |
90 | 91 | 92 |
93 | 94 |
95 |
96 | 97 | 98 | 99 | -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Wavelet analysis; significance levels; confidence intervals; 5 | 6 | 7 | 8 | 9 | 10 | 11 | El Nino Wavelet 12 | 13 | 14 | 18 | 24 |
15 | A Practical Guide to Wavelet Analysis
16 | With significance and confidence testing 17 |
19 | Christopher Torrence
20 | National Snow and Ice Data Center
21 | CIRES, CU Boulder
22 | chris.torrence[AT]colorado[DOT]edu 23 |
        25 | Gilbert P. Compo
26 | CIRES, University of Colorado & Physical Sciences Division, NOAA ESRL
27 | Boulder, Colorado
28 | compo[AT]colorado[DOT]edu 29 |
30 | 31 |
32 |
33 | 34 | 35 |
36 | 37 | Wavelet Analysis & Monte Carlo 38 |

39 | References & Web Sites 40 |

41 | Interactive Wavelet Plot (no longer available) 42 |

43 | Software for Fortran, IDL, Matlab, and Python 44 |

45 | Frequently Asked Questions (FAQ) 46 |

47 | Article: "A Practical Guide to Wavelet Analysis", 48 | C. Torrence and G. P. Compo, 1998*.
49 |

50 | Abstract & List of Topics
51 | Additional information & Errata 52 |
53 |

54 | Wavelet Coherency and Phase 55 | 56 | 57 |

58 | 59 |  

60 |


61 |
62 | This site is hosted by the Department of Atmospheric 63 | and Oceanic Sciences at the University of Colorado Boulder
64 |
65 | Featured in:
66 | 72 |
73 | 77 | 78 | * Permission to place a copy of this work on this 79 | server has been provided by the 80 | American Meteorological Society. 81 | The AMS does not guarantee that the copy provided 82 | here is an accurate copy of the published work. 83 | 84 | 85 | -------------------------------------------------------------------------------- /wave_matlab/wave_bases.m: -------------------------------------------------------------------------------- 1 | %WAVE_BASES 1D Wavelet functions Morlet, Paul, or DOG 2 | % 3 | % [DAUGHTER,FOURIER_FACTOR,COI,DOFMIN] = ... 4 | % wave_bases(MOTHER,K,SCALE,PARAM); 5 | % 6 | % Computes the wavelet function as a function of Fourier frequency, 7 | % used for the wavelet transform in Fourier space. 8 | % (This program is called automatically by WAVELET) 9 | % 10 | % INPUTS: 11 | % 12 | % MOTHER = a string, equal to 'MORLET' or 'PAUL' or 'DOG' 13 | % K = a vector, the Fourier frequencies at which to calculate the wavelet 14 | % SCALE = a number, the wavelet scale 15 | % PARAM = the nondimensional parameter for the wavelet function 16 | % 17 | % OUTPUTS: 18 | % 19 | % DAUGHTER = a vector, the wavelet function 20 | % FOURIER_FACTOR = the ratio of Fourier period to scale 21 | % COI = a number, the cone-of-influence size at the scale 22 | % DOFMIN = a number, degrees of freedom for each point in the wavelet power 23 | % (either 2 for Morlet and Paul, or 1 for the DOG) 24 | % 25 | %---------------------------------------------------------------------------- 26 | % Copyright (C) 1995-1998, Christopher Torrence and Gilbert P. Compo 27 | % University of Colorado, Program in Atmospheric and Oceanic Sciences. 28 | % This software may be used, copied, or redistributed as long as it is not 29 | % sold and this copyright notice is reproduced on each copy made. This 30 | % routine is provided as is without any express or implied warranties 31 | % whatsoever. 32 | %---------------------------------------------------------------------------- 33 | function [daughter,fourier_factor,coi,dofmin] = ... 34 | wave_bases(mother,k,scale,param); 35 | 36 | mother = upper(mother); 37 | n = length(k); 38 | 39 | if (strcmp(mother,'MORLET')) %----------------------------------- Morlet 40 | if (param == -1), param = 6.;, end 41 | k0 = param; 42 | expnt = -(scale.*k - k0).^2/2.*(k > 0.); 43 | norm = sqrt(scale*k(2))*(pi^(-0.25))*sqrt(n); % total energy=N [Eqn(7)] 44 | daughter = norm*exp(expnt); 45 | daughter = daughter.*(k > 0.); % Heaviside step function 46 | fourier_factor = (4*pi)/(k0 + sqrt(2 + k0^2)); % Scale-->Fourier [Sec.3h] 47 | coi = fourier_factor/sqrt(2); % Cone-of-influence [Sec.3g] 48 | dofmin = 2; % Degrees of freedom 49 | elseif (strcmp(mother,'PAUL')) %-------------------------------- Paul 50 | if (param == -1), param = 4.;, end 51 | m = param; 52 | expnt = -(scale.*k).*(k > 0.); 53 | norm = sqrt(scale*k(2))*(2^m/sqrt(m*prod(2:(2*m-1))))*sqrt(n); 54 | daughter = norm*((scale.*k).^m).*exp(expnt); 55 | daughter = daughter.*(k > 0.); % Heaviside step function 56 | fourier_factor = 4*pi/(2*m+1); 57 | coi = fourier_factor*sqrt(2); 58 | dofmin = 2; 59 | elseif (strcmp(mother,'DOG')) %-------------------------------- DOG 60 | if (param == -1), param = 2.;, end 61 | m = param; 62 | expnt = -(scale.*k).^2 ./ 2.0; 63 | norm = sqrt(scale*k(2)/gamma(m+0.5))*sqrt(n); 64 | daughter = -norm*(i^m)*((scale.*k).^m).*exp(expnt); 65 | fourier_factor = 2*pi*sqrt(2./(2*m+1)); 66 | coi = fourier_factor/sqrt(2); 67 | dofmin = 1; 68 | else 69 | error('Mother must be one of MORLET,PAUL,DOG') 70 | end 71 | 72 | return 73 | 74 | % end of code 75 | 76 | -------------------------------------------------------------------------------- /webplot-do-not-use/waveploteqn.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Wave:Interactive Wavelets:Choose data 5 | 6 | 7 | 8 |
9 | 10 | 12 |
13 | 14 | 15 | 32 | 33 |
16 | 17 |
18 | Interactive Wavelets
19 | Please send comments or suggestions to 20 | C.Torrence: torrence@NOSPAMmonsoon.colorado.edu 21 | 22 |
23 | 24 |       25 |   or   26 | 27 |       28 | 29 |
30 | 31 |
34 | 35 | Choose a dataset and press "Submit":

36 | 43 | 44 |

45 |

46 | 47 |
48 | 49 |
50 | 51 | Or enter new data: 52 | 53 | 54 |
Long name: 55 | 56 | 57 |
58 |
Data source: 59 | 60 | 61 |
62 |
Short name: 63 | 64 | 65 |
66 |
Data units: 67 | 68 | 69 |
70 |
Initial time t0 = 71 | 72 | 73 |
74 |
time between data values dt = 75 | 76 | 77 |
78 |
Time units: 79 | 80 | 81 |
82 |  
83 | Enter either an equation or data values:

84 |

Equation data(t,t0,dt,pi) = 85 |

86 |

87 | 88 | 89 |
Data Values: 90 |

91 | Data values should be separated
by spaces or returns,
92 | maximum of 2048 values. 93 |

94 |
95 | 96 | 97 |
98 | 99 |
100 |
101 | 102 | 103 | 104 | -------------------------------------------------------------------------------- /references.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Wave:Wavelet: References 5 | 6 | 7 | 8 | 9 | 10 |
11 |
12 |

Wavelet Analysis

13 |

References:

14 | 15 | Chatfield, C., 1989: The Analysis of Time Series. 16 | Chapman & Hall, London.

17 | 18 | Farge, M., 1992: Wavelet transforms and their 19 | applications to turbulence. 20 | Ann. Rev. Fluid Mech., 24, 395-457.

21 | 22 | Gilman, D.L., F.J. Fuglister, and J.M. Mitchell, Jr., 23 | 1963: On the power spectrum of "red noise". 24 | J. Atmos. Sci., 20, 182-184.

25 | 26 | Jenkins, G.M. and D.G. Watts, 1968: Spectral 27 | Analysis and its Applications. 28 | Holden-Day, San Francisco.

29 | 30 | Lau, K.-M. and H.-Y. Weng, 1995: Climate signal 31 | detection using wavelet transform: How to make a time series sing. 32 | Bull. Am. Meteor. Soc, 76, 2391-2402.

33 | 34 | Meyers, S.D., B.G. Kelly, and J.J. O'Brien, 1993: An 35 | introduction to wavelet analysis in oceanography and meteorology: With 36 | application to the dispersion of Yanai waves. 37 | Mon. Wea. Rev., 121, 2858-2866.

38 | 39 | Spiegel, M.R., 1975: Schaum's Outline of Theory and 40 | Problems of Probability and Statistics. McGraw-Hill, New York.

41 | 42 | Torrence, C. and G.P. Compo, 1998: A Practical Guide to Wavelet Analysis. 43 | Bull. Amer. Meteor. Soc., 79, 61-78.

44 | 45 | Weng, H. and K.-M. Lau, 1994: Wavelets, period 46 | doubling, and time-frequency localization with application to organization of 47 | convection over the tropical western Pacific. 48 | J. Atmos. Sci., 51, 2523-2541.

49 | 50 |

Outside Web Sites:

51 |

52 |
53 | Amara's Wavelet Page 54 |
55 | Wavelet overview, with numerous links to wavelet web sites, software, 56 | bibliographies, and digests. 57 |

58 |

Brani's Wavelets 59 |
A collection of papers, links, and conferences on wavelets. 60 |

61 |

Jacques Lewelle's Wavelet Tutorial 62 |
``Our purpose is to make the wavelet techniques approachable without unnecessary mathematical sophistication.'' 63 |

64 |

NCAR Command Language (NCL) wavelet analysis examples 65 |
Page of examples for the NCL implementation of the Torrence and Compo (1998) algorithm. 66 |

67 |

Cross Wavelet and Wavelet Coherence 68 |
``On these web pages [Grinsted, Moore, and Jevrejeva] provide downloads for a MatLab package for performing Crosswavelet and Wavelet coherence analysis.'' 69 |

70 |

Wavelet Resources 71 |
List of wavelet resources and web sites. 72 |
73 | [back to Wavelet Home Page] 74 |
75 | 76 | 77 | 78 | -------------------------------------------------------------------------------- /webplot-do-not-use/util.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include "util.h" 5 | 6 | #define LF 10 7 | #define CR 13 8 | 9 | void getword(char *word, char *line, char stop) { 10 | int x = 0,y; 11 | 12 | for(x=0;((line[x]) && (line[x] != stop));x++) 13 | word[x] = line[x]; 14 | 15 | word[x] = '\0'; 16 | if(line[x]) ++x; 17 | y=0; 18 | 19 | while(line[y++] = line[x++]); 20 | } 21 | 22 | char *makeword(char *line, char stop) { 23 | int x = 0,y; 24 | char *word = (char *) malloc(sizeof(char) * (strlen(line) + 1)); 25 | 26 | for(x=0;((line[x]) && (line[x] != stop));x++) 27 | word[x] = line[x]; 28 | 29 | word[x] = '\0'; 30 | if(line[x]) ++x; 31 | y=0; 32 | 33 | while(line[y++] = line[x++]); 34 | return word; 35 | } 36 | 37 | char *fmakeword(FILE *f, char stop, int *cl) { 38 | int wsize; 39 | char *word; 40 | int ll; 41 | 42 | wsize = 102400; 43 | ll=0; 44 | word = (char *) malloc(sizeof(char) * (wsize + 1)); 45 | 46 | while(1) { 47 | word[ll] = (char)fgetc(f); 48 | if(ll==wsize) { 49 | word[ll+1] = '\0'; 50 | wsize+=102400; 51 | word = (char *)realloc(word,sizeof(char)*(wsize+1)); 52 | } 53 | --(*cl); 54 | if((word[ll] == stop) || (feof(f)) || (!(*cl))) { 55 | if(word[ll] != stop) ll++; 56 | word[ll] = '\0'; 57 | word = (char *) realloc(word, ll+1); 58 | return word; 59 | } 60 | ++ll; 61 | } 62 | } 63 | 64 | char x2c(char *what) { 65 | register char digit; 66 | 67 | digit = (what[0] >= 'A' ? ((what[0] & 0xdf) - 'A')+10 : (what[0] - '0')); 68 | digit *= 16; 69 | digit += (what[1] >= 'A' ? ((what[1] & 0xdf) - 'A')+10 : (what[1] - '0')); 70 | return(digit); 71 | } 72 | 73 | void unescape_url(char *url) { 74 | register int x,y; 75 | 76 | for(x=0,y=0;url[y];++x,++y) { 77 | if((url[x] = url[y]) == '%') { 78 | url[x] = x2c(&url[y+1]); 79 | if (url[x] == CR) x--; /*CT 11/7/97 get rid of Carriage Returns */ 80 | y+=2; 81 | } 82 | } 83 | url[x] = '\0'; 84 | } 85 | 86 | void plustospace(char *str) { 87 | register int x; 88 | 89 | for(x=0;str[x];x++) if(str[x] == '+') str[x] = ' '; 90 | } 91 | 92 | int rind(char *s, char c) { 93 | register int x; 94 | for(x=strlen(s) - 1;x != -1; x--) 95 | if(s[x] == c) return x; 96 | return -1; 97 | } 98 | 99 | int getline(char *s, int n, FILE *f) { 100 | register int i=0; 101 | 102 | while(1) { 103 | s[i] = (char)fgetc(f); 104 | 105 | if(s[i] == CR) 106 | s[i] = fgetc(f); 107 | 108 | if((s[i] == 0x4) || (s[i] == LF) || (i == (n-1))) { 109 | s[i] = '\0'; 110 | return (feof(f) ? 1 : 0); 111 | } 112 | ++i; 113 | } 114 | } 115 | 116 | void send_fd(FILE *f, FILE *fd) 117 | { 118 | int num_chars=0; 119 | char c; 120 | 121 | while (1) { 122 | c = fgetc(f); 123 | if(feof(f)) 124 | return; 125 | fputc(c,fd); 126 | } 127 | } 128 | 129 | int ind(char *s, char c) { 130 | register int x; 131 | 132 | for(x=0;s[x];x++) 133 | if(s[x] == c) return x; 134 | 135 | return -1; 136 | } 137 | 138 | void escape_shell_cmd(char *cmd) { 139 | register int x,y,l; 140 | 141 | l=strlen(cmd); 142 | for(x=0;cmd[x];x++) { 143 | if(ind("&;`'\"|*?~<>^()[]{}$\\\x0A",cmd[x]) != -1){ 144 | for(y=l+1;y>x;y--) 145 | cmd[y] = cmd[y-1]; 146 | l++; /* length has been increased */ 147 | cmd[x] = '\\'; 148 | x++; /* skip the character */ 149 | } 150 | } 151 | } 152 | 153 | -------------------------------------------------------------------------------- /bams_abstract.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Wavelet Analysis: A Practical Guide to Wavelet Analysis 5 | 6 | 7 | 8 | 9 |
10 | Bulletin of the American Meteorological Society: 11 | Vol. 79, No. 1, pp. 61–78. 12 |

13 | 14 |

A Practical Guide to Wavelet Analysis

15 | 16 | Christopher Torrence and Gilbert P. Compo
Program in Atmospheric 17 | and Oceanic Sciences, University of Colorado, Boulder, Colorado 18 |
19 | 20 | 21 | Keywords: Wavelet analysis, significance and confidence testing, 22 | red noise power spectrum, El Niño-Southern Oscillation. 23 |

24 | 25 | 26 | Abstract

27 | 28 |
29 | A practical step-by-step guide to wavelet analysis is given, with 30 | examples taken from time series of the 31 | El Niño-Southern Oscillation (ENSO). The guide includes a 32 | comparison to the windowed Fourier transform, the choice of an 33 | appropriate wavelet basis function, edge effects due to finite-length 34 | time series, and the relationship between wavelet scale and Fourier 35 | frequency. New statistical significance tests for wavelet power spectra 36 | are developed by 37 | deriving theoretical wavelet spectra for white and red noise 38 | processes and using these to establish significance levels and 39 | confidence intervals. It is shown that smoothing in time or scale 40 | can be used to increase the confidence of the wavelet spectrum. 41 | Empirical formulae are given for the effect of smoothing on significance levels 42 | and confidence intervals. Extensions to wavelet 43 | analysis such as filtering, the power 44 | Hovmöller, cross-wavelet spectra, and coherence are described. 45 |

46 | The statistical significance tests are used to give a quantitative 47 | measure of changes in ENSO variance on interdecadal time scales. 48 | Using new datasets that extend back to 1871, the Niño3 sea surface 49 | temperature and the Southern Oscillation Index show 50 | significantly higher power during 1880–1920 and 1960–90, and 51 | lower power during 1920–60, as well as 52 | a possible 15-yr modulation of variance. The power Hovmöller 53 | of sea level pressure shows significant variations in 2–8-yr 54 | wavelet power in both longitude and time. 55 |

56 |


57 |
    58 |
  1. Introduction 59 |
  2. Data 60 |
  3. Wavelet Analysis 61 |
      62 |
    1. Windowed Fourier Transform 63 |
    2. Wavelet Transform 64 |
    3. Normalization 65 |
    4. Wavelet Power Spectrum 66 |
    5. Wavelet Functions 67 |
    6. Choice of Scales 68 |
    7. Cone of Influence (COI) 69 |
    8. Wavelet Scale and Fourier Frequency 70 |
    9. Reconstruction 71 |
    72 |
  4. Theoretical Spectrum and Significance Levels 73 |
      74 |
    1. Fourier Red Noise Spectrum 75 |
    2. Wavelet Red Noise Spectrum 76 |
    3. Significance Levels 77 |
    4. Confidence Interval 78 |
    5. Stationarity 79 |
    80 |
  5. Smoothing in Time and Scale 81 |
      82 |
    1. Averaging in Time (Global Wavelet Spectrum) 83 |
    2. Averaging in Scale 84 |
    85 |
  6. Extensions to Wavelet Analysis 86 |
      87 |
    1. Filtering 88 |
    2. Power Hovmöller 89 |
    3. Cross-Wavelet Spectrum 90 |
    4. Wavelet Coherence and Phase 91 |
    92 |
  7. Summary 93 |
  8. Acknowledgments 94 |
  9. References 95 |
96 | 97 |
98 | 99 |
100 | 101 | 102 | 103 | -------------------------------------------------------------------------------- /webplot-do-not-use/waveplot.c: -------------------------------------------------------------------------------- 1 | #include 2 | #ifndef NO_STDLIB_H 3 | #include 4 | #else 5 | char *getenv(); 6 | #endif 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | 15 | #define MAX_ENTRIES 2500 16 | 17 | typedef struct { 18 | char *name; 19 | char *val; 20 | } entry; 21 | 22 | char *makeword(char *line, char stop); 23 | char *fmakeword(FILE *f, char stop, int *len); 24 | char x2c(char *what); 25 | void unescape_url(char *url); 26 | void plustospace(char *str); 27 | 28 | FILE *infp,*outfp; 29 | 30 | main(int argc, char *argv[]) { 31 | entry entries[MAX_ENTRIES]; 32 | register int x,m=0; 33 | int cl; 34 | char data[255],filename[255],file2[255],dir[255],command[255],time_str[20]; 35 | clock_t clocktime; 36 | time_t curtime; 37 | struct tm *loctime; 38 | 39 | printf("Content-type: text/html%c%c",10,10); 40 | 41 | curtime = time (NULL); /* Get the current time. */ 42 | loctime = localtime (&curtime); /* Convert to localtime representation.*/ 43 | strftime (time_str,20,"%H%M%S",loctime); /* Convert to string */ 44 | 45 | /* local directories */ 46 | sprintf(dir, "/export/home/httpd/htdocs/research/wavelets/plot/"); 47 | sprintf(filename, "out/wave_%s", getenv("REMOTE_HOST")); 48 | 49 | if(strcmp(getenv("REQUEST_METHOD"),"POST")) { 50 | goto skip; 51 | /* printf("This script should be referenced using "); 52 | printf("Wavelet Plot.%c",10); 53 | exit(1); 54 | */ 55 | } 56 | 57 | /* not sure what this does... */ 58 | if(strcmp(getenv("CONTENT_TYPE"),"application/x-www-form-urlencoded")) { 59 | printf("This script can only be used to decode form results. \n"); 60 | exit(1); 61 | } 62 | cl = atoi(getenv("CONTENT_LENGTH")); 63 | 64 | /* decode the form data */ 65 | for(x=0;cl && (!feof(stdin));x++) { 66 | m=x; 67 | entries[x].val = fmakeword(stdin,'&',&cl); 68 | plustospace(entries[x].val); 69 | unescape_url(entries[x].val); 70 | entries[x].name = makeword(entries[x].val,'='); 71 | } 72 | 73 | /* read in options */ 74 | if (strcmp(entries[1].name,"$dataset")==0) { 75 | sprintf(command,"rm -f %s%s.opt",dir,filename); 76 | system(command); 77 | sprintf(file2,"%s%s.dat",dir,filename);} 78 | else 79 | sprintf(file2,"%s%s.opt",dir,filename); 80 | 81 | /* remove previous gif & postscript files */ 82 | sprintf(command,"rm -f %s%s*.gif %s%s*.ps",dir,filename,dir,filename); 83 | system(command); 84 | 85 | /* write out options */ 86 | outfp = fopen(file2,"w"); 87 | for(x=0; x <= m; x++) 88 | fprintf(outfp,"%s\n%s\n",entries[x].name,entries[x].val); 89 | fclose(outfp); 90 | 91 | skip: 92 | /* construct IDL batch file */ 93 | sprintf(file2,"%s%s.idl",dir,filename); 94 | outfp = fopen(file2,"w"); 95 | fprintf(outfp,"CATCH,error_status\n"); 96 | fprintf(outfp,"IF (error_status NE 0) THEN EXIT\n"); 97 | fprintf(outfp,"CD,'%s'\n",dir); 98 | fprintf(outfp,"RESTORE,'waveplot.sav'\n"); 99 | fprintf(outfp,".run waveplot\n"); 100 | fprintf(outfp,"waveplot,'%s','%s'\n",filename,time_str); 101 | fprintf(outfp,"EXIT\n"); 102 | fclose(outfp); 103 | 104 | /* run IDL batch file */ 105 | sprintf(command,"/usr/local/rsi/idl/bin/idl %s",file2); 106 | system(command); 107 | 108 | /* read in HTML & dump to browser */ 109 | sprintf(file2,"%s%s.html",dir,filename); 110 | infp = fopen(file2,"r"); 111 | (void) fgets(data,sizeof(data),infp); 112 | while (!feof(infp)) { 113 | printf("%s\n",data); 114 | (void) fgets(data,sizeof(data),infp); 115 | } 116 | fclose(infp); 117 | 118 | /* automatically remove data & gif files more than 4 days old... */ 119 | sprintf(command,"find %sout -name 'wave_*' -mtime +4 -exec rm {} \\;",dir); 120 | system(command); 121 | 122 | } 123 | -------------------------------------------------------------------------------- /wave_fortran/wavetest_output.txt: -------------------------------------------------------------------------------- 1 | Sample output for "wavetest.f" (27 Nov 1999) 2 | Compiling and running "wavetest": 3 | 4 | > f77 cfftpack.f chisqr.f wavelet.f wavetest.f -o wavetest 5 | > wavetest 6 | 7 | Sample output: 8 | NOTE: your output may differ slightly (<1%) 9 | due to different compilers or floating-point representation. 10 | 11 | sst(1)= -0.15 sst(n) = -0.06 12 | 13 | n= 504 14 | dt= 0.25 15 | mother= 0 16 | param= 6. 17 | s0= 0.25 18 | dj= 0.25 19 | jtot= 44 20 | npad= 1024 21 | 22 | Let w = wave(n/2,j) 23 | 24 | j Scale Period ABS(w)^2 phase(w) 5%signif Global GWS5%sig 25 | 1 0.250 0.258 0.000 116.357 7.230 0.000 2.689 26 | 2 0.297 0.307 0.000 116.564 0.813 0.000 0.305 27 | 3 0.354 0.365 0.000 118.295 0.371 0.001 0.141 28 | 4 0.420 0.434 0.003 122.777 0.277 0.007 0.106 29 | 5 0.500 0.517 0.012 132.364 0.263 0.029 0.102 30 | 6 0.595 0.614 0.022 143.603 0.286 0.043 0.112 31 | 7 0.707 0.730 0.023 141.647 0.337 0.058 0.134 32 | 8 0.841 0.869 0.050 135.089 0.418 0.096 0.169 33 | 9 1.000 1.033 0.259 148.135 0.537 0.177 0.221 34 | 10 1.189 1.229 0.335 172.986 0.704 0.269 0.295 35 | 11 1.414 1.461 0.456 -125.342 0.931 0.396 0.398 36 | 12 1.682 1.737 0.983 -117.802 1.236 0.548 0.539 37 | 13 2.000 2.066 0.445 -159.262 1.635 0.785 0.729 38 | 14 2.378 2.457 0.201 153.529 2.140 1.276 0.977 39 | 15 2.828 2.922 0.022 13.591 2.758 1.954 1.292 40 | 16 3.364 3.475 0.016 58.034 3.481 2.569 1.676 41 | 17 4.000 4.132 0.944 -165.529 4.285 2.270 2.125 42 | 18 4.757 4.914 2.964 -146.529 5.130 2.109 2.625 43 | 19 5.657 5.844 0.734 -140.449 5.968 2.357 3.157 44 | 20 6.727 6.949 0.206 66.755 6.750 1.703 3.700 45 | 21 8.000 8.264 0.309 120.272 7.442 1.368 4.236 46 | 22 9.514 9.828 1.300 131.020 8.025 1.318 4.753 47 | 23 11.314 11.688 2.055 137.350 8.496 1.605 5.246 48 | 24 13.454 13.899 2.273 129.854 8.865 1.823 5.716 49 | 25 16.000 16.529 0.237 119.806 9.146 1.311 6.167 50 | 26 19.027 19.656 0.361 -116.176 9.355 1.424 6.603 51 | 27 22.627 23.375 0.130 -50.341 9.509 1.154 7.027 52 | 28 26.909 27.798 1.415 12.274 9.621 1.295 7.440 53 | 29 32.000 33.057 0.850 14.676 9.702 0.643 7.838 54 | 30 38.055 39.312 0.559 -34.619 9.760 0.587 8.214 55 | 31 45.255 46.750 1.005 -42.794 9.802 1.008 8.560 56 | 32 53.817 55.596 0.285 2.065 9.831 0.539 8.867 57 | 33 64.000 66.115 0.700 91.352 9.852 0.728 9.128 58 | 34 76.109 78.624 1.477 117.662 9.867 1.363 9.341 59 | 35 90.510 93.500 1.247 133.609 9.878 1.169 9.508 60 | 36 107.635 111.191 0.666 173.291 9.885 0.621 9.634 61 | 37 128.000 132.230 0.921 -172.955 9.891 0.914 9.726 62 | 38 152.219 157.248 0.171 -162.954 9.894 0.161 9.790 63 | 39 181.019 187.001 0.143 -114.740 9.897 0.140 9.834 64 | 40 215.269 222.383 1.092 -112.308 9.899 1.092 9.863 65 | 41 256.000 264.459 2.003 -112.306 9.900 2.003 9.881 66 | 42 304.437 314.497 0.296 -112.306 9.901 0.296 9.893 67 | 43 362.039 374.002 0.001 -112.306 9.902 0.001 9.899 68 | 44 430.539 444.766 0.000 -112.306 9.902 0.000 9.902 69 | 70 | Scale-average degrees of freedom = 6.441 71 | Scale-avg 5% significance level = 0.439 72 | 73 | Reconstructed variance= 0.51547 74 | Original variance = 0.53817 75 | Ratio = 0.95783 (this is low due to padding with zeroes) 76 | 77 | Reconstructed mean= 0.000000 78 | Original mean = -0.000020 79 | Root-mean-square difference of time series= 0.002309 80 | -------------------------------------------------------------------------------- /wave_matlab/wavetest.m: -------------------------------------------------------------------------------- 1 | %WAVETEST Example Matlab script for WAVELET, using NINO3 SST dataset 2 | % 3 | % See "http://paos.colorado.edu/research/wavelets/" 4 | % Written January 1998 by C. Torrence 5 | % 6 | % Modified Oct 1999, changed Global Wavelet Spectrum (GWS) to be sideways, 7 | % changed all "log" to "log2", changed logarithmic axis on GWS to 8 | % a normal axis. 9 | 10 | load 'sst_nino3.dat' % input SST time series 11 | sst = sst_nino3; 12 | 13 | %------------------------------------------------------ Computation 14 | 15 | % normalize by standard deviation (not necessary, but makes it easier 16 | % to compare with plot on Interactive Wavelet page, at 17 | % "http://paos.colorado.edu/research/wavelets/plot/" 18 | variance = std(sst)^2; 19 | sst = (sst - mean(sst))/sqrt(variance) ; 20 | 21 | n = length(sst); 22 | dt = 0.25 ; 23 | time = [0:length(sst)-1]*dt + 1871.0 ; % construct time array 24 | xlim = [1870,2000]; % plotting range 25 | pad = 1; % pad the time series with zeroes (recommended) 26 | dj = 0.25; % this will do 4 sub-octaves per octave 27 | s0 = 2*dt; % this says start at a scale of 6 months 28 | j1 = 7/dj; % this says do 7 powers-of-two with dj sub-octaves each 29 | lag1 = 0.72; % lag-1 autocorrelation for red noise background 30 | mother = 'Morlet'; 31 | 32 | % Wavelet transform: 33 | [wave,period,scale,coi] = wavelet(sst,dt,pad,dj,s0,j1,mother); 34 | power = (abs(wave)).^2 ; % compute wavelet power spectrum 35 | 36 | % Significance levels: (variance=1 for the normalized SST) 37 | [signif,fft_theor] = wave_signif(1.0,dt,scale,0,lag1,-1,-1,mother); 38 | sig95 = (signif')*(ones(1,n)); % expand signif --> (J+1)x(N) array 39 | sig95 = power ./ sig95; % where ratio > 1, power is significant 40 | 41 | % Global wavelet spectrum & significance levels: 42 | global_ws = variance*(sum(power')/n); % time-average over all times 43 | dof = n - scale; % the -scale corrects for padding at edges 44 | global_signif = wave_signif(variance,dt,scale,1,lag1,-1,dof,mother); 45 | 46 | % Scale-average between El Nino periods of 2--8 years 47 | avg = find((scale >= 2) & (scale < 8)); 48 | Cdelta = 0.776; % this is for the MORLET wavelet 49 | scale_avg = (scale')*(ones(1,n)); % expand scale --> (J+1)x(N) array 50 | scale_avg = power ./ scale_avg; % [Eqn(24)] 51 | scale_avg = variance*dj*dt/Cdelta*sum(scale_avg(avg,:)); % [Eqn(24)] 52 | scaleavg_signif = wave_signif(variance,dt,scale,2,lag1,-1,[2,7.9],mother); 53 | 54 | whos 55 | 56 | %------------------------------------------------------ Plotting 57 | 58 | %--- Plot time series 59 | subplot('position',[0.1 0.75 0.65 0.2]) 60 | plot(time,sst) 61 | set(gca,'XLim',xlim(:)) 62 | xlabel('Time (year)') 63 | ylabel('NINO3 SST (degC)') 64 | title('a) NINO3 Sea Surface Temperature (seasonal)') 65 | hold off 66 | 67 | %--- Contour plot wavelet power spectrum 68 | subplot('position',[0.1 0.37 0.65 0.28]) 69 | levels = [0.0625,0.125,0.25,0.5,1,2,4,8,16] ; 70 | Yticks = 2.^(fix(log2(min(period))):fix(log2(max(period)))); 71 | contour(time,log2(period),log2(power),log2(levels)); %*** or use 'contourfill' 72 | %imagesc(time,log2(period),log2(power)); %*** uncomment for 'image' plot 73 | xlabel('Time (year)') 74 | ylabel('Period (years)') 75 | title('b) NINO3 SST Wavelet Power Spectrum') 76 | set(gca,'XLim',xlim(:)) 77 | set(gca,'YLim',log2([min(period),max(period)]), ... 78 | 'YDir','reverse', ... 79 | 'YTick',log2(Yticks(:)), ... 80 | 'YTickLabel',Yticks) 81 | % 95% significance contour, levels at -99 (fake) and 1 (95% signif) 82 | hold on 83 | contour(time,log2(period),sig95,[-99,1],'k'); 84 | hold on 85 | % cone-of-influence, anything "below" is dubious 86 | plot(time,log2(coi),'k') 87 | hold off 88 | 89 | %--- Plot global wavelet spectrum 90 | subplot('position',[0.77 0.37 0.2 0.28]) 91 | plot(global_ws,log2(period)) 92 | hold on 93 | plot(global_signif,log2(period),'--') 94 | hold off 95 | xlabel('Power (degC^2)') 96 | title('c) Global Wavelet Spectrum') 97 | set(gca,'YLim',log2([min(period),max(period)]), ... 98 | 'YDir','reverse', ... 99 | 'YTick',log2(Yticks(:)), ... 100 | 'YTickLabel','') 101 | set(gca,'XLim',[0,1.25*max(global_ws)]) 102 | 103 | %--- Plot 2--8 yr scale-average time series 104 | subplot('position',[0.1 0.07 0.65 0.2]) 105 | plot(time,scale_avg) 106 | set(gca,'XLim',xlim(:)) 107 | xlabel('Time (year)') 108 | ylabel('Avg variance (degC^2)') 109 | title('d) 2-8 yr Scale-average Time Series') 110 | hold on 111 | plot(xlim,scaleavg_signif+[0,0],'--') 112 | hold off 113 | 114 | % end of code 115 | 116 | -------------------------------------------------------------------------------- /wave_idl/soi.txt: -------------------------------------------------------------------------------- 1 | $submit 2 | Submit 3 | $dataset 4 | nino3sst 5 | $title 6 | Southern Oscillation Index 7 | $source 8 | Climate Prediction Center (http://nic.fb4.noaa.gov/data/cddb/) 9 | $dataset1 10 | SOI 11 | $units 12 | mb 13 | t0 14 | 1896 15 | dt 16 | 0.25 17 | $t_units 18 | years 19 | data 20 | 0.75 21 | -2.48 22 | -2.41 23 | -1.84 24 | -2.55 25 | -1.61 26 | -0.04 27 | 0.16 28 | 1.85 29 | 0.19 30 | 1.19 31 | 0.46 32 | 2.05 33 | -0.61 34 | -1.01 35 | 0.73 36 | -2.75 37 | -0.11 38 | -0.08 39 | -1.84 40 | 0.55 41 | 0.89 42 | 0.29 43 | -2.00 44 | 1.51 45 | 0.69 46 | -1.48 47 | -1.00 48 | -0.59 49 | 1.05 50 | 0.66 51 | 1.20 52 | 2.41 53 | 1.22 54 | -0.51 55 | -0.90 56 | -3.89 57 | -4.55 58 | -1.94 59 | -2.37 60 | -1.55 61 | -0.81 62 | 1.99 63 | 1.54 64 | 0.11 65 | -0.41 66 | -0.66 67 | -0.11 68 | -0.76 69 | 0.09 70 | 1.34 71 | 0.06 72 | -0.52 73 | 0.35 74 | 0.99 75 | 0.70 76 | 2.05 77 | 1.09 78 | 2.29 79 | 2.36 80 | 0.35 81 | -0.88 82 | -1.84 83 | -1.44 84 | -2.69 85 | -1.75 86 | -0.84 87 | -1.04 88 | -0.72 89 | -0.88 90 | -1.21 91 | -1.77 92 | 0.11 93 | -1.50 94 | -2.29 95 | -1.50 96 | -3.61 97 | -0.69 98 | 1.28 99 | -0.01 100 | -0.49 101 | 0.55 102 | 2.22 103 | 1.63 104 | 2.01 105 | 2.62 106 | 4.69 107 | 3.20 108 | 1.78 109 | 0.92 110 | -1.54 111 | -0.97 112 | -2.89 113 | -0.95 114 | -1.28 115 | -1.97 116 | -0.55 117 | 0.05 118 | 0.92 119 | 0.16 120 | 1.54 121 | 0.75 122 | -0.04 123 | 1.23 124 | 1.28 125 | -0.31 126 | 0.16 127 | 1.26 128 | 0.98 129 | 0.35 130 | -2.48 131 | -1.00 132 | -0.29 133 | 0.12 134 | 1.22 135 | 1.16 136 | 2.08 137 | 0.25 138 | -1.68 139 | -2.00 140 | -4.05 141 | -2.31 142 | -2.08 143 | -1.17 144 | 1.28 145 | 0.79 146 | -0.42 147 | -0.37 148 | 0.68 149 | 0.02 150 | 0.92 151 | 1.23 152 | 2.51 153 | -0.35 154 | -0.01 155 | 1.20 156 | 1.18 157 | -0.35 158 | -0.88 159 | -0.00 160 | -0.39 161 | 1.59 162 | 0.34 163 | -0.26 164 | -0.50 165 | -0.89 166 | -1.57 167 | -0.47 168 | -0.79 169 | 0.15 170 | 0.12 171 | 0.86 172 | 0.31 173 | 0.39 174 | -1.54 175 | 0.46 176 | 0.71 177 | -0.21 178 | 0.36 179 | 0.10 180 | -0.25 181 | 0.29 182 | -0.24 183 | -0.84 184 | 0.45 185 | 0.05 186 | -0.21 187 | -0.17 188 | 0.38 189 | 1.42 190 | 1.92 191 | 1.50 192 | 2.11 193 | 0.22 194 | -0.31 195 | -2.10 196 | -1.15 197 | -1.88 198 | -2.94 199 | -2.87 200 | -2.65 201 | -1.41 202 | -2.64 203 | -2.37 204 | -1.75 205 | 0.25 206 | 0.49 207 | 0.93 208 | 1.41 209 | 0.25 210 | 0.72 211 | -0.10 212 | -0.19 213 | -0.51 214 | -0.28 215 | -0.77 216 | 1.38 217 | -0.05 218 | 1.12 219 | 0.16 220 | -0.22 221 | -1.35 222 | -1.78 223 | -1.34 224 | -0.15 225 | -0.75 226 | 1.36 227 | 0.46 228 | -0.89 229 | -0.01 230 | -0.74 231 | -0.04 232 | -0.25 233 | -0.78 234 | -0.34 235 | 0.26 236 | 2.41 237 | 1.99 238 | 1.96 239 | 2.83 240 | 0.85 241 | -1.02 242 | -1.75 243 | -1.81 244 | -1.18 245 | 0.25 246 | -0.12 247 | -0.81 248 | -0.81 249 | -1.38 250 | -1.82 251 | -0.71 252 | -0.18 253 | 0.22 254 | 0.68 255 | 0.82 256 | 0.65 257 | 0.82 258 | 2.35 259 | 2.02 260 | 2.05 261 | 1.55 262 | 1.12 263 | 1.55 264 | -0.11 265 | -0.68 266 | -1.05 267 | -1.05 268 | -1.88 269 | -0.45 270 | 0.28 271 | -0.91 272 | -1.18 273 | -0.05 274 | -0.55 275 | 1.12 276 | 0.19 277 | 0.35 278 | 0.88 279 | 0.59 280 | -1.28 281 | 0.22 282 | -0.05 283 | 0.75 284 | 0.55 285 | 0.68 286 | 0.38 287 | 0.62 288 | 1.12 289 | -0.12 290 | -0.75 291 | -2.28 292 | -0.08 293 | 0.75 294 | 1.72 295 | 0.42 296 | -0.11 297 | -1.08 298 | -2.62 299 | -1.61 300 | -2.11 301 | -0.68 302 | -0.02 303 | -0.58 304 | 2.25 305 | -0.15 306 | 0.55 307 | -0.88 308 | 0.59 309 | 0.92 310 | 0.08 311 | -0.41 312 | -1.58 313 | -0.75 314 | -1.28 315 | -0.65 316 | -1.55 317 | 0.25 318 | 0.52 319 | 2.49 320 | 2.29 321 | 1.32 322 | 1.62 323 | 1.22 324 | 0.75 325 | -1.92 326 | -2.35 327 | -1.81 328 | -1.18 329 | 0.45 330 | 1.58 331 | 2.89 332 | 3.65 333 | 0.92 334 | 1.55 335 | 0.32 336 | 0.55 337 | 1.38 338 | 3.35 339 | 2.75 340 | 2.35 341 | 0.05 342 | -2.02 343 | 0.19 344 | -0.41 345 | -1.65 346 | -1.98 347 | -2.35 348 | -2.51 349 | 0.52 350 | 0.32 351 | -0.58 352 | -0.18 353 | 0.08 354 | 0.45 355 | -1.08 356 | -0.41 357 | -0.92 358 | -0.42 359 | -0.55 360 | -1.25 361 | 0.65 362 | 0.82 363 | -0.11 364 | 0.69 365 | -1.32 366 | -3.38 367 | -4.31 368 | -6.45 369 | -0.68 370 | -0.05 371 | -0.08 372 | -0.08 373 | -0.38 374 | 0.12 375 | -0.41 376 | 0.45 377 | 0.22 378 | 0.22 379 | -0.48 380 | -0.35 381 | 0.12 382 | -0.68 383 | -1.51 384 | -2.55 385 | -2.82 386 | -2.35 387 | -0.81 388 | -0.48 389 | 0.18 390 | 2.35 391 | 2.35 392 | 1.79 393 | 1.68 394 | 0.35 395 | -0.28 396 | -2.01 397 | 0.52 398 | -0.52 399 | -0.58 400 | -0.45 401 | -1.62 402 | -1.48 403 | -2.41 404 | -4.11 405 | -1.35 406 | -0.42 407 | -1.91 408 | -1.85 409 | -1.95 410 | -1.82 411 | -0.88 412 | -0.91 413 | -1.98 414 | -2.85 415 | -2.08 416 | -0.45 417 | -1.08 418 | 0.32 419 | -0.58 420 | -------------------------------------------------------------------------------- /webplot-do-not-use/data/soi.dat: -------------------------------------------------------------------------------- 1 | $submit 2 | Submit 3 | $dataset 4 | nino3sst 5 | $title 6 | Southern Oscillation Index 7 | $source 8 | Climate Prediction Center 9 | $dataset1 10 | SOI 11 | $units 12 | mb 13 | t0 14 | 1896 15 | dt 16 | 0.25 17 | $t_units 18 | years 19 | data 20 | 0.75 21 | -2.48 22 | -2.41 23 | -1.84 24 | -2.55 25 | -1.61 26 | -0.04 27 | 0.16 28 | 1.85 29 | 0.19 30 | 1.19 31 | 0.46 32 | 2.05 33 | -0.61 34 | -1.01 35 | 0.73 36 | -2.75 37 | -0.11 38 | -0.08 39 | -1.84 40 | 0.55 41 | 0.89 42 | 0.29 43 | -2.00 44 | 1.51 45 | 0.69 46 | -1.48 47 | -1.00 48 | -0.59 49 | 1.05 50 | 0.66 51 | 1.20 52 | 2.41 53 | 1.22 54 | -0.51 55 | -0.90 56 | -3.89 57 | -4.55 58 | -1.94 59 | -2.37 60 | -1.55 61 | -0.81 62 | 1.99 63 | 1.54 64 | 0.11 65 | -0.41 66 | -0.66 67 | -0.11 68 | -0.76 69 | 0.09 70 | 1.34 71 | 0.06 72 | -0.52 73 | 0.35 74 | 0.99 75 | 0.70 76 | 2.05 77 | 1.09 78 | 2.29 79 | 2.36 80 | 0.35 81 | -0.88 82 | -1.84 83 | -1.44 84 | -2.69 85 | -1.75 86 | -0.84 87 | -1.04 88 | -0.72 89 | -0.88 90 | -1.21 91 | -1.77 92 | 0.11 93 | -1.50 94 | -2.29 95 | -1.50 96 | -3.61 97 | -0.69 98 | 1.28 99 | -0.01 100 | -0.49 101 | 0.55 102 | 2.22 103 | 1.63 104 | 2.01 105 | 2.62 106 | 4.69 107 | 3.20 108 | 1.78 109 | 0.92 110 | -1.54 111 | -0.97 112 | -2.89 113 | -0.95 114 | -1.28 115 | -1.97 116 | -0.55 117 | 0.05 118 | 0.92 119 | 0.16 120 | 1.54 121 | 0.75 122 | -0.04 123 | 1.23 124 | 1.28 125 | -0.31 126 | 0.16 127 | 1.26 128 | 0.98 129 | 0.35 130 | -2.48 131 | -1.00 132 | -0.29 133 | 0.12 134 | 1.22 135 | 1.16 136 | 2.08 137 | 0.25 138 | -1.68 139 | -2.00 140 | -4.05 141 | -2.31 142 | -2.08 143 | -1.17 144 | 1.28 145 | 0.79 146 | -0.42 147 | -0.37 148 | 0.68 149 | 0.02 150 | 0.92 151 | 1.23 152 | 2.51 153 | -0.35 154 | -0.01 155 | 1.20 156 | 1.18 157 | -0.35 158 | -0.88 159 | -0.00 160 | -0.39 161 | 1.59 162 | 0.34 163 | -0.26 164 | -0.50 165 | -0.89 166 | -1.57 167 | -0.47 168 | -0.79 169 | 0.15 170 | 0.12 171 | 0.86 172 | 0.31 173 | 0.39 174 | -1.54 175 | 0.46 176 | 0.71 177 | -0.21 178 | 0.36 179 | 0.10 180 | -0.25 181 | 0.29 182 | -0.24 183 | -0.84 184 | 0.45 185 | 0.05 186 | -0.21 187 | -0.17 188 | 0.38 189 | 1.42 190 | 1.92 191 | 1.50 192 | 2.11 193 | 0.22 194 | -0.31 195 | -2.10 196 | -1.15 197 | -1.88 198 | -2.94 199 | -2.87 200 | -2.65 201 | -1.41 202 | -2.64 203 | -2.37 204 | -1.75 205 | 0.25 206 | 0.49 207 | 0.93 208 | 1.41 209 | 0.25 210 | 0.72 211 | -0.10 212 | -0.19 213 | -0.51 214 | -0.28 215 | -0.77 216 | 1.38 217 | -0.05 218 | 1.12 219 | 0.16 220 | -0.22 221 | -1.35 222 | -1.78 223 | -1.34 224 | -0.15 225 | -0.75 226 | 1.36 227 | 0.46 228 | -0.89 229 | -0.01 230 | -0.74 231 | -0.04 232 | -0.25 233 | -0.78 234 | -0.34 235 | 0.26 236 | 2.41 237 | 1.99 238 | 1.96 239 | 2.83 240 | 0.85 241 | -1.02 242 | -1.75 243 | -1.81 244 | -1.18 245 | 0.25 246 | -0.12 247 | -0.81 248 | -0.81 249 | -1.38 250 | -1.82 251 | -0.71 252 | -0.18 253 | 0.22 254 | 0.68 255 | 0.82 256 | 0.65 257 | 0.82 258 | 2.35 259 | 2.02 260 | 2.05 261 | 1.55 262 | 1.12 263 | 1.55 264 | -0.11 265 | -0.68 266 | -1.05 267 | -1.05 268 | -1.88 269 | -0.45 270 | 0.28 271 | -0.91 272 | -1.18 273 | -0.05 274 | -0.55 275 | 1.12 276 | 0.19 277 | 0.35 278 | 0.88 279 | 0.59 280 | -1.28 281 | 0.22 282 | -0.05 283 | 0.75 284 | 0.55 285 | 0.68 286 | 0.38 287 | 0.62 288 | 1.12 289 | -0.12 290 | -0.75 291 | -2.28 292 | -0.08 293 | 0.75 294 | 1.72 295 | 0.42 296 | -0.11 297 | -1.08 298 | -2.62 299 | -1.61 300 | -2.11 301 | -0.68 302 | -0.02 303 | -0.58 304 | 2.25 305 | -0.15 306 | 0.55 307 | -0.88 308 | 0.59 309 | 0.92 310 | 0.08 311 | -0.41 312 | -1.58 313 | -0.75 314 | -1.28 315 | -0.65 316 | -1.55 317 | 0.25 318 | 0.52 319 | 2.49 320 | 2.29 321 | 1.32 322 | 1.62 323 | 1.22 324 | 0.75 325 | -1.92 326 | -2.35 327 | -1.81 328 | -1.18 329 | 0.45 330 | 1.58 331 | 2.89 332 | 3.65 333 | 0.92 334 | 1.55 335 | 0.32 336 | 0.55 337 | 1.38 338 | 3.35 339 | 2.75 340 | 2.35 341 | 0.05 342 | -2.02 343 | 0.19 344 | -0.41 345 | -1.65 346 | -1.98 347 | -2.35 348 | -2.51 349 | 0.52 350 | 0.32 351 | -0.58 352 | -0.18 353 | 0.08 354 | 0.45 355 | -1.08 356 | -0.41 357 | -0.92 358 | -0.42 359 | -0.55 360 | -1.25 361 | 0.65 362 | 0.82 363 | -0.11 364 | 0.69 365 | -1.32 366 | -3.38 367 | -4.31 368 | -6.45 369 | -0.68 370 | -0.05 371 | -0.08 372 | -0.08 373 | -0.38 374 | 0.12 375 | -0.41 376 | 0.45 377 | 0.22 378 | 0.22 379 | -0.48 380 | -0.35 381 | 0.12 382 | -0.68 383 | -1.51 384 | -2.55 385 | -2.82 386 | -2.35 387 | -0.81 388 | -0.48 389 | 0.18 390 | 2.35 391 | 2.35 392 | 1.79 393 | 1.68 394 | 0.35 395 | -0.28 396 | -2.01 397 | 0.52 398 | -0.52 399 | -0.58 400 | -0.45 401 | -1.62 402 | -1.48 403 | -2.41 404 | -4.11 405 | -1.35 406 | -0.42 407 | -1.91 408 | -1.85 409 | -1.95 410 | -1.82 411 | -0.88 412 | -0.91 413 | -1.98 414 | -2.85 415 | -2.08 416 | -0.45 417 | -1.08 418 | 0.32 419 | -0.58 420 | -------------------------------------------------------------------------------- /software.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Wavelet analysis software 5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 |  
13 | Wavelet Software*

14 |

15 | 16 | 17 |
18 | 19 | 20 | 30 | 40 | 51 | 76 | 77 | 90 |
Fortran
21 | wave_fortran.zip
22 | Includes all of the following files...
23 | Sample output
24 | wavetest.f
25 | wavelet.f
26 | cfftpack.f
27 | chisqr.f
28 | sst_nino3.dat
29 |
IDL
31 | wave_idl.zip
32 | Includes all of the following files...
33 | wavelet.pro
34 | wave_signif.pro
35 | wavetest.pro
36 | sst_nino3.dat

37 | Wavelet coherency:
38 | wave_coherency.pro
39 |

Matlab
41 | wave_matlab.zip
42 | Includes all of the following files...
43 | wavelet.m
44 | wave_bases.m
45 | wave_signif.m
46 | chisquare_inv.m
47 | chisquare_solve.m
48 | wavetest.m
49 | sst_nino3.dat
50 |
Python**
52 | waveletAnalysis.py
53 | waveletFunctions.py
54 | sst_nino3.dat
55 | README_python.txt
56 | 57 | ** Wavelet analysis codes
58 | translated to Python and provided
59 | here courtesy of
60 | Evgeniya Predybaylo
61 | predybaylo[DOT]evgenia[AT]gmail[DOT]com
62 | Earth Sciences and Engineering Program
63 | King Abdullah University
64 | of Science and Technology
65 | Kingdom of Saudi Arabia
66 |
67 | Please include the following
68 | acknowledgement in any publication
69 | "Python wavelet software provided by
70 | Evgeniya Predybaylo based on
71 | Torrence and Compo (1998)
72 | and is available at URL:
73 | http://atoc.colorado.edu/research/wavelets/"
74 | 75 |
Datasets
78 | 89 |
91 |
92 | 93 |  

94 | 95 |

96 |
97 | * Notice: Please acknowledge the use of this software in any publications:
98 | 99 | ``Wavelet software was provided by C. Torrence and G. Compo, and is available at 100 | URL: http://atoc.colorado.edu/research/wavelets/''. 101 |
102 | Please send a copy of such publications to either C. Torrence or G. Compo: 103 |
104 |
105 | 106 | 114 |
107 | Dr. Christopher Torrence
108 | Exelis
109 | 4990 Pearl East Circle
110 | Boulder, CO 80301, USA
111 | E-mail: chris.torrence[AT]exelisinc[DOT]com 112 |
113 |
        115 | Dr. Gilbert P. Compo
116 | CIRES, University of Colorado & Physical Sciences Division, NOAA ESRL
117 | Campus Box 216
118 | University of Colorado
119 | Boulder CO 80309-0216, USA.
120 | E-mail: compo[AT]colorado[DOT]edu 121 |
122 |
123 |
124 |
125 | back to Wavelet Home Page 126 | 127 |
128 | 129 | 130 | -------------------------------------------------------------------------------- /montecarlo.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Wave:Monte Carlo 5 | 6 | 7 | 8 | 9 | 10 | 11 |

Wavelet Analysis

12 | 13 |

14 | 21 |

22 | 23 |
24 | 25 |

26 |

27 | Monte Carlo Method 28 |

29 | 30 | 51 | 71 | 87 | 88 | 127 |
31 | 32 | 33 |
34 | Important Note: When applying the significance 35 | and confidence tests from 36 | "A Practical Guide to Wavelet Analysis", 37 | you do not need to use a Monte Carlo simulation. 38 | Analytical formulae are given in the paper for the statistical distribution 39 | of wavelet power. These formulae are correct, assuming that 40 | the underlying distribution of the original time series is Gaussian. 41 |

42 | The following description of Monte Carlo is given for those who want 43 | more background on the method, or if your time series cannot be assumed 44 | to be Gaussian. 45 |

46 | 47 |
48 | Gaussian distribution

49 | Gaussian 50 |

52 | 53 |       The Monte Carlo method (or simulation) was used 54 | in "A Practical Guide to Wavelet Analysis" 55 | to verify that the wavelet power spectrum was indeed chi-square distributed. 56 | The method was also used to determine the empirical formulae for 57 | time-averaging and scale-averaging (paper Sections 5a and 5b). 58 |

59 |       The Monte Carlo method (or simulation) is a 60 | statistical method for finding out the answer to a problem that is 61 | too difficult to solve analytically, 62 | or for verifying the analytical solution. It is called Monte Carlo because 63 | of the gambling casinos in that city, and because the Monte 64 | Carlo method is related to rolling dice. 65 |

66 | 67 |

68 | Chi-square distribution

69 | Chi-square 70 |

72 | 73 |       Here's an example: 74 |
If you roll two dice, then 75 | the chances of getting a total of "two" (a "one" on each) are 1 in 76 | 36. This is easy to figure out. But if you didn't know the answer, 77 | you could use the Monte Carlo method. You just roll two dice 78 | thousands of times, and add up how many times you got a total of 79 | "two". Eventually, your fraction of "two's" to "total rolls" will 80 | approach 1/36. 81 |
82 |

83 |

84 | snake 85 | eyes 86 |
89 |       In our paper, we wanted to verify that the 90 | statistical distribution for the wavelet power was chi-square. 91 | Here's the Monte Carlo method we used: 92 |
    93 |
  1. We created 100,000 random time series, each with 512 points. 94 |

    95 |

  2. Then we took the wavelet transform for each one, 96 | and computed the wavelet power. 97 |

    98 |

  3. We then took a time slice from the middle (time n=256), 99 |

    100 |

  4. At each scale, we sorted all 100,000 wavelet powers into 101 | increasing order. 102 |

    103 |

  5. You can then make a plot of wavelet power versus number. 104 |

    105 |

  6. If you then look at what the wavelet power was for 106 | number 95,000 out of 100,000, then 95% of the wavelet power 107 | is below that value, and only 5% is above. 108 |

    109 |

  7. This 95% level is the 95% confidence level 110 | (or the 5% significance level). 111 |
112 | The method can be generalized to any process where 113 | the statistical distribution is unknown, yet one needs to determine 114 | confidence or significance levels. 115 |

116 |

117 | Time series
118 | time series 119 |

120 | Wavelet power spectrum
121 | wavelet power 122 |

123 | Chi-square results
124 | chi square 125 |

126 |

128 |

129 |


130 | back to Wavelet Home Page 131 | 132 | 133 | 134 | -------------------------------------------------------------------------------- /wavelet1.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Wave:Wavelets 1 5 | 6 | 7 | 8 | 9 | 10 | 11 |

Wavelet Analysis

12 | 13 |

14 | 21 |

22 | 23 |
24 | 25 |

26 |

27 | Introduction 28 |

29 | 30 |       Many time series in geophysics exhibit non-stationarity in their 31 | statistics. While the series may contain dominant periodic signals, 32 | these signals can vary in both amplitude and frequency over long 33 | periods of time. 34 |

35 |       An example would be sea surface temperatures in the 36 | equatorial Pacific Ocean (Figure 1). 37 | The dominant "mode" of variability is the 38 | El Niño-Southern Oscillation (ENSO), shown by the high-frequency 39 | "spikes" on a time scale of 2-7 years. 40 | Superimposed on this signal are much longer interdecadal fluctuations. 41 | The interdecadal fluctuations have the effect of modulating the 42 | amplitude and frequency of occurance of El Niño events. 43 |

44 | 45 | 46 |


47 |
48 | NINO3 SST 49 |
50 |
51 | 52 |
53 |
54 | Fig. 1. 55 |
Sea surface temperatures averaged over the NINO3 region 56 | in the eastern Pacific (5°S-5°N, 90°W-150°W). 57 | Blue curve is low-pass filtered (>12 months) SST. 58 | Yellow background curve is running 15-year variance, plotted 59 | at mid-point of 15-year period. Curve has been reproduced upside-down 60 | to show "envelope" of variance. 61 |
62 |
63 |

64 | 65 |       Ideally, one would like to separate the shorter period 66 | oscillations from the longer. 67 | [Note: the word "oscillation" is used here to indicate 68 | any repeating fluctuation in the timeseries, regardless of whether 69 | the fluctuation repeats on a regular basis or not. In our example the 70 | El Niño is definitely an aperiodic (irregular) signal.] 71 |

72 |       The simplest method for analyzing non-stationarity 73 | of a timeseries would be to compute statistics such as the 74 | mean and variance 75 | for different time periods and see if they are significantly different. 76 | In Figure 1 we have also plotted the running 15-year variance, as 77 | a measure of total power inherent in the signal versus time. 78 | One can see that ENSO had more variance during 1880-1920 79 | and also since 1950, 80 | with a relatively quiet period during 1920-1950. 81 |

82 | 83 |       While the running variance tells 84 | us what the overall strength of the 85 | signal was at certain times, it suffers from two major defects: 86 | 87 |

    88 |
  1. [Time Localization] 89 | The shape of the curve is highly dependent on the length of 90 | the window used. Fifteen years was chosen above as a compromise between 91 | either too-much smoothness (say using a 30-year window), 92 | or too-little (a 5-year window). An ideal method would allow different 93 | window sizes depending on the scales that one is interested in. 94 |

    95 | 96 |

  2. [Frequency Localization] 97 | The running variance contains no information on the frequency 98 | of a periodic signal, 99 | only its amplitude (and that only if the window is chosen widely). 100 |
101 | 102 |       One possibility would be to do a windowed (or 103 | running) Fourier transform (WFT), using a certain window size and 104 | sliding it along in time, computing the FFT at each time using only 105 | the data within the window. This would solve the second problem 106 | (frequency localization), but would still be dependent on the window 107 | size used. The main problem with the WFT is the inconsistent treatment 108 | of different frequencies: at low frequencies there so few oscillations 109 | within the window that the frequency localization is lost, while at 110 | high frequencies there are so many oscillations that the time 111 | localization is lost. Finally, the WFT relies on the assumption that 112 | the signal can be decomposed into sinusoidal components. 113 |

114 | 115 |       Wavelet analysis attempts to solve these problems by 116 | decomposing a timeseries into time/frequency space simultaneously. 117 | One gets information on both the amplitude of any "periodic" signals 118 | within the series, and how this amplitude varies with time. 119 |

120 | 121 | 122 |

123 |

124 | -- on to Wavelets 2 -- 125 |

126 |
127 | 128 |
129 | back to Wavelet Home Page 130 | 131 | 132 | 133 | 134 | 135 | -------------------------------------------------------------------------------- /wave_idl/sst_nino3.dat: -------------------------------------------------------------------------------- 1 | -0.15 2 | -0.30 3 | -0.14 4 | -0.41 5 | -0.46 6 | -0.66 7 | -0.50 8 | -0.80 9 | -0.95 10 | -0.72 11 | -0.31 12 | -0.71 13 | -1.04 14 | -0.77 15 | -0.86 16 | -0.84 17 | -0.41 18 | -0.49 19 | -0.48 20 | -0.72 21 | -1.21 22 | -0.80 23 | 0.16 24 | 0.46 25 | 0.40 26 | 1.00 27 | 2.17 28 | 2.50 29 | 2.34 30 | 0.80 31 | 0.14 32 | -0.06 33 | -0.34 34 | -0.71 35 | -0.34 36 | -0.73 37 | -0.48 38 | -0.11 39 | 0.22 40 | 0.51 41 | 0.51 42 | 0.25 43 | -0.10 44 | -0.33 45 | -0.42 46 | -0.23 47 | -0.53 48 | -0.44 49 | -0.30 50 | 0.15 51 | 0.09 52 | 0.19 53 | -0.06 54 | 0.25 55 | 0.30 56 | 0.81 57 | 0.26 58 | 0.10 59 | 0.34 60 | 1.01 61 | -0.31 62 | -0.90 63 | -0.73 64 | -0.92 65 | -0.73 66 | -0.31 67 | -0.03 68 | 0.12 69 | 0.37 70 | 0.82 71 | 1.22 72 | 1.83 73 | 1.60 74 | 0.34 75 | -0.72 76 | -0.87 77 | -0.85 78 | -0.40 79 | -0.39 80 | -0.65 81 | 0.07 82 | 0.67 83 | 0.39 84 | 0.03 85 | -0.17 86 | -0.76 87 | -0.87 88 | -1.36 89 | -1.10 90 | -0.99 91 | -0.78 92 | -0.93 93 | -0.87 94 | -0.44 95 | -0.34 96 | -0.50 97 | -0.39 98 | -0.04 99 | 0.42 100 | 0.62 101 | 0.17 102 | 0.23 103 | 1.03 104 | 1.54 105 | 1.09 106 | 0.01 107 | 0.12 108 | -0.27 109 | -0.47 110 | -0.41 111 | -0.37 112 | -0.36 113 | -0.39 114 | 0.43 115 | 1.05 116 | 1.58 117 | 1.25 118 | 0.86 119 | 0.60 120 | 0.21 121 | 0.19 122 | -0.23 123 | -0.29 124 | 0.18 125 | 0.12 126 | 0.71 127 | 1.42 128 | 1.59 129 | 0.93 130 | -0.25 131 | -0.66 132 | -0.95 133 | -0.47 134 | 0.06 135 | 0.70 136 | 0.81 137 | 0.78 138 | 1.43 139 | 1.22 140 | 1.05 141 | 0.44 142 | -0.35 143 | -0.67 144 | -0.84 145 | -0.66 146 | -0.45 147 | -0.12 148 | -0.20 149 | -0.16 150 | -0.47 151 | -0.52 152 | -0.79 153 | -0.80 154 | -0.62 155 | -0.86 156 | -1.29 157 | -1.04 158 | -1.05 159 | -0.75 160 | -0.81 161 | -0.90 162 | -0.25 163 | 0.62 164 | 1.22 165 | 0.96 166 | 0.21 167 | -0.11 168 | -0.25 169 | -0.24 170 | -0.43 171 | 0.23 172 | 0.67 173 | 0.78 174 | 0.41 175 | 0.98 176 | 1.28 177 | 1.45 178 | 1.02 179 | 0.03 180 | -0.59 181 | -1.34 182 | -0.99 183 | -1.49 184 | -1.74 185 | -1.33 186 | -0.55 187 | -0.51 188 | -0.36 189 | -0.99 190 | 0.32 191 | 1.04 192 | 1.41 193 | 0.99 194 | 0.66 195 | 0.50 196 | 0.22 197 | 0.71 198 | -0.16 199 | 0.38 200 | 0.00 201 | -1.11 202 | -1.04 203 | 0.05 204 | -0.64 205 | -0.34 206 | -0.50 207 | -1.85 208 | -0.94 209 | -0.78 210 | 0.29 211 | 0.27 212 | 0.69 213 | -0.06 214 | -0.83 215 | -0.80 216 | -1.02 217 | -0.96 218 | -0.09 219 | 0.62 220 | 0.87 221 | 1.03 222 | 0.70 223 | -0.10 224 | -0.31 225 | 0.04 226 | -0.46 227 | 0.04 228 | 0.24 229 | -0.08 230 | -0.28 231 | 0.06 232 | 0.05 233 | -0.31 234 | 0.11 235 | 0.27 236 | 0.26 237 | 0.04 238 | 0.12 239 | 1.11 240 | 1.53 241 | 1.23 242 | 0.17 243 | -0.18 244 | -0.56 245 | 0.05 246 | 0.41 247 | 0.22 248 | 0.04 249 | -0.19 250 | -0.46 251 | -0.65 252 | -1.06 253 | -0.54 254 | 0.14 255 | 0.25 256 | -0.21 257 | -0.73 258 | -0.43 259 | 0.48 260 | 0.26 261 | 0.05 262 | 0.11 263 | -0.27 264 | -0.08 265 | -0.10 266 | 0.29 267 | -0.15 268 | -0.28 269 | -0.55 270 | -0.44 271 | -1.40 272 | -0.55 273 | -0.69 274 | 0.58 275 | 0.37 276 | 0.42 277 | 1.83 278 | 1.23 279 | 0.65 280 | 0.41 281 | 1.03 282 | 0.64 283 | -0.07 284 | 0.98 285 | 0.36 286 | -0.30 287 | -1.33 288 | -1.39 289 | -0.94 290 | 0.34 291 | -0.00 292 | -0.15 293 | 0.06 294 | 0.39 295 | 0.36 296 | -0.49 297 | -0.53 298 | 0.35 299 | 0.07 300 | -0.24 301 | 0.20 302 | -0.22 303 | -0.68 304 | -0.44 305 | 0.02 306 | -0.22 307 | -0.30 308 | -0.59 309 | 0.10 310 | -0.02 311 | -0.27 312 | -0.60 313 | -0.48 314 | -0.37 315 | -0.53 316 | -1.35 317 | -1.22 318 | -0.99 319 | -0.34 320 | -0.79 321 | -0.24 322 | 0.02 323 | 0.69 324 | 0.78 325 | 0.17 326 | -0.17 327 | -0.29 328 | -0.27 329 | 0.31 330 | 0.44 331 | 0.38 332 | 0.24 333 | -0.13 334 | -0.89 335 | -0.76 336 | -0.71 337 | -0.37 338 | -0.59 339 | -0.63 340 | -1.47 341 | -0.40 342 | -0.18 343 | -0.37 344 | -0.43 345 | -0.06 346 | 0.61 347 | 1.33 348 | 1.19 349 | 1.13 350 | 0.31 351 | 0.14 352 | 0.03 353 | 0.21 354 | 0.15 355 | -0.22 356 | -0.02 357 | 0.03 358 | -0.17 359 | 0.12 360 | -0.35 361 | -0.06 362 | 0.38 363 | -0.45 364 | -0.32 365 | -0.33 366 | -0.49 367 | -0.14 368 | -0.56 369 | -0.18 370 | 0.46 371 | 1.09 372 | 1.04 373 | 0.23 374 | -0.99 375 | -0.59 376 | -0.92 377 | -0.28 378 | 0.52 379 | 1.31 380 | 1.45 381 | 0.61 382 | -0.11 383 | -0.18 384 | -0.39 385 | -0.39 386 | -0.36 387 | -0.50 388 | -0.81 389 | -1.10 390 | -0.29 391 | 0.57 392 | 0.68 393 | 0.78 394 | 0.78 395 | 0.63 396 | 0.98 397 | 0.49 398 | -0.42 399 | -1.34 400 | -1.20 401 | -1.18 402 | -0.65 403 | -0.42 404 | -0.97 405 | -0.28 406 | 0.77 407 | 1.77 408 | 2.22 409 | 1.05 410 | -0.67 411 | -0.99 412 | -1.52 413 | -1.17 414 | -0.22 415 | -0.04 416 | -0.45 417 | -0.46 418 | -0.75 419 | -0.70 420 | -1.38 421 | -1.15 422 | -0.01 423 | 0.97 424 | 1.10 425 | 0.68 426 | -0.02 427 | -0.04 428 | 0.47 429 | 0.30 430 | -0.55 431 | -0.51 432 | -0.09 433 | -0.01 434 | 0.34 435 | 0.61 436 | 0.58 437 | 0.33 438 | 0.38 439 | 0.10 440 | 0.18 441 | -0.30 442 | -0.06 443 | -0.28 444 | 0.12 445 | 0.58 446 | 0.89 447 | 0.93 448 | 2.39 449 | 2.44 450 | 1.92 451 | 0.64 452 | -0.24 453 | 0.27 454 | -0.13 455 | -0.16 456 | -0.54 457 | -0.13 458 | -0.37 459 | -0.78 460 | -0.22 461 | 0.03 462 | 0.25 463 | 0.31 464 | 1.03 465 | 1.10 466 | 1.05 467 | 1.11 468 | 1.28 469 | 0.57 470 | -0.55 471 | -1.16 472 | -0.99 473 | -0.38 474 | 0.01 475 | -0.29 476 | 0.09 477 | 0.46 478 | 0.57 479 | 0.24 480 | 0.39 481 | 0.49 482 | 0.86 483 | 0.51 484 | 0.95 485 | 1.25 486 | 1.33 487 | -0.00 488 | 0.34 489 | 0.66 490 | 1.11 491 | 0.34 492 | 0.48 493 | 0.56 494 | 0.39 495 | -0.17 496 | 1.04 497 | 0.77 498 | 0.12 499 | -0.35 500 | -0.22 501 | 0.08 502 | -0.08 503 | -0.18 504 | -0.06 505 | -------------------------------------------------------------------------------- /wave_fortran/sst_nino3.dat: -------------------------------------------------------------------------------- 1 | -0.15 2 | -0.30 3 | -0.14 4 | -0.41 5 | -0.46 6 | -0.66 7 | -0.50 8 | -0.80 9 | -0.95 10 | -0.72 11 | -0.31 12 | -0.71 13 | -1.04 14 | -0.77 15 | -0.86 16 | -0.84 17 | -0.41 18 | -0.49 19 | -0.48 20 | -0.72 21 | -1.21 22 | -0.80 23 | 0.16 24 | 0.46 25 | 0.40 26 | 1.00 27 | 2.17 28 | 2.50 29 | 2.34 30 | 0.80 31 | 0.14 32 | -0.06 33 | -0.34 34 | -0.71 35 | -0.34 36 | -0.73 37 | -0.48 38 | -0.11 39 | 0.22 40 | 0.51 41 | 0.51 42 | 0.25 43 | -0.10 44 | -0.33 45 | -0.42 46 | -0.23 47 | -0.53 48 | -0.44 49 | -0.30 50 | 0.15 51 | 0.09 52 | 0.19 53 | -0.06 54 | 0.25 55 | 0.30 56 | 0.81 57 | 0.26 58 | 0.10 59 | 0.34 60 | 1.01 61 | -0.31 62 | -0.90 63 | -0.73 64 | -0.92 65 | -0.73 66 | -0.31 67 | -0.03 68 | 0.12 69 | 0.37 70 | 0.82 71 | 1.22 72 | 1.83 73 | 1.60 74 | 0.34 75 | -0.72 76 | -0.87 77 | -0.85 78 | -0.40 79 | -0.39 80 | -0.65 81 | 0.07 82 | 0.67 83 | 0.39 84 | 0.03 85 | -0.17 86 | -0.76 87 | -0.87 88 | -1.36 89 | -1.10 90 | -0.99 91 | -0.78 92 | -0.93 93 | -0.87 94 | -0.44 95 | -0.34 96 | -0.50 97 | -0.39 98 | -0.04 99 | 0.42 100 | 0.62 101 | 0.17 102 | 0.23 103 | 1.03 104 | 1.54 105 | 1.09 106 | 0.01 107 | 0.12 108 | -0.27 109 | -0.47 110 | -0.41 111 | -0.37 112 | -0.36 113 | -0.39 114 | 0.43 115 | 1.05 116 | 1.58 117 | 1.25 118 | 0.86 119 | 0.60 120 | 0.21 121 | 0.19 122 | -0.23 123 | -0.29 124 | 0.18 125 | 0.12 126 | 0.71 127 | 1.42 128 | 1.59 129 | 0.93 130 | -0.25 131 | -0.66 132 | -0.95 133 | -0.47 134 | 0.06 135 | 0.70 136 | 0.81 137 | 0.78 138 | 1.43 139 | 1.22 140 | 1.05 141 | 0.44 142 | -0.35 143 | -0.67 144 | -0.84 145 | -0.66 146 | -0.45 147 | -0.12 148 | -0.20 149 | -0.16 150 | -0.47 151 | -0.52 152 | -0.79 153 | -0.80 154 | -0.62 155 | -0.86 156 | -1.29 157 | -1.04 158 | -1.05 159 | -0.75 160 | -0.81 161 | -0.90 162 | -0.25 163 | 0.62 164 | 1.22 165 | 0.96 166 | 0.21 167 | -0.11 168 | -0.25 169 | -0.24 170 | -0.43 171 | 0.23 172 | 0.67 173 | 0.78 174 | 0.41 175 | 0.98 176 | 1.28 177 | 1.45 178 | 1.02 179 | 0.03 180 | -0.59 181 | -1.34 182 | -0.99 183 | -1.49 184 | -1.74 185 | -1.33 186 | -0.55 187 | -0.51 188 | -0.36 189 | -0.99 190 | 0.32 191 | 1.04 192 | 1.41 193 | 0.99 194 | 0.66 195 | 0.50 196 | 0.22 197 | 0.71 198 | -0.16 199 | 0.38 200 | 0.00 201 | -1.11 202 | -1.04 203 | 0.05 204 | -0.64 205 | -0.34 206 | -0.50 207 | -1.85 208 | -0.94 209 | -0.78 210 | 0.29 211 | 0.27 212 | 0.69 213 | -0.06 214 | -0.83 215 | -0.80 216 | -1.02 217 | -0.96 218 | -0.09 219 | 0.62 220 | 0.87 221 | 1.03 222 | 0.70 223 | -0.10 224 | -0.31 225 | 0.04 226 | -0.46 227 | 0.04 228 | 0.24 229 | -0.08 230 | -0.28 231 | 0.06 232 | 0.05 233 | -0.31 234 | 0.11 235 | 0.27 236 | 0.26 237 | 0.04 238 | 0.12 239 | 1.11 240 | 1.53 241 | 1.23 242 | 0.17 243 | -0.18 244 | -0.56 245 | 0.05 246 | 0.41 247 | 0.22 248 | 0.04 249 | -0.19 250 | -0.46 251 | -0.65 252 | -1.06 253 | -0.54 254 | 0.14 255 | 0.25 256 | -0.21 257 | -0.73 258 | -0.43 259 | 0.48 260 | 0.26 261 | 0.05 262 | 0.11 263 | -0.27 264 | -0.08 265 | -0.10 266 | 0.29 267 | -0.15 268 | -0.28 269 | -0.55 270 | -0.44 271 | -1.40 272 | -0.55 273 | -0.69 274 | 0.58 275 | 0.37 276 | 0.42 277 | 1.83 278 | 1.23 279 | 0.65 280 | 0.41 281 | 1.03 282 | 0.64 283 | -0.07 284 | 0.98 285 | 0.36 286 | -0.30 287 | -1.33 288 | -1.39 289 | -0.94 290 | 0.34 291 | -0.00 292 | -0.15 293 | 0.06 294 | 0.39 295 | 0.36 296 | -0.49 297 | -0.53 298 | 0.35 299 | 0.07 300 | -0.24 301 | 0.20 302 | -0.22 303 | -0.68 304 | -0.44 305 | 0.02 306 | -0.22 307 | -0.30 308 | -0.59 309 | 0.10 310 | -0.02 311 | -0.27 312 | -0.60 313 | -0.48 314 | -0.37 315 | -0.53 316 | -1.35 317 | -1.22 318 | -0.99 319 | -0.34 320 | -0.79 321 | -0.24 322 | 0.02 323 | 0.69 324 | 0.78 325 | 0.17 326 | -0.17 327 | -0.29 328 | -0.27 329 | 0.31 330 | 0.44 331 | 0.38 332 | 0.24 333 | -0.13 334 | -0.89 335 | -0.76 336 | -0.71 337 | -0.37 338 | -0.59 339 | -0.63 340 | -1.47 341 | -0.40 342 | -0.18 343 | -0.37 344 | -0.43 345 | -0.06 346 | 0.61 347 | 1.33 348 | 1.19 349 | 1.13 350 | 0.31 351 | 0.14 352 | 0.03 353 | 0.21 354 | 0.15 355 | -0.22 356 | -0.02 357 | 0.03 358 | -0.17 359 | 0.12 360 | -0.35 361 | -0.06 362 | 0.38 363 | -0.45 364 | -0.32 365 | -0.33 366 | -0.49 367 | -0.14 368 | -0.56 369 | -0.18 370 | 0.46 371 | 1.09 372 | 1.04 373 | 0.23 374 | -0.99 375 | -0.59 376 | -0.92 377 | -0.28 378 | 0.52 379 | 1.31 380 | 1.45 381 | 0.61 382 | -0.11 383 | -0.18 384 | -0.39 385 | -0.39 386 | -0.36 387 | -0.50 388 | -0.81 389 | -1.10 390 | -0.29 391 | 0.57 392 | 0.68 393 | 0.78 394 | 0.78 395 | 0.63 396 | 0.98 397 | 0.49 398 | -0.42 399 | -1.34 400 | -1.20 401 | -1.18 402 | -0.65 403 | -0.42 404 | -0.97 405 | -0.28 406 | 0.77 407 | 1.77 408 | 2.22 409 | 1.05 410 | -0.67 411 | -0.99 412 | -1.52 413 | -1.17 414 | -0.22 415 | -0.04 416 | -0.45 417 | -0.46 418 | -0.75 419 | -0.70 420 | -1.38 421 | -1.15 422 | -0.01 423 | 0.97 424 | 1.10 425 | 0.68 426 | -0.02 427 | -0.04 428 | 0.47 429 | 0.30 430 | -0.55 431 | -0.51 432 | -0.09 433 | -0.01 434 | 0.34 435 | 0.61 436 | 0.58 437 | 0.33 438 | 0.38 439 | 0.10 440 | 0.18 441 | -0.30 442 | -0.06 443 | -0.28 444 | 0.12 445 | 0.58 446 | 0.89 447 | 0.93 448 | 2.39 449 | 2.44 450 | 1.92 451 | 0.64 452 | -0.24 453 | 0.27 454 | -0.13 455 | -0.16 456 | -0.54 457 | -0.13 458 | -0.37 459 | -0.78 460 | -0.22 461 | 0.03 462 | 0.25 463 | 0.31 464 | 1.03 465 | 1.10 466 | 1.05 467 | 1.11 468 | 1.28 469 | 0.57 470 | -0.55 471 | -1.16 472 | -0.99 473 | -0.38 474 | 0.01 475 | -0.29 476 | 0.09 477 | 0.46 478 | 0.57 479 | 0.24 480 | 0.39 481 | 0.49 482 | 0.86 483 | 0.51 484 | 0.95 485 | 1.25 486 | 1.33 487 | -0.00 488 | 0.34 489 | 0.66 490 | 1.11 491 | 0.34 492 | 0.48 493 | 0.56 494 | 0.39 495 | -0.17 496 | 1.04 497 | 0.77 498 | 0.12 499 | -0.35 500 | -0.22 501 | 0.08 502 | -0.08 503 | -0.18 504 | -0.06 505 | -------------------------------------------------------------------------------- /wave_matlab/sst_nino3.dat: -------------------------------------------------------------------------------- 1 | -0.15 2 | -0.30 3 | -0.14 4 | -0.41 5 | -0.46 6 | -0.66 7 | -0.50 8 | -0.80 9 | -0.95 10 | -0.72 11 | -0.31 12 | -0.71 13 | -1.04 14 | -0.77 15 | -0.86 16 | -0.84 17 | -0.41 18 | -0.49 19 | -0.48 20 | -0.72 21 | -1.21 22 | -0.80 23 | 0.16 24 | 0.46 25 | 0.40 26 | 1.00 27 | 2.17 28 | 2.50 29 | 2.34 30 | 0.80 31 | 0.14 32 | -0.06 33 | -0.34 34 | -0.71 35 | -0.34 36 | -0.73 37 | -0.48 38 | -0.11 39 | 0.22 40 | 0.51 41 | 0.51 42 | 0.25 43 | -0.10 44 | -0.33 45 | -0.42 46 | -0.23 47 | -0.53 48 | -0.44 49 | -0.30 50 | 0.15 51 | 0.09 52 | 0.19 53 | -0.06 54 | 0.25 55 | 0.30 56 | 0.81 57 | 0.26 58 | 0.10 59 | 0.34 60 | 1.01 61 | -0.31 62 | -0.90 63 | -0.73 64 | -0.92 65 | -0.73 66 | -0.31 67 | -0.03 68 | 0.12 69 | 0.37 70 | 0.82 71 | 1.22 72 | 1.83 73 | 1.60 74 | 0.34 75 | -0.72 76 | -0.87 77 | -0.85 78 | -0.40 79 | -0.39 80 | -0.65 81 | 0.07 82 | 0.67 83 | 0.39 84 | 0.03 85 | -0.17 86 | -0.76 87 | -0.87 88 | -1.36 89 | -1.10 90 | -0.99 91 | -0.78 92 | -0.93 93 | -0.87 94 | -0.44 95 | -0.34 96 | -0.50 97 | -0.39 98 | -0.04 99 | 0.42 100 | 0.62 101 | 0.17 102 | 0.23 103 | 1.03 104 | 1.54 105 | 1.09 106 | 0.01 107 | 0.12 108 | -0.27 109 | -0.47 110 | -0.41 111 | -0.37 112 | -0.36 113 | -0.39 114 | 0.43 115 | 1.05 116 | 1.58 117 | 1.25 118 | 0.86 119 | 0.60 120 | 0.21 121 | 0.19 122 | -0.23 123 | -0.29 124 | 0.18 125 | 0.12 126 | 0.71 127 | 1.42 128 | 1.59 129 | 0.93 130 | -0.25 131 | -0.66 132 | -0.95 133 | -0.47 134 | 0.06 135 | 0.70 136 | 0.81 137 | 0.78 138 | 1.43 139 | 1.22 140 | 1.05 141 | 0.44 142 | -0.35 143 | -0.67 144 | -0.84 145 | -0.66 146 | -0.45 147 | -0.12 148 | -0.20 149 | -0.16 150 | -0.47 151 | -0.52 152 | -0.79 153 | -0.80 154 | -0.62 155 | -0.86 156 | -1.29 157 | -1.04 158 | -1.05 159 | -0.75 160 | -0.81 161 | -0.90 162 | -0.25 163 | 0.62 164 | 1.22 165 | 0.96 166 | 0.21 167 | -0.11 168 | -0.25 169 | -0.24 170 | -0.43 171 | 0.23 172 | 0.67 173 | 0.78 174 | 0.41 175 | 0.98 176 | 1.28 177 | 1.45 178 | 1.02 179 | 0.03 180 | -0.59 181 | -1.34 182 | -0.99 183 | -1.49 184 | -1.74 185 | -1.33 186 | -0.55 187 | -0.51 188 | -0.36 189 | -0.99 190 | 0.32 191 | 1.04 192 | 1.41 193 | 0.99 194 | 0.66 195 | 0.50 196 | 0.22 197 | 0.71 198 | -0.16 199 | 0.38 200 | 0.00 201 | -1.11 202 | -1.04 203 | 0.05 204 | -0.64 205 | -0.34 206 | -0.50 207 | -1.85 208 | -0.94 209 | -0.78 210 | 0.29 211 | 0.27 212 | 0.69 213 | -0.06 214 | -0.83 215 | -0.80 216 | -1.02 217 | -0.96 218 | -0.09 219 | 0.62 220 | 0.87 221 | 1.03 222 | 0.70 223 | -0.10 224 | -0.31 225 | 0.04 226 | -0.46 227 | 0.04 228 | 0.24 229 | -0.08 230 | -0.28 231 | 0.06 232 | 0.05 233 | -0.31 234 | 0.11 235 | 0.27 236 | 0.26 237 | 0.04 238 | 0.12 239 | 1.11 240 | 1.53 241 | 1.23 242 | 0.17 243 | -0.18 244 | -0.56 245 | 0.05 246 | 0.41 247 | 0.22 248 | 0.04 249 | -0.19 250 | -0.46 251 | -0.65 252 | -1.06 253 | -0.54 254 | 0.14 255 | 0.25 256 | -0.21 257 | -0.73 258 | -0.43 259 | 0.48 260 | 0.26 261 | 0.05 262 | 0.11 263 | -0.27 264 | -0.08 265 | -0.10 266 | 0.29 267 | -0.15 268 | -0.28 269 | -0.55 270 | -0.44 271 | -1.40 272 | -0.55 273 | -0.69 274 | 0.58 275 | 0.37 276 | 0.42 277 | 1.83 278 | 1.23 279 | 0.65 280 | 0.41 281 | 1.03 282 | 0.64 283 | -0.07 284 | 0.98 285 | 0.36 286 | -0.30 287 | -1.33 288 | -1.39 289 | -0.94 290 | 0.34 291 | -0.00 292 | -0.15 293 | 0.06 294 | 0.39 295 | 0.36 296 | -0.49 297 | -0.53 298 | 0.35 299 | 0.07 300 | -0.24 301 | 0.20 302 | -0.22 303 | -0.68 304 | -0.44 305 | 0.02 306 | -0.22 307 | -0.30 308 | -0.59 309 | 0.10 310 | -0.02 311 | -0.27 312 | -0.60 313 | -0.48 314 | -0.37 315 | -0.53 316 | -1.35 317 | -1.22 318 | -0.99 319 | -0.34 320 | -0.79 321 | -0.24 322 | 0.02 323 | 0.69 324 | 0.78 325 | 0.17 326 | -0.17 327 | -0.29 328 | -0.27 329 | 0.31 330 | 0.44 331 | 0.38 332 | 0.24 333 | -0.13 334 | -0.89 335 | -0.76 336 | -0.71 337 | -0.37 338 | -0.59 339 | -0.63 340 | -1.47 341 | -0.40 342 | -0.18 343 | -0.37 344 | -0.43 345 | -0.06 346 | 0.61 347 | 1.33 348 | 1.19 349 | 1.13 350 | 0.31 351 | 0.14 352 | 0.03 353 | 0.21 354 | 0.15 355 | -0.22 356 | -0.02 357 | 0.03 358 | -0.17 359 | 0.12 360 | -0.35 361 | -0.06 362 | 0.38 363 | -0.45 364 | -0.32 365 | -0.33 366 | -0.49 367 | -0.14 368 | -0.56 369 | -0.18 370 | 0.46 371 | 1.09 372 | 1.04 373 | 0.23 374 | -0.99 375 | -0.59 376 | -0.92 377 | -0.28 378 | 0.52 379 | 1.31 380 | 1.45 381 | 0.61 382 | -0.11 383 | -0.18 384 | -0.39 385 | -0.39 386 | -0.36 387 | -0.50 388 | -0.81 389 | -1.10 390 | -0.29 391 | 0.57 392 | 0.68 393 | 0.78 394 | 0.78 395 | 0.63 396 | 0.98 397 | 0.49 398 | -0.42 399 | -1.34 400 | -1.20 401 | -1.18 402 | -0.65 403 | -0.42 404 | -0.97 405 | -0.28 406 | 0.77 407 | 1.77 408 | 2.22 409 | 1.05 410 | -0.67 411 | -0.99 412 | -1.52 413 | -1.17 414 | -0.22 415 | -0.04 416 | -0.45 417 | -0.46 418 | -0.75 419 | -0.70 420 | -1.38 421 | -1.15 422 | -0.01 423 | 0.97 424 | 1.10 425 | 0.68 426 | -0.02 427 | -0.04 428 | 0.47 429 | 0.30 430 | -0.55 431 | -0.51 432 | -0.09 433 | -0.01 434 | 0.34 435 | 0.61 436 | 0.58 437 | 0.33 438 | 0.38 439 | 0.10 440 | 0.18 441 | -0.30 442 | -0.06 443 | -0.28 444 | 0.12 445 | 0.58 446 | 0.89 447 | 0.93 448 | 2.39 449 | 2.44 450 | 1.92 451 | 0.64 452 | -0.24 453 | 0.27 454 | -0.13 455 | -0.16 456 | -0.54 457 | -0.13 458 | -0.37 459 | -0.78 460 | -0.22 461 | 0.03 462 | 0.25 463 | 0.31 464 | 1.03 465 | 1.10 466 | 1.05 467 | 1.11 468 | 1.28 469 | 0.57 470 | -0.55 471 | -1.16 472 | -0.99 473 | -0.38 474 | 0.01 475 | -0.29 476 | 0.09 477 | 0.46 478 | 0.57 479 | 0.24 480 | 0.39 481 | 0.49 482 | 0.86 483 | 0.51 484 | 0.95 485 | 1.25 486 | 1.33 487 | -0.00 488 | 0.34 489 | 0.66 490 | 1.11 491 | 0.34 492 | 0.48 493 | 0.56 494 | 0.39 495 | -0.17 496 | 1.04 497 | 0.77 498 | 0.12 499 | -0.35 500 | -0.22 501 | 0.08 502 | -0.08 503 | -0.18 504 | -0.06 505 | -------------------------------------------------------------------------------- /wave_python/sst_nino3.dat: -------------------------------------------------------------------------------- 1 | -0.15 2 | -0.30 3 | -0.14 4 | -0.41 5 | -0.46 6 | -0.66 7 | -0.50 8 | -0.80 9 | -0.95 10 | -0.72 11 | -0.31 12 | -0.71 13 | -1.04 14 | -0.77 15 | -0.86 16 | -0.84 17 | -0.41 18 | -0.49 19 | -0.48 20 | -0.72 21 | -1.21 22 | -0.80 23 | 0.16 24 | 0.46 25 | 0.40 26 | 1.00 27 | 2.17 28 | 2.50 29 | 2.34 30 | 0.80 31 | 0.14 32 | -0.06 33 | -0.34 34 | -0.71 35 | -0.34 36 | -0.73 37 | -0.48 38 | -0.11 39 | 0.22 40 | 0.51 41 | 0.51 42 | 0.25 43 | -0.10 44 | -0.33 45 | -0.42 46 | -0.23 47 | -0.53 48 | -0.44 49 | -0.30 50 | 0.15 51 | 0.09 52 | 0.19 53 | -0.06 54 | 0.25 55 | 0.30 56 | 0.81 57 | 0.26 58 | 0.10 59 | 0.34 60 | 1.01 61 | -0.31 62 | -0.90 63 | -0.73 64 | -0.92 65 | -0.73 66 | -0.31 67 | -0.03 68 | 0.12 69 | 0.37 70 | 0.82 71 | 1.22 72 | 1.83 73 | 1.60 74 | 0.34 75 | -0.72 76 | -0.87 77 | -0.85 78 | -0.40 79 | -0.39 80 | -0.65 81 | 0.07 82 | 0.67 83 | 0.39 84 | 0.03 85 | -0.17 86 | -0.76 87 | -0.87 88 | -1.36 89 | -1.10 90 | -0.99 91 | -0.78 92 | -0.93 93 | -0.87 94 | -0.44 95 | -0.34 96 | -0.50 97 | -0.39 98 | -0.04 99 | 0.42 100 | 0.62 101 | 0.17 102 | 0.23 103 | 1.03 104 | 1.54 105 | 1.09 106 | 0.01 107 | 0.12 108 | -0.27 109 | -0.47 110 | -0.41 111 | -0.37 112 | -0.36 113 | -0.39 114 | 0.43 115 | 1.05 116 | 1.58 117 | 1.25 118 | 0.86 119 | 0.60 120 | 0.21 121 | 0.19 122 | -0.23 123 | -0.29 124 | 0.18 125 | 0.12 126 | 0.71 127 | 1.42 128 | 1.59 129 | 0.93 130 | -0.25 131 | -0.66 132 | -0.95 133 | -0.47 134 | 0.06 135 | 0.70 136 | 0.81 137 | 0.78 138 | 1.43 139 | 1.22 140 | 1.05 141 | 0.44 142 | -0.35 143 | -0.67 144 | -0.84 145 | -0.66 146 | -0.45 147 | -0.12 148 | -0.20 149 | -0.16 150 | -0.47 151 | -0.52 152 | -0.79 153 | -0.80 154 | -0.62 155 | -0.86 156 | -1.29 157 | -1.04 158 | -1.05 159 | -0.75 160 | -0.81 161 | -0.90 162 | -0.25 163 | 0.62 164 | 1.22 165 | 0.96 166 | 0.21 167 | -0.11 168 | -0.25 169 | -0.24 170 | -0.43 171 | 0.23 172 | 0.67 173 | 0.78 174 | 0.41 175 | 0.98 176 | 1.28 177 | 1.45 178 | 1.02 179 | 0.03 180 | -0.59 181 | -1.34 182 | -0.99 183 | -1.49 184 | -1.74 185 | -1.33 186 | -0.55 187 | -0.51 188 | -0.36 189 | -0.99 190 | 0.32 191 | 1.04 192 | 1.41 193 | 0.99 194 | 0.66 195 | 0.50 196 | 0.22 197 | 0.71 198 | -0.16 199 | 0.38 200 | 0.00 201 | -1.11 202 | -1.04 203 | 0.05 204 | -0.64 205 | -0.34 206 | -0.50 207 | -1.85 208 | -0.94 209 | -0.78 210 | 0.29 211 | 0.27 212 | 0.69 213 | -0.06 214 | -0.83 215 | -0.80 216 | -1.02 217 | -0.96 218 | -0.09 219 | 0.62 220 | 0.87 221 | 1.03 222 | 0.70 223 | -0.10 224 | -0.31 225 | 0.04 226 | -0.46 227 | 0.04 228 | 0.24 229 | -0.08 230 | -0.28 231 | 0.06 232 | 0.05 233 | -0.31 234 | 0.11 235 | 0.27 236 | 0.26 237 | 0.04 238 | 0.12 239 | 1.11 240 | 1.53 241 | 1.23 242 | 0.17 243 | -0.18 244 | -0.56 245 | 0.05 246 | 0.41 247 | 0.22 248 | 0.04 249 | -0.19 250 | -0.46 251 | -0.65 252 | -1.06 253 | -0.54 254 | 0.14 255 | 0.25 256 | -0.21 257 | -0.73 258 | -0.43 259 | 0.48 260 | 0.26 261 | 0.05 262 | 0.11 263 | -0.27 264 | -0.08 265 | -0.10 266 | 0.29 267 | -0.15 268 | -0.28 269 | -0.55 270 | -0.44 271 | -1.40 272 | -0.55 273 | -0.69 274 | 0.58 275 | 0.37 276 | 0.42 277 | 1.83 278 | 1.23 279 | 0.65 280 | 0.41 281 | 1.03 282 | 0.64 283 | -0.07 284 | 0.98 285 | 0.36 286 | -0.30 287 | -1.33 288 | -1.39 289 | -0.94 290 | 0.34 291 | -0.00 292 | -0.15 293 | 0.06 294 | 0.39 295 | 0.36 296 | -0.49 297 | -0.53 298 | 0.35 299 | 0.07 300 | -0.24 301 | 0.20 302 | -0.22 303 | -0.68 304 | -0.44 305 | 0.02 306 | -0.22 307 | -0.30 308 | -0.59 309 | 0.10 310 | -0.02 311 | -0.27 312 | -0.60 313 | -0.48 314 | -0.37 315 | -0.53 316 | -1.35 317 | -1.22 318 | -0.99 319 | -0.34 320 | -0.79 321 | -0.24 322 | 0.02 323 | 0.69 324 | 0.78 325 | 0.17 326 | -0.17 327 | -0.29 328 | -0.27 329 | 0.31 330 | 0.44 331 | 0.38 332 | 0.24 333 | -0.13 334 | -0.89 335 | -0.76 336 | -0.71 337 | -0.37 338 | -0.59 339 | -0.63 340 | -1.47 341 | -0.40 342 | -0.18 343 | -0.37 344 | -0.43 345 | -0.06 346 | 0.61 347 | 1.33 348 | 1.19 349 | 1.13 350 | 0.31 351 | 0.14 352 | 0.03 353 | 0.21 354 | 0.15 355 | -0.22 356 | -0.02 357 | 0.03 358 | -0.17 359 | 0.12 360 | -0.35 361 | -0.06 362 | 0.38 363 | -0.45 364 | -0.32 365 | -0.33 366 | -0.49 367 | -0.14 368 | -0.56 369 | -0.18 370 | 0.46 371 | 1.09 372 | 1.04 373 | 0.23 374 | -0.99 375 | -0.59 376 | -0.92 377 | -0.28 378 | 0.52 379 | 1.31 380 | 1.45 381 | 0.61 382 | -0.11 383 | -0.18 384 | -0.39 385 | -0.39 386 | -0.36 387 | -0.50 388 | -0.81 389 | -1.10 390 | -0.29 391 | 0.57 392 | 0.68 393 | 0.78 394 | 0.78 395 | 0.63 396 | 0.98 397 | 0.49 398 | -0.42 399 | -1.34 400 | -1.20 401 | -1.18 402 | -0.65 403 | -0.42 404 | -0.97 405 | -0.28 406 | 0.77 407 | 1.77 408 | 2.22 409 | 1.05 410 | -0.67 411 | -0.99 412 | -1.52 413 | -1.17 414 | -0.22 415 | -0.04 416 | -0.45 417 | -0.46 418 | -0.75 419 | -0.70 420 | -1.38 421 | -1.15 422 | -0.01 423 | 0.97 424 | 1.10 425 | 0.68 426 | -0.02 427 | -0.04 428 | 0.47 429 | 0.30 430 | -0.55 431 | -0.51 432 | -0.09 433 | -0.01 434 | 0.34 435 | 0.61 436 | 0.58 437 | 0.33 438 | 0.38 439 | 0.10 440 | 0.18 441 | -0.30 442 | -0.06 443 | -0.28 444 | 0.12 445 | 0.58 446 | 0.89 447 | 0.93 448 | 2.39 449 | 2.44 450 | 1.92 451 | 0.64 452 | -0.24 453 | 0.27 454 | -0.13 455 | -0.16 456 | -0.54 457 | -0.13 458 | -0.37 459 | -0.78 460 | -0.22 461 | 0.03 462 | 0.25 463 | 0.31 464 | 1.03 465 | 1.10 466 | 1.05 467 | 1.11 468 | 1.28 469 | 0.57 470 | -0.55 471 | -1.16 472 | -0.99 473 | -0.38 474 | 0.01 475 | -0.29 476 | 0.09 477 | 0.46 478 | 0.57 479 | 0.24 480 | 0.39 481 | 0.49 482 | 0.86 483 | 0.51 484 | 0.95 485 | 1.25 486 | 1.33 487 | -0.00 488 | 0.34 489 | 0.66 490 | 1.11 491 | 0.34 492 | 0.48 493 | 0.56 494 | 0.39 495 | -0.17 496 | 1.04 497 | 0.77 498 | 0.12 499 | -0.35 500 | -0.22 501 | 0.08 502 | -0.08 503 | -0.18 504 | -0.06 505 | -------------------------------------------------------------------------------- /wave_idl/mauna.txt: -------------------------------------------------------------------------------- 1 | $submit 2 | Submit 3 | $dataset 4 | soi 5 | $title 6 | Mauna Loa Carbon Dioxide 7 | $source 8 | Carbon Dioxide Info. Anal. Center (CDIAC) (http://cdiac.esd.ornl.gov/trends/trends.htm) 9 | $dataset1 10 | CO2 11 | $units 12 | ppm 13 | t0 14 | 1958.0 15 | dt 16 | 0.08333333 17 | $t_units 18 | years 19 | data 20 | 315.56 21 | 315.56 22 | 315.56 23 | 317.29 24 | 317.34 25 | 316.52 26 | 315.69 27 | 314.78 28 | 313.05 29 | 313.11 30 | 313.18 31 | 314.50 32 | 315.42 33 | 316.31 34 | 316.50 35 | 317.56 36 | 318.13 37 | 318.00 38 | 316.39 39 | 314.65 40 | 313.68 41 | 313.18 42 | 314.66 43 | 315.43 44 | 316.27 45 | 316.81 46 | 317.42 47 | 318.87 48 | 319.87 49 | 319.43 50 | 318.01 51 | 315.74 52 | 314.00 53 | 313.68 54 | 314.84 55 | 316.03 56 | 316.73 57 | 317.54 58 | 318.38 59 | 319.31 60 | 320.42 61 | 319.61 62 | 318.42 63 | 316.63 64 | 314.84 65 | 315.16 66 | 315.94 67 | 316.85 68 | 317.78 69 | 318.40 70 | 319.53 71 | 320.42 72 | 320.85 73 | 320.45 74 | 319.45 75 | 317.25 76 | 316.11 77 | 315.27 78 | 316.53 79 | 317.53 80 | 318.58 81 | 318.93 82 | 319.70 83 | 321.22 84 | 322.08 85 | 321.31 86 | 319.58 87 | 317.61 88 | 316.05 89 | 315.83 90 | 316.91 91 | 318.20 92 | 319.41 93 | 320.07 94 | 320.73 95 | 321.39 96 | 322.05 97 | 321.73 98 | 320.27 99 | 318.53 100 | 316.54 101 | 316.72 102 | 317.53 103 | 318.55 104 | 319.27 105 | 320.28 106 | 320.73 107 | 321.97 108 | 322.00 109 | 321.71 110 | 321.05 111 | 318.71 112 | 317.66 113 | 317.14 114 | 318.70 115 | 319.25 116 | 320.46 117 | 321.43 118 | 322.23 119 | 323.54 120 | 323.91 121 | 323.59 122 | 322.24 123 | 320.20 124 | 318.48 125 | 317.94 126 | 319.63 127 | 320.87 128 | 322.17 129 | 322.34 130 | 322.88 131 | 324.25 132 | 324.83 133 | 323.93 134 | 322.38 135 | 320.76 136 | 319.10 137 | 319.24 138 | 320.56 139 | 321.80 140 | 322.40 141 | 322.99 142 | 323.73 143 | 324.86 144 | 325.40 145 | 325.20 146 | 323.98 147 | 321.95 148 | 320.18 149 | 320.09 150 | 321.16 151 | 322.74 152 | 323.83 153 | 324.27 154 | 325.47 155 | 326.50 156 | 327.21 157 | 326.54 158 | 325.72 159 | 323.50 160 | 322.22 161 | 321.62 162 | 322.69 163 | 323.95 164 | 324.89 165 | 325.82 166 | 326.77 167 | 327.97 168 | 327.90 169 | 327.50 170 | 326.18 171 | 324.53 172 | 322.93 173 | 322.90 174 | 323.85 175 | 324.96 176 | 326.01 177 | 326.51 178 | 327.02 179 | 327.62 180 | 328.76 181 | 328.40 182 | 327.20 183 | 325.27 184 | 323.20 185 | 323.40 186 | 324.63 187 | 325.85 188 | 326.60 189 | 327.47 190 | 327.58 191 | 329.56 192 | 329.90 193 | 328.92 194 | 327.88 195 | 326.16 196 | 324.68 197 | 325.04 198 | 326.34 199 | 327.39 200 | 328.37 201 | 329.40 202 | 330.14 203 | 331.33 204 | 332.31 205 | 331.90 206 | 330.70 207 | 329.15 208 | 327.35 209 | 327.02 210 | 327.99 211 | 328.48 212 | 329.18 213 | 330.55 214 | 331.32 215 | 332.48 216 | 332.92 217 | 332.08 218 | 331.01 219 | 329.23 220 | 327.27 221 | 327.21 222 | 328.29 223 | 329.41 224 | 330.23 225 | 331.25 226 | 331.87 227 | 333.14 228 | 333.80 229 | 333.43 230 | 331.73 231 | 329.90 232 | 328.40 233 | 328.17 234 | 329.32 235 | 330.59 236 | 331.58 237 | 332.39 238 | 333.33 239 | 334.41 240 | 334.71 241 | 334.17 242 | 332.89 243 | 330.77 244 | 329.14 245 | 328.78 246 | 330.14 247 | 331.52 248 | 332.75 249 | 333.24 250 | 334.53 251 | 335.90 252 | 336.57 253 | 336.10 254 | 334.76 255 | 332.59 256 | 331.42 257 | 330.98 258 | 332.24 259 | 333.68 260 | 334.80 261 | 335.22 262 | 336.47 263 | 337.59 264 | 337.84 265 | 337.72 266 | 336.37 267 | 334.51 268 | 332.60 269 | 332.38 270 | 333.75 271 | 334.78 272 | 336.05 273 | 336.59 274 | 337.79 275 | 338.71 276 | 339.30 277 | 339.12 278 | 337.56 279 | 335.92 280 | 333.75 281 | 333.70 282 | 335.12 283 | 336.56 284 | 337.84 285 | 338.19 286 | 339.91 287 | 340.60 288 | 341.29 289 | 341.00 290 | 339.39 291 | 337.43 292 | 335.72 293 | 335.84 294 | 336.93 295 | 338.04 296 | 339.06 297 | 340.30 298 | 341.21 299 | 342.33 300 | 342.74 301 | 342.08 302 | 340.32 303 | 338.26 304 | 336.52 305 | 336.68 306 | 338.19 307 | 339.44 308 | 340.57 309 | 341.44 310 | 342.53 311 | 343.39 312 | 343.96 313 | 343.18 314 | 341.88 315 | 339.65 316 | 337.81 317 | 337.69 318 | 339.09 319 | 340.32 320 | 341.20 321 | 342.35 322 | 342.93 323 | 344.77 324 | 345.58 325 | 345.14 326 | 343.81 327 | 342.21 328 | 339.69 329 | 339.82 330 | 340.98 331 | 342.82 332 | 343.52 333 | 344.33 334 | 345.11 335 | 346.89 336 | 347.25 337 | 346.62 338 | 345.22 339 | 343.11 340 | 340.90 341 | 341.18 342 | 342.80 343 | 344.04 344 | 344.79 345 | 345.82 346 | 347.25 347 | 348.17 348 | 348.74 349 | 348.07 350 | 346.38 351 | 344.52 352 | 342.92 353 | 342.62 354 | 344.06 355 | 345.38 356 | 346.11 357 | 346.78 358 | 347.68 359 | 349.37 360 | 350.03 361 | 349.37 362 | 347.76 363 | 345.73 364 | 344.68 365 | 343.99 366 | 345.48 367 | 346.72 368 | 347.84 369 | 348.29 370 | 349.24 371 | 350.80 372 | 351.66 373 | 351.08 374 | 349.33 375 | 347.92 376 | 346.27 377 | 346.18 378 | 347.64 379 | 348.78 380 | 350.25 381 | 351.54 382 | 352.05 383 | 353.41 384 | 354.04 385 | 353.63 386 | 352.22 387 | 350.27 388 | 348.55 389 | 348.72 390 | 349.91 391 | 351.18 392 | 352.60 393 | 352.92 394 | 353.53 395 | 355.26 396 | 355.52 397 | 354.97 398 | 353.75 399 | 351.52 400 | 349.64 401 | 349.83 402 | 351.14 403 | 352.37 404 | 353.50 405 | 354.55 406 | 355.23 407 | 356.04 408 | 357.00 409 | 356.07 410 | 354.67 411 | 352.76 412 | 350.82 413 | 351.04 414 | 352.70 415 | 354.07 416 | 354.59 417 | 355.63 418 | 357.03 419 | 358.48 420 | 359.22 421 | 358.12 422 | 356.06 423 | 353.92 424 | 352.05 425 | 352.11 426 | 353.64 427 | 354.89 428 | 355.88 429 | 356.63 430 | 357.72 431 | 359.07 432 | 359.58 433 | 359.17 434 | 356.94 435 | 354.92 436 | 352.94 437 | 353.23 438 | 354.09 439 | 355.33 440 | 356.63 441 | 357.10 442 | 358.32 443 | 359.41 444 | 360.23 445 | 359.55 446 | 357.53 447 | 355.48 448 | 353.67 449 | 353.95 450 | 355.30 451 | 356.78 452 | 358.34 453 | 358.89 454 | 359.95 455 | 361.25 456 | 361.67 457 | 360.94 458 | 359.55 459 | 357.49 460 | 355.84 461 | 356.00 462 | 357.59 463 | 359.05 464 | 359.98 465 | 361.03 466 | 361.66 467 | 363.48 468 | 363.82 469 | 363.30 470 | 361.93 471 | 359.49 472 | 358.08 473 | 357.77 474 | 359.57 475 | 360.69 476 | -------------------------------------------------------------------------------- /webplot-do-not-use/data/mauna.dat: -------------------------------------------------------------------------------- 1 | $submit 2 | Submit 3 | $dataset 4 | soi 5 | $title 6 | Mauna Loa Carbon Dioxide 7 | $source 8 | Carbon Dioxide Info. Anal. Center (CDIAC) 9 | $dataset1 10 | CO2 11 | $units 12 | ppm 13 | t0 14 | 1958.0 15 | dt 16 | 0.08333333 17 | $t_units 18 | years 19 | data 20 | 315.56 21 | 315.56 22 | 315.56 23 | 317.29 24 | 317.34 25 | 316.52 26 | 315.69 27 | 314.78 28 | 313.05 29 | 313.11 30 | 313.18 31 | 314.50 32 | 315.42 33 | 316.31 34 | 316.50 35 | 317.56 36 | 318.13 37 | 318.00 38 | 316.39 39 | 314.65 40 | 313.68 41 | 313.18 42 | 314.66 43 | 315.43 44 | 316.27 45 | 316.81 46 | 317.42 47 | 318.87 48 | 319.87 49 | 319.43 50 | 318.01 51 | 315.74 52 | 314.00 53 | 313.68 54 | 314.84 55 | 316.03 56 | 316.73 57 | 317.54 58 | 318.38 59 | 319.31 60 | 320.42 61 | 319.61 62 | 318.42 63 | 316.63 64 | 314.84 65 | 315.16 66 | 315.94 67 | 316.85 68 | 317.78 69 | 318.40 70 | 319.53 71 | 320.42 72 | 320.85 73 | 320.45 74 | 319.45 75 | 317.25 76 | 316.11 77 | 315.27 78 | 316.53 79 | 317.53 80 | 318.58 81 | 318.93 82 | 319.70 83 | 321.22 84 | 322.08 85 | 321.31 86 | 319.58 87 | 317.61 88 | 316.05 89 | 315.83 90 | 316.91 91 | 318.20 92 | 319.41 93 | 320.07 94 | 320.73 95 | 321.39 96 | 322.05 97 | 321.73 98 | 320.27 99 | 318.53 100 | 316.54 101 | 316.72 102 | 317.53 103 | 318.55 104 | 319.27 105 | 320.28 106 | 320.73 107 | 321.97 108 | 322.00 109 | 321.71 110 | 321.05 111 | 318.71 112 | 317.66 113 | 317.14 114 | 318.70 115 | 319.25 116 | 320.46 117 | 321.43 118 | 322.23 119 | 323.54 120 | 323.91 121 | 323.59 122 | 322.24 123 | 320.20 124 | 318.48 125 | 317.94 126 | 319.63 127 | 320.87 128 | 322.17 129 | 322.34 130 | 322.88 131 | 324.25 132 | 324.83 133 | 323.93 134 | 322.38 135 | 320.76 136 | 319.10 137 | 319.24 138 | 320.56 139 | 321.80 140 | 322.40 141 | 322.99 142 | 323.73 143 | 324.86 144 | 325.40 145 | 325.20 146 | 323.98 147 | 321.95 148 | 320.18 149 | 320.09 150 | 321.16 151 | 322.74 152 | 323.83 153 | 324.27 154 | 325.47 155 | 326.50 156 | 327.21 157 | 326.54 158 | 325.72 159 | 323.50 160 | 322.22 161 | 321.62 162 | 322.69 163 | 323.95 164 | 324.89 165 | 325.82 166 | 326.77 167 | 327.97 168 | 327.90 169 | 327.50 170 | 326.18 171 | 324.53 172 | 322.93 173 | 322.90 174 | 323.85 175 | 324.96 176 | 326.01 177 | 326.51 178 | 327.02 179 | 327.62 180 | 328.76 181 | 328.40 182 | 327.20 183 | 325.27 184 | 323.20 185 | 323.40 186 | 324.63 187 | 325.85 188 | 326.60 189 | 327.47 190 | 327.58 191 | 329.56 192 | 329.90 193 | 328.92 194 | 327.88 195 | 326.16 196 | 324.68 197 | 325.04 198 | 326.34 199 | 327.39 200 | 328.37 201 | 329.40 202 | 330.14 203 | 331.33 204 | 332.31 205 | 331.90 206 | 330.70 207 | 329.15 208 | 327.35 209 | 327.02 210 | 327.99 211 | 328.48 212 | 329.18 213 | 330.55 214 | 331.32 215 | 332.48 216 | 332.92 217 | 332.08 218 | 331.01 219 | 329.23 220 | 327.27 221 | 327.21 222 | 328.29 223 | 329.41 224 | 330.23 225 | 331.25 226 | 331.87 227 | 333.14 228 | 333.80 229 | 333.43 230 | 331.73 231 | 329.90 232 | 328.40 233 | 328.17 234 | 329.32 235 | 330.59 236 | 331.58 237 | 332.39 238 | 333.33 239 | 334.41 240 | 334.71 241 | 334.17 242 | 332.89 243 | 330.77 244 | 329.14 245 | 328.78 246 | 330.14 247 | 331.52 248 | 332.75 249 | 333.24 250 | 334.53 251 | 335.90 252 | 336.57 253 | 336.10 254 | 334.76 255 | 332.59 256 | 331.42 257 | 330.98 258 | 332.24 259 | 333.68 260 | 334.80 261 | 335.22 262 | 336.47 263 | 337.59 264 | 337.84 265 | 337.72 266 | 336.37 267 | 334.51 268 | 332.60 269 | 332.38 270 | 333.75 271 | 334.78 272 | 336.05 273 | 336.59 274 | 337.79 275 | 338.71 276 | 339.30 277 | 339.12 278 | 337.56 279 | 335.92 280 | 333.75 281 | 333.70 282 | 335.12 283 | 336.56 284 | 337.84 285 | 338.19 286 | 339.91 287 | 340.60 288 | 341.29 289 | 341.00 290 | 339.39 291 | 337.43 292 | 335.72 293 | 335.84 294 | 336.93 295 | 338.04 296 | 339.06 297 | 340.30 298 | 341.21 299 | 342.33 300 | 342.74 301 | 342.08 302 | 340.32 303 | 338.26 304 | 336.52 305 | 336.68 306 | 338.19 307 | 339.44 308 | 340.57 309 | 341.44 310 | 342.53 311 | 343.39 312 | 343.96 313 | 343.18 314 | 341.88 315 | 339.65 316 | 337.81 317 | 337.69 318 | 339.09 319 | 340.32 320 | 341.20 321 | 342.35 322 | 342.93 323 | 344.77 324 | 345.58 325 | 345.14 326 | 343.81 327 | 342.21 328 | 339.69 329 | 339.82 330 | 340.98 331 | 342.82 332 | 343.52 333 | 344.33 334 | 345.11 335 | 346.89 336 | 347.25 337 | 346.62 338 | 345.22 339 | 343.11 340 | 340.90 341 | 341.18 342 | 342.80 343 | 344.04 344 | 344.79 345 | 345.82 346 | 347.25 347 | 348.17 348 | 348.74 349 | 348.07 350 | 346.38 351 | 344.52 352 | 342.92 353 | 342.62 354 | 344.06 355 | 345.38 356 | 346.11 357 | 346.78 358 | 347.68 359 | 349.37 360 | 350.03 361 | 349.37 362 | 347.76 363 | 345.73 364 | 344.68 365 | 343.99 366 | 345.48 367 | 346.72 368 | 347.84 369 | 348.29 370 | 349.24 371 | 350.80 372 | 351.66 373 | 351.08 374 | 349.33 375 | 347.92 376 | 346.27 377 | 346.18 378 | 347.64 379 | 348.78 380 | 350.25 381 | 351.54 382 | 352.05 383 | 353.41 384 | 354.04 385 | 353.63 386 | 352.22 387 | 350.27 388 | 348.55 389 | 348.72 390 | 349.91 391 | 351.18 392 | 352.60 393 | 352.92 394 | 353.53 395 | 355.26 396 | 355.52 397 | 354.97 398 | 353.75 399 | 351.52 400 | 349.64 401 | 349.83 402 | 351.14 403 | 352.37 404 | 353.50 405 | 354.55 406 | 355.23 407 | 356.04 408 | 357.00 409 | 356.07 410 | 354.67 411 | 352.76 412 | 350.82 413 | 351.04 414 | 352.70 415 | 354.07 416 | 354.59 417 | 355.63 418 | 357.03 419 | 358.48 420 | 359.22 421 | 358.12 422 | 356.06 423 | 353.92 424 | 352.05 425 | 352.11 426 | 353.64 427 | 354.89 428 | 355.88 429 | 356.63 430 | 357.72 431 | 359.07 432 | 359.58 433 | 359.17 434 | 356.94 435 | 354.92 436 | 352.94 437 | 353.23 438 | 354.09 439 | 355.33 440 | 356.63 441 | 357.10 442 | 358.32 443 | 359.41 444 | 360.23 445 | 359.55 446 | 357.53 447 | 355.48 448 | 353.67 449 | 353.95 450 | 355.30 451 | 356.78 452 | 358.34 453 | 358.89 454 | 359.95 455 | 361.25 456 | 361.67 457 | 360.94 458 | 359.55 459 | 357.49 460 | 355.84 461 | 356.00 462 | 357.59 463 | 359.05 464 | 359.98 465 | 361.03 466 | 361.66 467 | 363.48 468 | 363.82 469 | 363.30 470 | 361.93 471 | 359.49 472 | 358.08 473 | 357.77 474 | 359.57 475 | 360.69 476 | -------------------------------------------------------------------------------- /wave_idl/nino3sst.txt: -------------------------------------------------------------------------------- 1 | $submit 2 | Submit 3 | $dataset 4 | nino3sst 5 | $title 6 | NINO3 Sea Surface Temperature 7 | $source 8 | UK Meteorological Office GISST2.3 9 | $dataset1 10 | NINO3 SST 11 | $units 12 | !Uo!NC 13 | t0 14 | 1871.0 15 | dt 16 | 0.25 17 | $t_units 18 | years 19 | data 20 | -0.15 21 | -0.30 22 | -0.14 23 | -0.41 24 | -0.46 25 | -0.66 26 | -0.50 27 | -0.80 28 | -0.95 29 | -0.72 30 | -0.31 31 | -0.71 32 | -1.04 33 | -0.77 34 | -0.86 35 | -0.84 36 | -0.41 37 | -0.49 38 | -0.48 39 | -0.72 40 | -1.21 41 | -0.80 42 | 0.16 43 | 0.46 44 | 0.40 45 | 1.00 46 | 2.17 47 | 2.50 48 | 2.34 49 | 0.80 50 | 0.14 51 | -0.06 52 | -0.34 53 | -0.71 54 | -0.34 55 | -0.73 56 | -0.48 57 | -0.11 58 | 0.22 59 | 0.51 60 | 0.51 61 | 0.25 62 | -0.10 63 | -0.33 64 | -0.42 65 | -0.23 66 | -0.53 67 | -0.44 68 | -0.30 69 | 0.15 70 | 0.09 71 | 0.19 72 | -0.06 73 | 0.25 74 | 0.30 75 | 0.81 76 | 0.26 77 | 0.10 78 | 0.34 79 | 1.01 80 | -0.31 81 | -0.90 82 | -0.73 83 | -0.92 84 | -0.73 85 | -0.31 86 | -0.03 87 | 0.12 88 | 0.37 89 | 0.82 90 | 1.22 91 | 1.83 92 | 1.60 93 | 0.34 94 | -0.72 95 | -0.87 96 | -0.85 97 | -0.40 98 | -0.39 99 | -0.65 100 | 0.07 101 | 0.67 102 | 0.39 103 | 0.03 104 | -0.17 105 | -0.76 106 | -0.87 107 | -1.36 108 | -1.10 109 | -0.99 110 | -0.78 111 | -0.93 112 | -0.87 113 | -0.44 114 | -0.34 115 | -0.50 116 | -0.39 117 | -0.04 118 | 0.42 119 | 0.62 120 | 0.17 121 | 0.23 122 | 1.03 123 | 1.54 124 | 1.09 125 | 0.01 126 | 0.12 127 | -0.27 128 | -0.47 129 | -0.41 130 | -0.37 131 | -0.36 132 | -0.39 133 | 0.43 134 | 1.05 135 | 1.58 136 | 1.25 137 | 0.86 138 | 0.60 139 | 0.21 140 | 0.19 141 | -0.23 142 | -0.29 143 | 0.18 144 | 0.12 145 | 0.71 146 | 1.42 147 | 1.59 148 | 0.93 149 | -0.25 150 | -0.66 151 | -0.95 152 | -0.47 153 | 0.06 154 | 0.70 155 | 0.81 156 | 0.78 157 | 1.43 158 | 1.22 159 | 1.05 160 | 0.44 161 | -0.35 162 | -0.67 163 | -0.84 164 | -0.66 165 | -0.45 166 | -0.12 167 | -0.20 168 | -0.16 169 | -0.47 170 | -0.52 171 | -0.79 172 | -0.80 173 | -0.62 174 | -0.86 175 | -1.29 176 | -1.04 177 | -1.05 178 | -0.75 179 | -0.81 180 | -0.90 181 | -0.25 182 | 0.62 183 | 1.22 184 | 0.96 185 | 0.21 186 | -0.11 187 | -0.25 188 | -0.24 189 | -0.43 190 | 0.23 191 | 0.67 192 | 0.78 193 | 0.41 194 | 0.98 195 | 1.28 196 | 1.45 197 | 1.02 198 | 0.03 199 | -0.59 200 | -1.34 201 | -0.99 202 | -1.49 203 | -1.74 204 | -1.33 205 | -0.55 206 | -0.51 207 | -0.36 208 | -0.99 209 | 0.32 210 | 1.04 211 | 1.41 212 | 0.99 213 | 0.66 214 | 0.50 215 | 0.22 216 | 0.71 217 | -0.16 218 | 0.38 219 | 0.00 220 | -1.11 221 | -1.04 222 | 0.05 223 | -0.64 224 | -0.34 225 | -0.50 226 | -1.85 227 | -0.94 228 | -0.78 229 | 0.29 230 | 0.27 231 | 0.69 232 | -0.06 233 | -0.83 234 | -0.80 235 | -1.02 236 | -0.96 237 | -0.09 238 | 0.62 239 | 0.87 240 | 1.03 241 | 0.70 242 | -0.10 243 | -0.31 244 | 0.04 245 | -0.46 246 | 0.04 247 | 0.24 248 | -0.08 249 | -0.28 250 | 0.06 251 | 0.05 252 | -0.31 253 | 0.11 254 | 0.27 255 | 0.26 256 | 0.04 257 | 0.12 258 | 1.11 259 | 1.53 260 | 1.23 261 | 0.17 262 | -0.18 263 | -0.56 264 | 0.05 265 | 0.41 266 | 0.22 267 | 0.04 268 | -0.19 269 | -0.46 270 | -0.65 271 | -1.06 272 | -0.54 273 | 0.14 274 | 0.25 275 | -0.21 276 | -0.73 277 | -0.43 278 | 0.48 279 | 0.26 280 | 0.05 281 | 0.11 282 | -0.27 283 | -0.08 284 | -0.10 285 | 0.29 286 | -0.15 287 | -0.28 288 | -0.55 289 | -0.44 290 | -1.40 291 | -0.55 292 | -0.69 293 | 0.58 294 | 0.37 295 | 0.42 296 | 1.83 297 | 1.23 298 | 0.65 299 | 0.41 300 | 1.03 301 | 0.64 302 | -0.07 303 | 0.98 304 | 0.36 305 | -0.30 306 | -1.33 307 | -1.39 308 | -0.94 309 | 0.34 310 | -0.00 311 | -0.15 312 | 0.06 313 | 0.39 314 | 0.36 315 | -0.49 316 | -0.53 317 | 0.35 318 | 0.07 319 | -0.24 320 | 0.20 321 | -0.22 322 | -0.68 323 | -0.44 324 | 0.02 325 | -0.22 326 | -0.30 327 | -0.59 328 | 0.10 329 | -0.02 330 | -0.27 331 | -0.60 332 | -0.48 333 | -0.37 334 | -0.53 335 | -1.35 336 | -1.22 337 | -0.99 338 | -0.34 339 | -0.79 340 | -0.24 341 | 0.02 342 | 0.69 343 | 0.78 344 | 0.17 345 | -0.17 346 | -0.29 347 | -0.27 348 | 0.31 349 | 0.44 350 | 0.38 351 | 0.24 352 | -0.13 353 | -0.89 354 | -0.76 355 | -0.71 356 | -0.37 357 | -0.59 358 | -0.63 359 | -1.47 360 | -0.40 361 | -0.18 362 | -0.37 363 | -0.43 364 | -0.06 365 | 0.61 366 | 1.33 367 | 1.19 368 | 1.13 369 | 0.31 370 | 0.14 371 | 0.03 372 | 0.21 373 | 0.15 374 | -0.22 375 | -0.02 376 | 0.03 377 | -0.17 378 | 0.12 379 | -0.35 380 | -0.06 381 | 0.38 382 | -0.45 383 | -0.32 384 | -0.33 385 | -0.49 386 | -0.14 387 | -0.56 388 | -0.18 389 | 0.46 390 | 1.09 391 | 1.04 392 | 0.23 393 | -0.99 394 | -0.59 395 | -0.92 396 | -0.28 397 | 0.52 398 | 1.31 399 | 1.45 400 | 0.61 401 | -0.11 402 | -0.18 403 | -0.39 404 | -0.39 405 | -0.36 406 | -0.50 407 | -0.81 408 | -1.10 409 | -0.29 410 | 0.57 411 | 0.68 412 | 0.78 413 | 0.78 414 | 0.63 415 | 0.98 416 | 0.49 417 | -0.42 418 | -1.34 419 | -1.20 420 | -1.18 421 | -0.65 422 | -0.42 423 | -0.97 424 | -0.28 425 | 0.77 426 | 1.77 427 | 2.22 428 | 1.05 429 | -0.67 430 | -0.99 431 | -1.52 432 | -1.17 433 | -0.22 434 | -0.04 435 | -0.45 436 | -0.46 437 | -0.75 438 | -0.70 439 | -1.38 440 | -1.15 441 | -0.01 442 | 0.97 443 | 1.10 444 | 0.68 445 | -0.02 446 | -0.04 447 | 0.47 448 | 0.30 449 | -0.55 450 | -0.51 451 | -0.09 452 | -0.01 453 | 0.34 454 | 0.61 455 | 0.58 456 | 0.33 457 | 0.38 458 | 0.10 459 | 0.18 460 | -0.30 461 | -0.06 462 | -0.28 463 | 0.12 464 | 0.58 465 | 0.89 466 | 0.93 467 | 2.39 468 | 2.44 469 | 1.92 470 | 0.64 471 | -0.24 472 | 0.27 473 | -0.13 474 | -0.16 475 | -0.54 476 | -0.13 477 | -0.37 478 | -0.78 479 | -0.22 480 | 0.03 481 | 0.25 482 | 0.31 483 | 1.03 484 | 1.10 485 | 1.05 486 | 1.11 487 | 1.28 488 | 0.57 489 | -0.55 490 | -1.16 491 | -0.99 492 | -0.38 493 | 0.01 494 | -0.29 495 | 0.09 496 | 0.46 497 | 0.57 498 | 0.24 499 | 0.39 500 | 0.49 501 | 0.86 502 | 0.51 503 | 0.95 504 | 1.25 505 | 1.33 506 | -0.00 507 | 0.34 508 | 0.66 509 | 1.11 510 | 0.34 511 | 0.48 512 | 0.56 513 | 0.39 514 | -0.17 515 | 1.04 516 | 0.77 517 | 0.12 518 | -0.35 519 | -0.22 520 | 0.08 521 | -0.08 522 | -0.18 523 | -0.06 524 | -------------------------------------------------------------------------------- /wave_matlab/wavelet.m: -------------------------------------------------------------------------------- 1 | %WAVELET 1D Wavelet transform with optional singificance testing 2 | % 3 | % [WAVE,PERIOD,SCALE,COI] = wavelet(Y,DT,PAD,DJ,S0,J1,MOTHER,PARAM) 4 | % 5 | % Computes the wavelet transform of the vector Y (length N), 6 | % with sampling rate DT. 7 | % 8 | % By default, the Morlet wavelet (k0=6) is used. 9 | % The wavelet basis is normalized to have total energy=1 at all scales. 10 | % 11 | % 12 | % INPUTS: 13 | % 14 | % Y = the time series of length N. 15 | % DT = amount of time between each Y value, i.e. the sampling time. 16 | % 17 | % OUTPUTS: 18 | % 19 | % WAVE is the WAVELET transform of Y. This is a complex array 20 | % of dimensions (N,J1+1). FLOAT(WAVE) gives the WAVELET amplitude, 21 | % ATAN(IMAGINARY(WAVE),FLOAT(WAVE) gives the WAVELET phase. 22 | % The WAVELET power spectrum is ABS(WAVE)^2. 23 | % Its units are sigma^2 (the time series variance). 24 | % 25 | % 26 | % OPTIONAL INPUTS: 27 | % 28 | % *** Note *** setting any of the following to -1 will cause the default 29 | % value to be used. 30 | % 31 | % PAD = if set to 1 (default is 0), pad time series with enough zeroes to get 32 | % N up to the next higher power of 2. This prevents wraparound 33 | % from the end of the time series to the beginning, and also 34 | % speeds up the FFT's used to do the wavelet transform. 35 | % This will not eliminate all edge effects (see COI below). 36 | % 37 | % DJ = the spacing between discrete scales. Default is 0.25. 38 | % A smaller # will give better scale resolution, but be slower to plot. 39 | % 40 | % S0 = the smallest scale of the wavelet. Default is 2*DT. 41 | % 42 | % J1 = the # of scales minus one. Scales range from S0 up to S0*2^(J1*DJ), 43 | % to give a total of (J1+1) scales. Default is J1 = (LOG2(N DT/S0))/DJ. 44 | % 45 | % MOTHER = the mother wavelet function. 46 | % The choices are 'MORLET', 'PAUL', or 'DOG' 47 | % 48 | % PARAM = the mother wavelet parameter. 49 | % For 'MORLET' this is k0 (wavenumber), default is 6. 50 | % For 'PAUL' this is m (order), default is 4. 51 | % For 'DOG' this is m (m-th derivative), default is 2. 52 | % 53 | % 54 | % OPTIONAL OUTPUTS: 55 | % 56 | % PERIOD = the vector of "Fourier" periods (in time units) that corresponds 57 | % to the SCALEs. 58 | % 59 | % SCALE = the vector of scale indices, given by S0*2^(j*DJ), j=0...J1 60 | % where J1+1 is the total # of scales. 61 | % 62 | % COI = if specified, then return the Cone-of-Influence, which is a vector 63 | % of N points that contains the maximum period of useful information 64 | % at that particular time. 65 | % Periods greater than this are subject to edge effects. 66 | % This can be used to plot COI lines on a contour plot by doing: 67 | % 68 | % contour(time,log(period),log(power)) 69 | % plot(time,log(coi),'k') 70 | % 71 | %---------------------------------------------------------------------------- 72 | % Copyright (C) 1995-2004, Christopher Torrence and Gilbert P. Compo 73 | % 74 | % This software may be used, copied, or redistributed as long as it is not 75 | % sold and this copyright notice is reproduced on each copy made. This 76 | % routine is provided as is without any express or implied warranties 77 | % whatsoever. 78 | % 79 | % Notice: Please acknowledge the use of the above software in any publications: 80 | % ``Wavelet software was provided by C. Torrence and G. Compo, 81 | % and is available at URL: http://paos.colorado.edu/research/wavelets/''. 82 | % 83 | % Reference: Torrence, C. and G. P. Compo, 1998: A Practical Guide to 84 | % Wavelet Analysis. Bull. Amer. Meteor. Soc., 79, 61-78. 85 | % 86 | % Please send a copy of such publications to either C. Torrence or G. Compo: 87 | % Dr. Christopher Torrence Dr. Gilbert P. Compo 88 | % Research Systems, Inc. Climate Diagnostics Center 89 | % 4990 Pearl East Circle 325 Broadway R/CDC1 90 | % Boulder, CO 80301, USA Boulder, CO 80305-3328, USA 91 | % E-mail: chris[AT]rsinc[DOT]com E-mail: compo[AT]colorado[DOT]edu 92 | %---------------------------------------------------------------------------- 93 | function [wave,period,scale,coi] = ... 94 | wavelet(Y,dt,pad,dj,s0,J1,mother,param); 95 | 96 | if (nargin < 8), param = -1;, end 97 | if (nargin < 7), mother = -1;, end 98 | if (nargin < 6), J1 = -1;, end 99 | if (nargin < 5), s0 = -1;, end 100 | if (nargin < 4), dj = -1;, end 101 | if (nargin < 3), pad = 0;, end 102 | if (nargin < 2) 103 | error('Must input a vector Y and sampling time DT') 104 | end 105 | 106 | n1 = length(Y); 107 | 108 | if (s0 == -1), s0=2*dt;, end 109 | if (dj == -1), dj = 1./4.;, end 110 | if (J1 == -1), J1=fix((log(n1*dt/s0)/log(2))/dj);, end 111 | if (mother == -1), mother = 'MORLET';, end 112 | 113 | %....construct time series to analyze, pad if necessary 114 | x(1:n1) = Y - mean(Y); 115 | if (pad == 1) 116 | base2 = fix(log(n1)/log(2) + 0.4999); % power of 2 nearest to N 117 | x = [x,zeros(1,2^(base2+1)-n1)]; 118 | end 119 | n = length(x); 120 | 121 | %....construct wavenumber array used in transform [Eqn(5)] 122 | k = [1:fix(n/2)]; 123 | k = k.*((2.*pi)/(n*dt)); 124 | k = [0., k, -k(fix((n-1)/2):-1:1)]; 125 | 126 | %....compute FFT of the (padded) time series 127 | f = fft(x); % [Eqn(3)] 128 | 129 | %....construct SCALE array & empty PERIOD & WAVE arrays 130 | scale = s0*2.^((0:J1)*dj); 131 | period = scale; 132 | wave = zeros(J1+1,n); % define the wavelet array 133 | wave = wave + i*wave; % make it complex 134 | 135 | % loop through all scales and compute transform 136 | for a1 = 1:J1+1 137 | [daughter,fourier_factor,coi,dofmin]=wave_bases(mother,k,scale(a1),param); 138 | wave(a1,:) = ifft(f.*daughter); % wavelet transform[Eqn(4)] 139 | end 140 | 141 | period = fourier_factor*scale; 142 | coi = coi*dt*[1E-5,1:((n1+1)/2-1),fliplr((1:(n1/2-1))),1E-5]; % COI [Sec.3g] 143 | wave = wave(:,1:n1); % get rid of padding before returning 144 | 145 | return 146 | 147 | % end of code 148 | 149 | -------------------------------------------------------------------------------- /webplot-do-not-use/data/nino3sst.dat: -------------------------------------------------------------------------------- 1 | $submit 2 | Submit 3 | $dataset 4 | nino3sst 5 | $title 6 | NINO3 Sea Surface Temperature 7 | $source 8 | UK Meteorological Office GISST2.3 9 | $dataset1 10 | NINO3 SST 11 | $units 12 | !Uo!NC 13 | t0 14 | 1871.0 15 | dt 16 | 0.25 17 | $t_units 18 | years 19 | data 20 | -0.15 21 | -0.30 22 | -0.14 23 | -0.41 24 | -0.46 25 | -0.66 26 | -0.50 27 | -0.80 28 | -0.95 29 | -0.72 30 | -0.31 31 | -0.71 32 | -1.04 33 | -0.77 34 | -0.86 35 | -0.84 36 | -0.41 37 | -0.49 38 | -0.48 39 | -0.72 40 | -1.21 41 | -0.80 42 | 0.16 43 | 0.46 44 | 0.40 45 | 1.00 46 | 2.17 47 | 2.50 48 | 2.34 49 | 0.80 50 | 0.14 51 | -0.06 52 | -0.34 53 | -0.71 54 | -0.34 55 | -0.73 56 | -0.48 57 | -0.11 58 | 0.22 59 | 0.51 60 | 0.51 61 | 0.25 62 | -0.10 63 | -0.33 64 | -0.42 65 | -0.23 66 | -0.53 67 | -0.44 68 | -0.30 69 | 0.15 70 | 0.09 71 | 0.19 72 | -0.06 73 | 0.25 74 | 0.30 75 | 0.81 76 | 0.26 77 | 0.10 78 | 0.34 79 | 1.01 80 | -0.31 81 | -0.90 82 | -0.73 83 | -0.92 84 | -0.73 85 | -0.31 86 | -0.03 87 | 0.12 88 | 0.37 89 | 0.82 90 | 1.22 91 | 1.83 92 | 1.60 93 | 0.34 94 | -0.72 95 | -0.87 96 | -0.85 97 | -0.40 98 | -0.39 99 | -0.65 100 | 0.07 101 | 0.67 102 | 0.39 103 | 0.03 104 | -0.17 105 | -0.76 106 | -0.87 107 | -1.36 108 | -1.10 109 | -0.99 110 | -0.78 111 | -0.93 112 | -0.87 113 | -0.44 114 | -0.34 115 | -0.50 116 | -0.39 117 | -0.04 118 | 0.42 119 | 0.62 120 | 0.17 121 | 0.23 122 | 1.03 123 | 1.54 124 | 1.09 125 | 0.01 126 | 0.12 127 | -0.27 128 | -0.47 129 | -0.41 130 | -0.37 131 | -0.36 132 | -0.39 133 | 0.43 134 | 1.05 135 | 1.58 136 | 1.25 137 | 0.86 138 | 0.60 139 | 0.21 140 | 0.19 141 | -0.23 142 | -0.29 143 | 0.18 144 | 0.12 145 | 0.71 146 | 1.42 147 | 1.59 148 | 0.93 149 | -0.25 150 | -0.66 151 | -0.95 152 | -0.47 153 | 0.06 154 | 0.70 155 | 0.81 156 | 0.78 157 | 1.43 158 | 1.22 159 | 1.05 160 | 0.44 161 | -0.35 162 | -0.67 163 | -0.84 164 | -0.66 165 | -0.45 166 | -0.12 167 | -0.20 168 | -0.16 169 | -0.47 170 | -0.52 171 | -0.79 172 | -0.80 173 | -0.62 174 | -0.86 175 | -1.29 176 | -1.04 177 | -1.05 178 | -0.75 179 | -0.81 180 | -0.90 181 | -0.25 182 | 0.62 183 | 1.22 184 | 0.96 185 | 0.21 186 | -0.11 187 | -0.25 188 | -0.24 189 | -0.43 190 | 0.23 191 | 0.67 192 | 0.78 193 | 0.41 194 | 0.98 195 | 1.28 196 | 1.45 197 | 1.02 198 | 0.03 199 | -0.59 200 | -1.34 201 | -0.99 202 | -1.49 203 | -1.74 204 | -1.33 205 | -0.55 206 | -0.51 207 | -0.36 208 | -0.99 209 | 0.32 210 | 1.04 211 | 1.41 212 | 0.99 213 | 0.66 214 | 0.50 215 | 0.22 216 | 0.71 217 | -0.16 218 | 0.38 219 | 0.00 220 | -1.11 221 | -1.04 222 | 0.05 223 | -0.64 224 | -0.34 225 | -0.50 226 | -1.85 227 | -0.94 228 | -0.78 229 | 0.29 230 | 0.27 231 | 0.69 232 | -0.06 233 | -0.83 234 | -0.80 235 | -1.02 236 | -0.96 237 | -0.09 238 | 0.62 239 | 0.87 240 | 1.03 241 | 0.70 242 | -0.10 243 | -0.31 244 | 0.04 245 | -0.46 246 | 0.04 247 | 0.24 248 | -0.08 249 | -0.28 250 | 0.06 251 | 0.05 252 | -0.31 253 | 0.11 254 | 0.27 255 | 0.26 256 | 0.04 257 | 0.12 258 | 1.11 259 | 1.53 260 | 1.23 261 | 0.17 262 | -0.18 263 | -0.56 264 | 0.05 265 | 0.41 266 | 0.22 267 | 0.04 268 | -0.19 269 | -0.46 270 | -0.65 271 | -1.06 272 | -0.54 273 | 0.14 274 | 0.25 275 | -0.21 276 | -0.73 277 | -0.43 278 | 0.48 279 | 0.26 280 | 0.05 281 | 0.11 282 | -0.27 283 | -0.08 284 | -0.10 285 | 0.29 286 | -0.15 287 | -0.28 288 | -0.55 289 | -0.44 290 | -1.40 291 | -0.55 292 | -0.69 293 | 0.58 294 | 0.37 295 | 0.42 296 | 1.83 297 | 1.23 298 | 0.65 299 | 0.41 300 | 1.03 301 | 0.64 302 | -0.07 303 | 0.98 304 | 0.36 305 | -0.30 306 | -1.33 307 | -1.39 308 | -0.94 309 | 0.34 310 | -0.00 311 | -0.15 312 | 0.06 313 | 0.39 314 | 0.36 315 | -0.49 316 | -0.53 317 | 0.35 318 | 0.07 319 | -0.24 320 | 0.20 321 | -0.22 322 | -0.68 323 | -0.44 324 | 0.02 325 | -0.22 326 | -0.30 327 | -0.59 328 | 0.10 329 | -0.02 330 | -0.27 331 | -0.60 332 | -0.48 333 | -0.37 334 | -0.53 335 | -1.35 336 | -1.22 337 | -0.99 338 | -0.34 339 | -0.79 340 | -0.24 341 | 0.02 342 | 0.69 343 | 0.78 344 | 0.17 345 | -0.17 346 | -0.29 347 | -0.27 348 | 0.31 349 | 0.44 350 | 0.38 351 | 0.24 352 | -0.13 353 | -0.89 354 | -0.76 355 | -0.71 356 | -0.37 357 | -0.59 358 | -0.63 359 | -1.47 360 | -0.40 361 | -0.18 362 | -0.37 363 | -0.43 364 | -0.06 365 | 0.61 366 | 1.33 367 | 1.19 368 | 1.13 369 | 0.31 370 | 0.14 371 | 0.03 372 | 0.21 373 | 0.15 374 | -0.22 375 | -0.02 376 | 0.03 377 | -0.17 378 | 0.12 379 | -0.35 380 | -0.06 381 | 0.38 382 | -0.45 383 | -0.32 384 | -0.33 385 | -0.49 386 | -0.14 387 | -0.56 388 | -0.18 389 | 0.46 390 | 1.09 391 | 1.04 392 | 0.23 393 | -0.99 394 | -0.59 395 | -0.92 396 | -0.28 397 | 0.52 398 | 1.31 399 | 1.45 400 | 0.61 401 | -0.11 402 | -0.18 403 | -0.39 404 | -0.39 405 | -0.36 406 | -0.50 407 | -0.81 408 | -1.10 409 | -0.29 410 | 0.57 411 | 0.68 412 | 0.78 413 | 0.78 414 | 0.63 415 | 0.98 416 | 0.49 417 | -0.42 418 | -1.34 419 | -1.20 420 | -1.18 421 | -0.65 422 | -0.42 423 | -0.97 424 | -0.28 425 | 0.77 426 | 1.77 427 | 2.22 428 | 1.05 429 | -0.67 430 | -0.99 431 | -1.52 432 | -1.17 433 | -0.22 434 | -0.04 435 | -0.45 436 | -0.46 437 | -0.75 438 | -0.70 439 | -1.38 440 | -1.15 441 | -0.01 442 | 0.97 443 | 1.10 444 | 0.68 445 | -0.02 446 | -0.04 447 | 0.47 448 | 0.30 449 | -0.55 450 | -0.51 451 | -0.09 452 | -0.01 453 | 0.34 454 | 0.61 455 | 0.58 456 | 0.33 457 | 0.38 458 | 0.10 459 | 0.18 460 | -0.30 461 | -0.06 462 | -0.28 463 | 0.12 464 | 0.58 465 | 0.89 466 | 0.93 467 | 2.39 468 | 2.44 469 | 1.92 470 | 0.64 471 | -0.24 472 | 0.27 473 | -0.13 474 | -0.16 475 | -0.54 476 | -0.13 477 | -0.37 478 | -0.78 479 | -0.22 480 | 0.03 481 | 0.25 482 | 0.31 483 | 1.03 484 | 1.10 485 | 1.05 486 | 1.11 487 | 1.28 488 | 0.57 489 | -0.55 490 | -1.16 491 | -0.99 492 | -0.38 493 | 0.01 494 | -0.29 495 | 0.09 496 | 0.46 497 | 0.57 498 | 0.24 499 | 0.39 500 | 0.49 501 | 0.86 502 | 0.51 503 | 0.95 504 | 1.25 505 | 1.33 506 | -0.00 507 | 0.34 508 | 0.66 509 | 1.11 510 | 0.34 511 | 0.48 512 | 0.56 513 | 0.39 514 | -0.17 515 | 1.04 516 | 0.77 517 | 0.12 518 | -0.35 519 | -0.22 520 | 0.08 521 | -0.08 522 | -0.18 523 | -0.06 524 | -------------------------------------------------------------------------------- /wave_python/waveletAnalysis.py: -------------------------------------------------------------------------------- 1 | import matplotlib.pylab as plt 2 | import matplotlib.ticker as ticker 3 | from matplotlib.gridspec import GridSpec 4 | 5 | import numpy as np 6 | 7 | # from mpl_toolkits.axes_grid1 import make_axes_locatable 8 | 9 | from waveletFunctions import wave_signif, wavelet 10 | 11 | __author__ = 'Evgeniya Predybaylo' 12 | 13 | 14 | # WAVETEST Example Python script for WAVELET, using NINO3 SST dataset 15 | # 16 | # See "http://paos.colorado.edu/research/wavelets/" 17 | # The Matlab code written January 1998 by C. Torrence 18 | # modified to Python by Evgeniya Predybaylo, December 2014 19 | # 20 | # Modified Oct 1999, changed Global Wavelet Spectrum (GWS) to be sideways, 21 | # changed all "log" to "log2", changed logarithmic axis on GWS to 22 | # a normal axis. 23 | # --------------------------------------------------------------------------- 24 | 25 | # READ THE DATA 26 | sst = np.loadtxt('sst_nino3.dat') # input SST time series 27 | sst = sst - np.mean(sst) 28 | variance = np.std(sst, ddof=1) ** 2 29 | print("variance = ", variance) 30 | 31 | # ----------C-O-M-P-U-T-A-T-I-O-N------S-T-A-R-T-S------H-E-R-E--------------- 32 | 33 | # normalize by standard deviation (not necessary, but makes it easier 34 | # to compare with plot on Interactive Wavelet page, at 35 | # "http://paos.colorado.edu/research/wavelets/plot/" 36 | if 0: 37 | variance = 1.0 38 | sst = sst / np.std(sst, ddof=1) 39 | n = len(sst) 40 | dt = 0.25 41 | time = np.arange(len(sst)) * dt + 1871.0 # construct time array 42 | xlim = ([1870, 2000]) # plotting range 43 | pad = 1 # pad the time series with zeroes (recommended) 44 | dj = 0.25 # this will do 4 sub-octaves per octave 45 | s0 = 2 * dt # this says start at a scale of 6 months 46 | j1 = 7 / dj # this says do 7 powers-of-two with dj sub-octaves each 47 | lag1 = 0.72 # lag-1 autocorrelation for red noise background 48 | print("lag1 = ", lag1) 49 | mother = 'MORLET' 50 | 51 | # Wavelet transform: 52 | wave, period, scale, coi = wavelet(sst, dt, pad, dj, s0, j1, mother) 53 | power = (np.abs(wave)) ** 2 # compute wavelet power spectrum 54 | global_ws = (np.sum(power, axis=1) / n) # time-average over all times 55 | 56 | # Significance levels: 57 | signif = wave_signif(([variance]), dt=dt, sigtest=0, scale=scale, 58 | lag1=lag1, mother=mother) 59 | # expand signif --> (J+1)x(N) array 60 | sig95 = signif[:, np.newaxis].dot(np.ones(n)[np.newaxis, :]) 61 | sig95 = power / sig95 # where ratio > 1, power is significant 62 | 63 | # Global wavelet spectrum & significance levels: 64 | dof = n - scale # the -scale corrects for padding at edges 65 | global_signif = wave_signif(variance, dt=dt, scale=scale, sigtest=1, 66 | lag1=lag1, dof=dof, mother=mother) 67 | 68 | # Scale-average between El Nino periods of 2--8 years 69 | avg = np.logical_and(scale >= 2, scale < 8) 70 | Cdelta = 0.776 # this is for the MORLET wavelet 71 | # expand scale --> (J+1)x(N) array 72 | scale_avg = scale[:, np.newaxis].dot(np.ones(n)[np.newaxis, :]) 73 | scale_avg = power / scale_avg # [Eqn(24)] 74 | scale_avg = dj * dt / Cdelta * sum(scale_avg[avg, :]) # [Eqn(24)] 75 | scaleavg_signif = wave_signif(variance, dt=dt, scale=scale, sigtest=2, 76 | lag1=lag1, dof=([2, 7.9]), mother=mother) 77 | 78 | # ------------------------------------------------------ Plotting 79 | 80 | # --- Plot time series 81 | fig = plt.figure(figsize=(9, 10)) 82 | gs = GridSpec(3, 4, hspace=0.4, wspace=0.75) 83 | plt.subplots_adjust(left=0.1, bottom=0.05, right=0.9, top=0.95, 84 | wspace=0, hspace=0) 85 | plt.subplot(gs[0, 0:3]) 86 | plt.plot(time, sst, 'k') 87 | plt.xlim(xlim[:]) 88 | plt.xlabel('Time (year)') 89 | plt.ylabel('NINO3 SST (\u00B0C)') 90 | plt.title('a) NINO3 Sea Surface Temperature (seasonal)') 91 | 92 | plt.text(time[-1] + 35, 0.5, 'Wavelet Analysis\nC. Torrence & G.P. Compo\n' 93 | 'http://paos.colorado.edu/\nresearch/wavelets/', 94 | horizontalalignment='center', verticalalignment='center') 95 | 96 | # --- Contour plot wavelet power spectrum 97 | # plt3 = plt.subplot(3, 1, 2) 98 | plt3 = plt.subplot(gs[1, 0:3]) 99 | levels = [0, 0.5, 1, 2, 4, 999] 100 | # *** or use 'contour' 101 | CS = plt.contourf(time, period, power, len(levels)) 102 | im = plt.contourf(CS, levels=levels, 103 | colors=['white', 'bisque', 'orange', 'orangered', 'darkred']) 104 | plt.xlabel('Time (year)') 105 | plt.ylabel('Period (years)') 106 | plt.title('b) Wavelet Power Spectrum (contours at 0.5,1,2,4\u00B0C$^2$)') 107 | plt.xlim(xlim[:]) 108 | # 95# significance contour, levels at -99 (fake) and 1 (95# signif) 109 | plt.contour(time, period, sig95, [-99, 1], colors='k') 110 | # cone-of-influence, anything "below" is dubious 111 | plt.fill_between(time, coi * 0 + period[-1], coi, facecolor="none", 112 | edgecolor="#00000040", hatch='x') 113 | plt.plot(time, coi, 'k') 114 | # format y-scale 115 | plt3.set_yscale('log', base=2, subs=None) 116 | plt.ylim([np.min(period), np.max(period)]) 117 | ax = plt.gca().yaxis 118 | ax.set_major_formatter(ticker.ScalarFormatter()) 119 | plt3.ticklabel_format(axis='y', style='plain') 120 | plt3.invert_yaxis() 121 | # set up the size and location of the colorbar 122 | # position=fig.add_axes([0.5,0.36,0.2,0.01]) 123 | # plt.colorbar(im, cax=position, orientation='horizontal') 124 | # , fraction=0.05, pad=0.5) 125 | 126 | # plt.subplots_adjust(right=0.7, top=0.9) 127 | 128 | # --- Plot global wavelet spectrum 129 | plt4 = plt.subplot(gs[1, -1]) 130 | plt.plot(global_ws, period) 131 | plt.plot(global_signif, period, '--') 132 | plt.xlabel('Power (\u00B0C$^2$)') 133 | plt.title('c) Global Wavelet Spectrum') 134 | plt.xlim([0, 1.25 * np.max(global_ws)]) 135 | # format y-scale 136 | plt4.set_yscale('log', base=2, subs=None) 137 | plt.ylim([np.min(period), np.max(period)]) 138 | ax = plt.gca().yaxis 139 | ax.set_major_formatter(ticker.ScalarFormatter()) 140 | plt4.ticklabel_format(axis='y', style='plain') 141 | plt4.invert_yaxis() 142 | 143 | # --- Plot 2--8 yr scale-average time series 144 | plt.subplot(gs[2, 0:3]) 145 | plt.plot(time, scale_avg, 'k') 146 | plt.xlim(xlim[:]) 147 | plt.xlabel('Time (year)') 148 | plt.ylabel('Avg variance (\u00B0C$^2$)') 149 | plt.title('d) 2-8 yr Scale-average Time Series') 150 | plt.plot(xlim, scaleavg_signif + [0, 0], '--') 151 | 152 | plt.show() 153 | -------------------------------------------------------------------------------- /wave_idl/monsoon.txt: -------------------------------------------------------------------------------- 1 | $submit 2 | Submit 3 | $dataset 4 | nino3sst 5 | $title 6 | All-India Monsoon Rainfall 7 | $source 8 | Parthasarathy et al. 1991: J. Climate, 4, 927-938 9 | $dataset1 10 | Rainfall 11 | $units 12 | mm 13 | t0 14 | 1871.0 15 | dt 16 | 0.25 17 | $t_units 18 | years 19 | data 20 | 1.97 21 | 21.17 22 | -15.97 23 | -14.79 24 | -5.46 25 | 5.00 26 | 11.89 27 | 1.65 28 | -2.23 29 | -20.67 30 | -14.81 31 | -13.02 32 | -1.23 33 | 23.70 34 | 19.33 35 | -1.45 36 | -1.56 37 | 8.10 38 | 16.13 39 | -16.75 40 | -6.66 41 | -19.90 42 | -11.44 43 | -20.62 44 | 12.57 45 | 1.03 46 | -75.71 47 | 14.28 48 | -2.90 49 | -3.00 50 | 52.33 51 | 0.31 52 | -6.00 53 | 14.67 54 | 6.36 55 | -1.99 56 | -1.13 57 | 5.40 58 | -18.67 59 | 10.48 60 | -0.46 61 | -1.57 62 | 3.99 63 | -10.02 64 | -3.50 65 | 16.47 66 | 0.43 67 | 6.48 68 | 0.54 69 | 13.63 70 | -14.57 71 | 2.18 72 | -5.43 73 | -8.03 74 | 28.26 75 | 7.91 76 | -1.93 77 | 8.23 78 | -11.74 79 | 11.91 80 | -3.50 81 | 13.07 82 | -4.01 83 | 16.75 84 | -1.96 85 | 7.93 86 | 6.96 87 | 7.28 88 | 2.14 89 | -10.23 90 | -3.17 91 | -7.22 92 | -2.73 93 | 10.20 94 | 12.83 95 | 1.98 96 | -5.96 97 | 15.93 98 | -3.71 99 | -2.25 100 | 6.94 101 | -26.13 102 | 6.76 103 | -11.89 104 | -5.76 105 | 0.97 106 | 48.33 107 | -0.42 108 | 19.57 109 | 39.80 110 | 8.19 111 | 14.38 112 | 1.74 113 | 11.83 114 | 21.99 115 | 23.61 116 | -2.80 117 | 11.80 118 | -21.11 119 | -5.19 120 | -7.63 121 | 6.53 122 | -21.14 123 | -14.75 124 | 1.20 125 | -11.43 126 | 19.93 127 | -6.65 128 | -1.10 129 | -3.90 130 | 8.06 131 | -1.02 132 | -6.36 133 | 19.33 134 | -84.94 135 | -20.99 136 | -2.16 137 | -11.40 138 | 23.96 139 | -15.55 140 | 11.20 141 | -18.83 142 | -27.21 143 | -4.55 144 | -6.53 145 | -20.33 146 | -0.21 147 | 1.41 148 | -4.90 149 | -15.57 150 | 15.06 151 | 22.41 152 | -1.33 153 | 12.40 154 | -39.31 155 | -10.25 156 | 5.64 157 | -25.50 158 | -21.04 159 | -15.65 160 | 12.27 161 | -4.70 162 | 4.86 163 | -6.52 164 | 8.47 165 | -3.07 166 | -21.77 167 | -21.05 168 | -1.30 169 | -19.87 170 | 26.86 171 | -23.35 172 | -4.66 173 | 26.73 174 | -3.07 175 | -16.29 176 | -7.10 177 | 8.83 178 | 11.53 179 | 8.85 180 | 0.90 181 | 4.70 182 | -48.31 183 | 1.75 184 | -0.06 185 | -23.00 186 | 3.79 187 | 1.41 188 | 3.20 189 | 21.20 190 | -39.81 191 | -2.79 192 | -3.63 193 | 5.83 194 | 15.96 195 | -14.35 196 | 14.77 197 | 1.23 198 | -21.61 199 | 9.71 200 | -8.36 201 | 9.50 202 | 20.93 203 | 26.95 204 | 4.54 205 | 22.33 206 | 33.73 207 | 25.15 208 | -3.90 209 | 15.30 210 | -73.04 211 | -15.72 212 | 7.44 213 | 3.00 214 | 5.46 215 | 7.75 216 | 5.34 217 | -10.43 218 | -37.44 219 | -13.69 220 | 1.30 221 | -4.47 222 | 3.33 223 | -10.09 224 | -2.40 225 | -2.57 226 | -0.01 227 | 1.81 228 | 4.67 229 | -29.30 230 | 13.59 231 | -8.25 232 | -4.16 233 | -22.67 234 | 21.03 235 | 4.95 236 | -7.63 237 | 18.73 238 | -24.07 239 | 4.28 240 | 11.54 241 | -27.23 242 | 44.13 243 | -16.85 244 | 2.87 245 | -4.50 246 | 1.09 247 | 3.85 248 | 2.64 249 | -8.03 250 | -25.04 251 | 12.45 252 | 1.27 253 | 9.07 254 | -16.81 255 | 6.05 256 | -2.36 257 | 3.23 258 | -19.14 259 | 15.38 260 | -2.56 261 | -20.97 262 | 24.56 263 | 26.35 264 | -3.40 265 | -14.03 266 | 0.86 267 | 6.21 268 | -0.03 269 | 32.43 270 | 28.26 271 | 2.78 272 | -2.66 273 | 6.80 274 | 7.06 275 | -3.92 276 | -2.43 277 | -17.63 278 | 4.86 279 | -15.32 280 | 4.84 281 | 33.27 282 | -6.64 283 | 7.58 284 | 5.00 285 | 3.10 286 | -0.84 287 | 1.91 288 | 0.90 289 | 26.87 290 | -6.44 291 | -7.32 292 | 0.84 293 | -12.37 294 | -15.57 295 | 2.61 296 | 6.64 297 | 4.63 298 | -1.61 299 | 4.18 300 | -0.60 301 | 2.07 302 | -41.61 303 | -4.09 304 | 3.70 305 | 2.80 306 | 31.73 307 | -13.09 308 | 6.80 309 | 7.67 310 | 8.73 311 | 0.08 312 | 19.57 313 | -13.67 314 | 31.46 315 | 4.68 316 | -1.66 317 | -2.93 318 | 21.09 319 | -4.85 320 | -3.86 321 | 20.43 322 | 2.49 323 | 28.35 324 | 1.74 325 | -16.37 326 | 44.69 327 | -8.42 328 | 4.17 329 | 0.37 330 | 11.59 331 | 10.25 332 | -6.16 333 | 4.47 334 | 25.69 335 | -2.89 336 | 2.37 337 | -14.40 338 | 13.79 339 | -9.29 340 | -1.00 341 | -1.23 342 | -35.01 343 | -1.95 344 | -3.26 345 | 3.90 346 | -19.17 347 | -4.95 348 | -1.73 349 | -7.27 350 | 25.96 351 | -3.82 352 | 0.70 353 | -13.30 354 | 19.46 355 | -8.39 356 | -2.63 357 | 10.67 358 | 20.53 359 | 22.35 360 | -2.33 361 | 25.17 362 | 28.86 363 | 29.88 364 | 6.17 365 | -9.40 366 | -15.17 367 | -9.35 368 | -3.86 369 | -12.90 370 | 28.46 371 | 7.25 372 | 0.34 373 | -1.23 374 | 32.66 375 | 12.95 376 | -1.86 377 | -9.20 378 | 1.59 379 | 0.01 380 | 6.14 381 | 10.00 382 | 48.13 383 | 10.38 384 | -2.40 385 | -14.50 386 | 4.99 387 | 2.68 388 | -4.13 389 | -3.50 390 | 5.49 391 | 3.81 392 | -7.80 393 | -9.93 394 | 29.99 395 | -4.92 396 | -3.10 397 | -24.23 398 | -29.97 399 | -15.39 400 | -4.63 401 | -2.70 402 | -38.21 403 | 5.58 404 | 8.54 405 | -14.97 406 | 9.93 407 | -5.19 408 | 2.74 409 | -15.70 410 | -23.57 411 | -6.39 412 | -7.53 413 | -13.73 414 | 7.09 415 | -0.95 416 | 5.74 417 | 16.93 418 | 13.36 419 | -7.92 420 | -2.66 421 | 31.17 422 | -7.14 423 | 2.91 424 | -6.23 425 | -18.07 426 | -52.84 427 | -3.39 428 | -4.86 429 | -10.90 430 | 27.79 431 | 14.38 432 | -6.46 433 | -17.80 434 | -15.57 435 | 0.78 436 | -2.96 437 | -1.67 438 | 31.23 439 | 9.75 440 | -4.50 441 | -11.27 442 | 8.69 443 | -7.59 444 | -5.90 445 | 22.37 446 | 1.99 447 | 16.31 448 | 3.20 449 | 10.37 450 | 6.96 451 | 0.65 452 | 4.27 453 | -14.13 454 | -41.51 455 | 8.68 456 | -4.10 457 | 13.83 458 | -7.07 459 | -8.79 460 | 3.17 461 | -5.87 462 | 8.19 463 | -9.09 464 | 4.57 465 | -8.50 466 | -27.74 467 | -5.19 468 | -2.80 469 | -4.70 470 | 43.03 471 | 2.71 472 | 5.30 473 | -0.43 474 | -8.71 475 | -13.05 476 | -1.80 477 | -11.40 478 | -23.17 479 | 8.68 480 | 3.80 481 | 3.30 482 | -41.14 483 | 1.95 484 | -0.50 485 | -19.97 486 | -35.84 487 | 14.65 488 | -2.16 489 | -1.17 490 | 38.69 491 | -12.45 492 | -3.26 493 | 0.20 494 | -1.91 495 | -14.89 496 | 5.20 497 | 22.57 498 | 15.86 499 | 7.55 500 | -2.66 501 | 6.33 502 | -28.37 503 | -3.62 504 | -6.23 505 | -18.67 506 | -8.37 507 | 0.78 508 | -0.50 509 | 12.00 510 | 7.89 511 | 6.58 512 | 2.77 513 | 16.57 514 | 11.36 515 | 0.91 516 | -------------------------------------------------------------------------------- /webplot-do-not-use/data/monsoon.dat: -------------------------------------------------------------------------------- 1 | $submit 2 | Submit 3 | $dataset 4 | nino3sst 5 | $title 6 | All-India Monsoon Rainfall 7 | $source 8 | Parthasarathy et al. 1991: J. Climate, 4, 927-938 9 | $dataset1 10 | Rainfall 11 | $units 12 | mm 13 | t0 14 | 1871.0 15 | dt 16 | 0.25 17 | $t_units 18 | years 19 | data 20 | 1.97 21 | 21.17 22 | -15.97 23 | -14.79 24 | -5.46 25 | 5.00 26 | 11.89 27 | 1.65 28 | -2.23 29 | -20.67 30 | -14.81 31 | -13.02 32 | -1.23 33 | 23.70 34 | 19.33 35 | -1.45 36 | -1.56 37 | 8.10 38 | 16.13 39 | -16.75 40 | -6.66 41 | -19.90 42 | -11.44 43 | -20.62 44 | 12.57 45 | 1.03 46 | -75.71 47 | 14.28 48 | -2.90 49 | -3.00 50 | 52.33 51 | 0.31 52 | -6.00 53 | 14.67 54 | 6.36 55 | -1.99 56 | -1.13 57 | 5.40 58 | -18.67 59 | 10.48 60 | -0.46 61 | -1.57 62 | 3.99 63 | -10.02 64 | -3.50 65 | 16.47 66 | 0.43 67 | 6.48 68 | 0.54 69 | 13.63 70 | -14.57 71 | 2.18 72 | -5.43 73 | -8.03 74 | 28.26 75 | 7.91 76 | -1.93 77 | 8.23 78 | -11.74 79 | 11.91 80 | -3.50 81 | 13.07 82 | -4.01 83 | 16.75 84 | -1.96 85 | 7.93 86 | 6.96 87 | 7.28 88 | 2.14 89 | -10.23 90 | -3.17 91 | -7.22 92 | -2.73 93 | 10.20 94 | 12.83 95 | 1.98 96 | -5.96 97 | 15.93 98 | -3.71 99 | -2.25 100 | 6.94 101 | -26.13 102 | 6.76 103 | -11.89 104 | -5.76 105 | 0.97 106 | 48.33 107 | -0.42 108 | 19.57 109 | 39.80 110 | 8.19 111 | 14.38 112 | 1.74 113 | 11.83 114 | 21.99 115 | 23.61 116 | -2.80 117 | 11.80 118 | -21.11 119 | -5.19 120 | -7.63 121 | 6.53 122 | -21.14 123 | -14.75 124 | 1.20 125 | -11.43 126 | 19.93 127 | -6.65 128 | -1.10 129 | -3.90 130 | 8.06 131 | -1.02 132 | -6.36 133 | 19.33 134 | -84.94 135 | -20.99 136 | -2.16 137 | -11.40 138 | 23.96 139 | -15.55 140 | 11.20 141 | -18.83 142 | -27.21 143 | -4.55 144 | -6.53 145 | -20.33 146 | -0.21 147 | 1.41 148 | -4.90 149 | -15.57 150 | 15.06 151 | 22.41 152 | -1.33 153 | 12.40 154 | -39.31 155 | -10.25 156 | 5.64 157 | -25.50 158 | -21.04 159 | -15.65 160 | 12.27 161 | -4.70 162 | 4.86 163 | -6.52 164 | 8.47 165 | -3.07 166 | -21.77 167 | -21.05 168 | -1.30 169 | -19.87 170 | 26.86 171 | -23.35 172 | -4.66 173 | 26.73 174 | -3.07 175 | -16.29 176 | -7.10 177 | 8.83 178 | 11.53 179 | 8.85 180 | 0.90 181 | 4.70 182 | -48.31 183 | 1.75 184 | -0.06 185 | -23.00 186 | 3.79 187 | 1.41 188 | 3.20 189 | 21.20 190 | -39.81 191 | -2.79 192 | -3.63 193 | 5.83 194 | 15.96 195 | -14.35 196 | 14.77 197 | 1.23 198 | -21.61 199 | 9.71 200 | -8.36 201 | 9.50 202 | 20.93 203 | 26.95 204 | 4.54 205 | 22.33 206 | 33.73 207 | 25.15 208 | -3.90 209 | 15.30 210 | -73.04 211 | -15.72 212 | 7.44 213 | 3.00 214 | 5.46 215 | 7.75 216 | 5.34 217 | -10.43 218 | -37.44 219 | -13.69 220 | 1.30 221 | -4.47 222 | 3.33 223 | -10.09 224 | -2.40 225 | -2.57 226 | -0.01 227 | 1.81 228 | 4.67 229 | -29.30 230 | 13.59 231 | -8.25 232 | -4.16 233 | -22.67 234 | 21.03 235 | 4.95 236 | -7.63 237 | 18.73 238 | -24.07 239 | 4.28 240 | 11.54 241 | -27.23 242 | 44.13 243 | -16.85 244 | 2.87 245 | -4.50 246 | 1.09 247 | 3.85 248 | 2.64 249 | -8.03 250 | -25.04 251 | 12.45 252 | 1.27 253 | 9.07 254 | -16.81 255 | 6.05 256 | -2.36 257 | 3.23 258 | -19.14 259 | 15.38 260 | -2.56 261 | -20.97 262 | 24.56 263 | 26.35 264 | -3.40 265 | -14.03 266 | 0.86 267 | 6.21 268 | -0.03 269 | 32.43 270 | 28.26 271 | 2.78 272 | -2.66 273 | 6.80 274 | 7.06 275 | -3.92 276 | -2.43 277 | -17.63 278 | 4.86 279 | -15.32 280 | 4.84 281 | 33.27 282 | -6.64 283 | 7.58 284 | 5.00 285 | 3.10 286 | -0.84 287 | 1.91 288 | 0.90 289 | 26.87 290 | -6.44 291 | -7.32 292 | 0.84 293 | -12.37 294 | -15.57 295 | 2.61 296 | 6.64 297 | 4.63 298 | -1.61 299 | 4.18 300 | -0.60 301 | 2.07 302 | -41.61 303 | -4.09 304 | 3.70 305 | 2.80 306 | 31.73 307 | -13.09 308 | 6.80 309 | 7.67 310 | 8.73 311 | 0.08 312 | 19.57 313 | -13.67 314 | 31.46 315 | 4.68 316 | -1.66 317 | -2.93 318 | 21.09 319 | -4.85 320 | -3.86 321 | 20.43 322 | 2.49 323 | 28.35 324 | 1.74 325 | -16.37 326 | 44.69 327 | -8.42 328 | 4.17 329 | 0.37 330 | 11.59 331 | 10.25 332 | -6.16 333 | 4.47 334 | 25.69 335 | -2.89 336 | 2.37 337 | -14.40 338 | 13.79 339 | -9.29 340 | -1.00 341 | -1.23 342 | -35.01 343 | -1.95 344 | -3.26 345 | 3.90 346 | -19.17 347 | -4.95 348 | -1.73 349 | -7.27 350 | 25.96 351 | -3.82 352 | 0.70 353 | -13.30 354 | 19.46 355 | -8.39 356 | -2.63 357 | 10.67 358 | 20.53 359 | 22.35 360 | -2.33 361 | 25.17 362 | 28.86 363 | 29.88 364 | 6.17 365 | -9.40 366 | -15.17 367 | -9.35 368 | -3.86 369 | -12.90 370 | 28.46 371 | 7.25 372 | 0.34 373 | -1.23 374 | 32.66 375 | 12.95 376 | -1.86 377 | -9.20 378 | 1.59 379 | 0.01 380 | 6.14 381 | 10.00 382 | 48.13 383 | 10.38 384 | -2.40 385 | -14.50 386 | 4.99 387 | 2.68 388 | -4.13 389 | -3.50 390 | 5.49 391 | 3.81 392 | -7.80 393 | -9.93 394 | 29.99 395 | -4.92 396 | -3.10 397 | -24.23 398 | -29.97 399 | -15.39 400 | -4.63 401 | -2.70 402 | -38.21 403 | 5.58 404 | 8.54 405 | -14.97 406 | 9.93 407 | -5.19 408 | 2.74 409 | -15.70 410 | -23.57 411 | -6.39 412 | -7.53 413 | -13.73 414 | 7.09 415 | -0.95 416 | 5.74 417 | 16.93 418 | 13.36 419 | -7.92 420 | -2.66 421 | 31.17 422 | -7.14 423 | 2.91 424 | -6.23 425 | -18.07 426 | -52.84 427 | -3.39 428 | -4.86 429 | -10.90 430 | 27.79 431 | 14.38 432 | -6.46 433 | -17.80 434 | -15.57 435 | 0.78 436 | -2.96 437 | -1.67 438 | 31.23 439 | 9.75 440 | -4.50 441 | -11.27 442 | 8.69 443 | -7.59 444 | -5.90 445 | 22.37 446 | 1.99 447 | 16.31 448 | 3.20 449 | 10.37 450 | 6.96 451 | 0.65 452 | 4.27 453 | -14.13 454 | -41.51 455 | 8.68 456 | -4.10 457 | 13.83 458 | -7.07 459 | -8.79 460 | 3.17 461 | -5.87 462 | 8.19 463 | -9.09 464 | 4.57 465 | -8.50 466 | -27.74 467 | -5.19 468 | -2.80 469 | -4.70 470 | 43.03 471 | 2.71 472 | 5.30 473 | -0.43 474 | -8.71 475 | -13.05 476 | -1.80 477 | -11.40 478 | -23.17 479 | 8.68 480 | 3.80 481 | 3.30 482 | -41.14 483 | 1.95 484 | -0.50 485 | -19.97 486 | -35.84 487 | 14.65 488 | -2.16 489 | -1.17 490 | 38.69 491 | -12.45 492 | -3.26 493 | 0.20 494 | -1.91 495 | -14.89 496 | 5.20 497 | 22.57 498 | 15.86 499 | 7.55 500 | -2.66 501 | 6.33 502 | -28.37 503 | -3.62 504 | -6.23 505 | -18.67 506 | -8.37 507 | 0.78 508 | -0.50 509 | 12.00 510 | 7.89 511 | 6.58 512 | 2.77 513 | 16.57 514 | 11.36 515 | 0.91 516 | -------------------------------------------------------------------------------- /wavelet3.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Wave:Wavelets 3 5 | 6 | 7 | 8 | 9 | 10 | 11 |

Wavelet Analysis

12 | 13 |

14 | 21 |

22 | 23 |
24 | 25 |

26 |

27 | Scales 28 |

29 | 30 |       In the previous section 31 | we saw how one can use a typical wavelet (the Morlet) to decompose 32 | a time series into time-frequency phase space. We now turn to the actual 33 | computation of the wavelet transform. 34 |

35 | 36 |       The first thing to consider is the shape of the wavelet. 37 | For decomposing the NINO3 SST data, we chose the Morlet wavelet because: 38 |

    39 |
  1. it is commonly used, 40 |
  2. it's simple, 41 |
  3. it looks like a wave. 42 |
43 | There are an infinite number of other mother wavelets that could be chosen 44 | (see Farge 1992 for examples). 45 |

46 | 47 |       For the Morlet wavelet transform, where the mother 48 | wavelet is: 49 | 50 |

51 | Eqn 2.1 52 |

53 | 54 | we must first choose the wavenumber w0, which gives 55 | the number of oscillations within the wavelet itself. One condition 56 | of the wavelet transform is that the average of the wavelet itself 57 | must be zero. In practice, if we choose w0=6, then 58 | the errors due to non-zero mean are smaller than the typical computer 59 | round-off errors (Farge 1992). 60 |

61 | 62 |       Our next choice is a set of scaling parameters s, 63 | such that we adequately sample all the frequencies present in our 64 | time series. We first choose the smallest resolvable scale, 65 | s0, as some multiple of our time resolution, dt. 66 | For the NINO3 SST data, we have seasonal data, thus dt = 0.25 years. 67 | The smallest wavelet we could possibly resolve is 2dt, thus 68 | we choose s0 = 2dt = 0.5 years. 69 | 70 | The larger scales (longer periods) are chosen as power-of-two multiples 71 | of this smallest scale, 72 | 73 |

74 | (3.1a) . . . . . . . . . . 75 | 76 |

77 | (3.1b) . . . . . . . . . . 78 | 79 | 80 |

81 | 82 | The largest scale chosen should be less than 1/2 the length of the 83 | entire time series. The choice of scales for the NINO3 SST data is 84 | shown on the right-hand axis of Figure 3. 85 | In theory, if these scales are chosen wisely, then one 86 | can construct an orthogonal complete basis set. In reality, one usually 87 | over-samples the scales so as to provide information on 88 | freqencies in between the orthogonal scales. Thus, in Figure 3, the 89 | scales have been over-sampled by choosing 10 sub-scales within each 90 | scale. 91 |

92 | 93 |

94 | Algorithms 95 |

96 | 97 | 98 | 99 |       It is possible to compute the wavelet transform in 100 | the time domain using Eqn 2.3. 101 | However, it is much simpler to use the fact that the wavelet transform 102 | is the convolution between the two functions x and Psi, 103 | and to carry out the wavelet transform in Fourier space using the 104 | Fast Fourier Transform (FFT). 105 | In the Fourier domain, the wavelet transform is simply, 106 | 107 |

108 | (3.2) . . . . . . . . . . 109 | 110 |

111 | 112 | 113 | where the ^ indicates the Fourier transform (FT), and the Fourier transform 114 | of the time series is given by: 115 | 116 |

117 | (3.3) . . . . . . . . . . 118 | 119 |

120 | 121 | To use this formula, 122 | the FT of the wavelet function should be known analytically. 123 | In addition, the wavelets must be normalized as: 124 | 125 |

126 | (3.4) . . . . . . . . . . 127 | 128 |

129 | 130 | Unlike the convolution, the FFT method allows the computation of 131 | all n points simultaneously, and can be efficiently coded using 132 | any standard FFT package. 133 |

134 | 135 |       The steps to compute the wavelet transform for a time 136 | series are thus: 137 |

    138 |
  1. Choose a mother wavelet, 139 |
  2. Find the Fourier transform of the mother wavelet, 140 |
  3. Find the Fourier transform of the time series, 141 |
  4. Choose a minimum scale s0, and all other scales, 142 |
  5. For each scale, do: 143 |
      144 |
    • Using Eqn. 3.4 (or whatever is appropriate for your 145 | mother wavelet), compute the daughter wavelet at that scale; 146 |
    • Normalize the daughter wavelet by dividing by the square-root 147 | of the total wavelet variance (the total of 148 | (Psi)2 should then be one, thus preserving 149 | the variance of the time series); 150 |
    • Multiply by the FT of your time series; 151 |
    • Using Eqn. 3.2, inverse transform back to real space; 152 |
    153 |
  6. Make a contour plot. 154 |
155 |

156 | 157 |       One problem with performing the wavelet transform in 158 | Fourier space is that this assumes the time series is periodic. The 159 | result is that signals in the wavelet transform at one end of the 160 | time series will get wrapped around to the other end. This effect 161 | is more pronouced at larger scales as the influence of each wavelet 162 | extends further in time. One way to avoid this is to pad one end of the 163 | time series with zeroes. A clever method is to pad with enough zeroes 164 | to make the length of the time series equal to a power of two, and 165 | thereby speed up the FFT as well. 166 |

167 | 168 |

169 |

170 | -- on to Monte Carlo -- 171 |

172 |
173 | 174 |
175 | back to Wavelet Home Page 176 | 177 | 178 | 179 | 180 | 181 | -------------------------------------------------------------------------------- /wave_matlab/wave_signif.m: -------------------------------------------------------------------------------- 1 | %WAVE_SIGNIF Significance testing for the 1D Wavelet transform WAVELET 2 | % 3 | % [SIGNIF,FFT_THEOR] = ... 4 | % wave_signif(Y,DT,SCALE,SIGTEST,LAG1,SIGLVL,DOF,MOTHER,PARAM) 5 | % 6 | % INPUTS: 7 | % 8 | % Y = the time series, or, the VARIANCE of the time series. 9 | % (If this is a single number, it is assumed to be the variance...) 10 | % DT = amount of time between each Y value, i.e. the sampling time. 11 | % SCALE = the vector of scale indices, from previous call to WAVELET. 12 | % 13 | % 14 | % OUTPUTS: 15 | % 16 | % SIGNIF = significance levels as a function of SCALE 17 | % FFT_THEOR = output theoretical red-noise spectrum as fn of PERIOD 18 | % 19 | % 20 | % OPTIONAL INPUTS: 21 | % *** Note *** setting any of the following to -1 will cause the default 22 | % value to be used. 23 | % 24 | % SIGTEST = 0, 1, or 2. If omitted, then assume 0. 25 | % 26 | % If 0 (the default), then just do a regular chi-square test, 27 | % i.e. Eqn (18) from Torrence & Compo. 28 | % If 1, then do a "time-average" test, i.e. Eqn (23). 29 | % In this case, DOF should be set to NA, the number 30 | % of local wavelet spectra that were averaged together. 31 | % For the Global Wavelet Spectrum, this would be NA=N, 32 | % where N is the number of points in your time series. 33 | % If 2, then do a "scale-average" test, i.e. Eqns (25)-(28). 34 | % In this case, DOF should be set to a 35 | % two-element vector [S1,S2], which gives the scale 36 | % range that was averaged together. 37 | % e.g. if one scale-averaged scales between 2 and 8, 38 | % then DOF=[2,8]. 39 | % 40 | % LAG1 = LAG 1 Autocorrelation, used for SIGNIF levels. Default is 0.0 41 | % 42 | % SIGLVL = significance level to use. Default is 0.95 43 | % 44 | % DOF = degrees-of-freedom for signif test. 45 | % IF SIGTEST=0, then (automatically) DOF = 2 (or 1 for MOTHER='DOG') 46 | % IF SIGTEST=1, then DOF = NA, the number of times averaged together. 47 | % IF SIGTEST=2, then DOF = [S1,S2], the range of scales averaged. 48 | % 49 | % Note: IF SIGTEST=1, then DOF can be a vector (same length as SCALEs), 50 | % in which case NA is assumed to vary with SCALE. 51 | % This allows one to average different numbers of times 52 | % together at different scales, or to take into account 53 | % things like the Cone of Influence. 54 | % See discussion following Eqn (23) in Torrence & Compo. 55 | % 56 | % 57 | %---------------------------------------------------------------------------- 58 | % Copyright (C) 1995-1998, Christopher Torrence and Gilbert P. Compo 59 | % University of Colorado, Program in Atmospheric and Oceanic Sciences. 60 | % This software may be used, copied, or redistributed as long as it is not 61 | % sold and this copyright notice is reproduced on each copy made. This 62 | % routine is provided as is without any express or implied warranties 63 | % whatsoever. 64 | %---------------------------------------------------------------------------- 65 | function [signif,fft_theor] = ... 66 | wave_signif(Y,dt,scale1,sigtest,lag1,siglvl,dof,mother,param); 67 | 68 | if (nargin < 9), param = -1;, end 69 | if (nargin < 8), mother = -1;, end 70 | if (nargin < 7), dof = -1;, end 71 | if (nargin < 6), siglvl = -1;, end 72 | if (nargin < 5), lag1 = -1;, end 73 | if (nargin < 4), sigtest = -1;, end 74 | if (nargin < 3) 75 | error('Must input a vector Y, sampling time DT, and SCALE vector') 76 | end 77 | 78 | n1 = length(Y); 79 | J1 = length(scale1) - 1; 80 | scale(1:J1+1) = scale1; 81 | s0 = min(scale); 82 | dj = log(scale(2)/scale(1))/log(2.); 83 | 84 | if (n1 == 1) 85 | variance = Y; 86 | else 87 | variance = std(Y)^2; 88 | end 89 | 90 | if (sigtest == -1), sigtest = 0;, end 91 | if (lag1 == -1), lag1 = 0.0;, end 92 | if (siglvl == -1), siglvl = 0.95;, end 93 | if (mother == -1), mother = 'MORLET';, end 94 | 95 | mother = upper(mother); 96 | 97 | % get the appropriate parameters [see Table(2)] 98 | if (strcmp(mother,'MORLET')) %---------------------------------- Morlet 99 | if (param == -1), param = 6.;, end 100 | k0 = param; 101 | fourier_factor = (4*pi)/(k0 + sqrt(2 + k0^2)); % Scale-->Fourier [Sec.3h] 102 | empir = [2.,-1,-1,-1]; 103 | if (k0 == 6), empir(2:4)=[0.776,2.32,0.60];, end 104 | elseif (strcmp(mother,'PAUL')) %-------------------------------- Paul 105 | if (param == -1), param = 4.;, end 106 | m = param; 107 | fourier_factor = 4*pi/(2*m+1); 108 | empir = [2.,-1,-1,-1]; 109 | if (m == 4), empir(2:4)=[1.132,1.17,1.5];, end 110 | elseif (strcmp(mother,'DOG')) %--------------------------------- DOG 111 | if (param == -1), param = 2.;, end 112 | m = param; 113 | fourier_factor = 2*pi*sqrt(2./(2*m+1)); 114 | empir = [1.,-1,-1,-1]; 115 | if (m == 2), empir(2:4) = [3.541,1.43,1.4];, end 116 | if (m == 6), empir(2:4) = [1.966,1.37,0.97];, end 117 | else 118 | error('Mother must be one of MORLET,PAUL,DOG') 119 | end 120 | 121 | period = scale.*fourier_factor; 122 | dofmin = empir(1); % Degrees of freedom with no smoothing 123 | Cdelta = empir(2); % reconstruction factor 124 | gamma_fac = empir(3); % time-decorrelation factor 125 | dj0 = empir(4); % scale-decorrelation factor 126 | 127 | freq = dt ./ period; % normalized frequency 128 | fft_theor = (1-lag1^2) ./ (1-2*lag1*cos(freq*2*pi)+lag1^2); % [Eqn(16)] 129 | fft_theor = variance*fft_theor; % include time-series variance 130 | signif = fft_theor; 131 | if (dof == -1), dof = dofmin;, end 132 | 133 | if (sigtest == 0) % no smoothing, DOF=dofmin [Sec.4] 134 | dof = dofmin; 135 | chisquare = chisquare_inv(siglvl,dof)/dof; 136 | signif = fft_theor*chisquare ; % [Eqn(18)] 137 | elseif (sigtest == 1) % time-averaged significance 138 | if (length(dof) == 1), dof=zeros(1,J1+1)+dof;, end 139 | truncate = find(dof < 1); 140 | dof(truncate) = ones(size(truncate)); 141 | dof = dofmin*sqrt(1 + (dof*dt/gamma_fac ./ scale).^2 ); % [Eqn(23)] 142 | truncate = find(dof < dofmin); 143 | dof(truncate) = dofmin*ones(size(truncate)); % minimum DOF is dofmin 144 | for a1 = 1:J1+1 145 | chisquare = chisquare_inv(siglvl,dof(a1))/dof(a1); 146 | signif(a1) = fft_theor(a1)*chisquare; 147 | end 148 | elseif (sigtest == 2) % time-averaged significance 149 | if (length(dof) ~= 2) 150 | error('DOF must be set to [S1,S2], the range of scale-averages') 151 | end 152 | if (Cdelta == -1) 153 | error(['Cdelta & dj0 not defined for ',mother, ... 154 | ' with param = ',num2str(param)]) 155 | end 156 | s1 = dof(1); 157 | s2 = dof(2); 158 | avg = find((scale >= s1) & (scale <= s2)); % scales between S1 & S2 159 | navg = length(avg); 160 | if (navg == 0) 161 | error(['No valid scales between ',num2str(s1),' and ',num2str(s2)]) 162 | end 163 | Savg = 1./sum(1 ./ scale(avg)); % [Eqn(25)] 164 | Smid = exp((log(s1)+log(s2))/2.); % power-of-two midpoint 165 | dof = (dofmin*navg*Savg/Smid)*sqrt(1 + (navg*dj/dj0)^2); % [Eqn(28)] 166 | fft_theor = Savg*sum(fft_theor(avg) ./ scale(avg)); % [Eqn(27)] 167 | chisquare = chisquare_inv(siglvl,dof)/dof; 168 | signif = (dj*dt/Cdelta/Savg)*fft_theor*chisquare; % [Eqn(26)] 169 | else 170 | error('sigtest must be either 0, 1, or 2') 171 | end 172 | 173 | return 174 | 175 | % end of code 176 | 177 | -------------------------------------------------------------------------------- /wave_fortran/wavetest.f: -------------------------------------------------------------------------------- 1 | C**************************************************************************** 2 | C WAVETEST: Example Fortran program for WAVELET, using NINO3 SST dataset 3 | C 4 | C COMPILE: f77 chisqr.f cfftpack.f wavelet.f wavetest.f 5 | C 6 | C See "http://paos.colorado.edu/research/wavelets/" 7 | C 8 | C Copyright (C) 1998, Christopher Torrence and Gilbert P. Compo 9 | C This software may be used, copied, or redistributed as long as it is not 10 | C sold and this copyright notice is reproduced on each copy made. This 11 | C routine is provided as is without any express or implied warranties 12 | C whatsoever. 13 | C 14 | C Modified: November 1999 by Arjan van Dijk to include IMPLICIT NONE and 15 | C to convert all routines to DOUBLE precision. 16 | C**************************************************************************** 17 | 18 | PROGRAM wavetest 19 | 20 | IMPLICIT none 21 | 22 | INTEGER n,subscale,jtot 23 | DOUBLE PRECISION dt,s0,dj 24 | 25 | C these parameters depend on the particular time series 26 | PARAMETER (n=504,dt=0.25D0,s0=dt) 27 | PARAMETER (subscale=4) 28 | PARAMETER (dj=1.D0/subscale,jtot=11*subscale) 29 | C Note: for accurate reconstruction and wavelet-derived variance 30 | C do not pad with zeroes, set s0=dt (for Paul set s0=dt/4), and use 31 | C a large "jtot" (even though the extra scales will be within 32 | C the cone of influence). 33 | C For plotting purposes, it is only necessary to use 34 | C s0=2dt (for Morlet) and "jtot" from Eqn(10) Torrence&Compo(1998). 35 | 36 | INTEGER mother,ibase2,npad 37 | DOUBLE PRECISION sst(n),recon_sst(n),param,pi 38 | DOUBLE PRECISION scale(jtot),period(jtot),coi(n) 39 | DOUBLE COMPLEX wave(n,jtot) 40 | 41 | INTEGER i,j,isigtest,javg1,javg2 42 | DOUBLE PRECISION lag1,siglvl,dof(jtot) 43 | DOUBLE PRECISION fft_theor(jtot),signif(jtot),ymean,variance 44 | DOUBLE PRECISION recon_mean,recon_vari 45 | DOUBLE PRECISION Cdelta,psi0 46 | DOUBLE PRECISION global_ws(jtot),global_signif(jtot) 47 | DOUBLE PRECISION savg_dof(jtot),savg_signif(jtot),sstENSO(n) 48 | 49 | pi = 4.D0*ATAN(1.D0) 50 | ibase2 = NINT(LOG(DBLE(n))/LOG(2.D0))+1 51 | npad = INT(2.D0**ibase2) 52 | C npad = n ! this is for no padding with zeroes 53 | 54 | C*************************************************** Wavelet transform 55 | 56 | C** let the WAVELET subroutine choose the defaults for these: 57 | mother = 0 58 | param = 6.D0 59 | 60 | C** read in the NINO3 SST data 61 | OPEN(UNIT=11,FILE='sst_nino3.dat',STATUS='old') 62 | READ(11,*) sst 63 | CLOSE(11) 64 | PRINT'(/,"sst(1)=",F6.2," sst(n) = ",F6.2,/)',sst(1),sst(n) 65 | 66 | C** get the wavelet transform 67 | CALL WAVELET(n,sst,dt,mother,param,s0,dj,jtot,npad, 68 | & wave,scale,period,coi) 69 | 70 | 71 | C*************************************************** Significance testing 72 | 73 | C** local significance test 74 | isigtest = 0 75 | lag1 = 0.72D0 76 | siglvl = 0.05D0 77 | CALL WAVE_SIGNIF (isigtest,n,sst,dt,mother,param,dj,jtot, 78 | & scale,period,lag1,siglvl,dof,fft_theor,signif, 79 | & ymean,variance,Cdelta,psi0) 80 | 81 | 82 | C** global wavelet spectrum & significance test 83 | isigtest = 1 84 | lag1 = 0.72D0 85 | siglvl = 0.05D0 86 | DO 10 j=1,jtot 87 | DO 20 i=1,n 88 | global_ws(j) = global_ws(j) + ABS(wave(i,j))**2 89 | 20 CONTINUE 90 | global_ws(j) = global_ws(j)/n 91 | dof(j) = n - scale(j) 92 | 10 CONTINUE 93 | 94 | CALL WAVE_SIGNIF (isigtest,n,sst,dt,mother,param,dj,jtot, 95 | & scale,period,lag1,siglvl,dof,fft_theor,global_signif, 96 | & ymean,variance,Cdelta,psi0) 97 | 98 | 99 | C** scale-average time series & significance test 100 | isigtest = 2 101 | lag1 = 0.72D0 102 | siglvl = 0.05D0 103 | C scale average between 2 and 7.9 years 104 | savg_dof(1) = 2.0D0 105 | savg_dof(2) = 7.9D0 106 | C find the "j"-values that correspond to savg_dof(1) & savg_dof(2) 107 | javg1 = 0 108 | javg2 = 0 109 | DO 30 j=1,jtot 110 | IF ((scale(j).GE.savg_dof(1)).AND.(javg1.EQ.0)) javg1 = j 111 | IF (scale(j).LE.savg_dof(2)) javg2 = j 112 | 30 CONTINUE 113 | C call wave_signif first, to get the value of "Cdelta" 114 | CALL WAVE_SIGNIF (isigtest,n,sst,dt,mother,param,dj,jtot, 115 | & scale,period,lag1,siglvl,savg_dof,fft_theor,savg_signif, 116 | & ymean,variance,Cdelta,psi0) 117 | C construct the scale-averaged time series [Eqn(24)] 118 | DO 50 i=1,n 119 | sstENSO(i) = 0.D0 120 | DO 60 j=javg1,javg2 121 | sstENSO(i) = sstENSO(i) + (ABS(wave(i,j))**2)/scale(j) 122 | 60 CONTINUE 123 | sstENSO(i) = dj*dt*sstENSO(i)/Cdelta 124 | 50 CONTINUE 125 | 126 | 127 | C************************************************************* print results 128 | PRINT*,' n=',n 129 | PRINT*,' dt=',dt 130 | PRINT*,' mother=',mother 131 | PRINT*,' param=',param 132 | PRINT*,' s0=',s0 133 | PRINT*,' dj=',dj 134 | PRINT*,' jtot=',jtot 135 | PRINT*,' npad=',npad 136 | PRINT'(/,"Let w = wave(n/2,j)",/)' 137 | PRINT'(A4,7A10)',"j","Scale","Period","ABS(w)^2","phase(w)", 138 | & "5%signif","Global","GWS5%sig" 139 | PRINT'(I4,7F10.3)',(j,scale(j),period(j), 140 | & ABS(wave(n/2,j))**2, 141 | & ATAN2(DIMAG(wave(n/2,j)),DBLE(wave(n/2,j)))*180.D0/pi, 142 | & signif(j),global_ws(j),global_signif(j),j=1,jtot) 143 | PRINT'(/,A,F10.3)', 144 | & ' Scale-average degrees of freedom = ',savg_dof(1) 145 | PRINT'(A,F10.3,/)', 146 | & ' Scale-avg 5% significance level = ',savg_signif(1) 147 | 148 | 149 | C************************************************************ Reconstruction 150 | 151 | C** construct the wavelet derived variance (Parseval's theorem) [Eqn(14)] 152 | C Cdelta & psi0 are returned from WAVE_SIGNIF 153 | recon_vari = 0.D0 154 | DO 900 i=1,n 155 | DO 1000 j=1,jtot 156 | recon_vari = recon_vari + (ABS(wave(i,j))**2)/scale(j) 157 | 1000 CONTINUE 158 | 900 CONTINUE 159 | recon_vari = dj*dt*recon_vari/(Cdelta*n) 160 | PRINT'(A,F14.5)',' Reconstructed variance=',recon_vari 161 | PRINT'(A,F14.5)',' Original variance =',variance 162 | PRINT'(A,F14.5,A,/)',' Ratio = ',recon_vari/variance, 163 | & ' (this is low due to padding with zeroes)' 164 | 165 | C** reconstruct the time series [Eqn(11)] 166 | C check mean and RMS difference of reconstructed time series 167 | recon_mean=0.D0 168 | recon_vari = 0.D0 169 | DO 1100 i=1,n 170 | recon_sst(i)=0.D0 171 | DO 1200 j=1,jtot 172 | recon_sst(i) = recon_sst(i)+(DBLE(wave(i,j)))/SQRT(scale(j)) 173 | 1200 CONTINUE 174 | recon_sst(i) = dj*SQRT(dt)*recon_sst(i)/(Cdelta*psi0) 175 | recon_vari = recon_vari+(sst(i)-ymean-recon_sst(i))**2 176 | recon_mean = recon_mean + recon_sst(i) 177 | 1100 CONTINUE 178 | recon_mean = recon_mean/n 179 | recon_vari = SQRT(recon_vari/n) 180 | 181 | PRINT'(A,F14.6)',' Reconstructed mean=',recon_mean 182 | PRINT'(A,F14.6)',' Original mean =',ymean 183 | PRINT'(A,F14.6,/)',' Root-mean-square difference of time series=', 184 | & recon_vari 185 | 186 | END 187 | -------------------------------------------------------------------------------- /wave_idl/wavetest.pro: -------------------------------------------------------------------------------- 1 | ;************************************************************** WAVETEST 2 | ;+ 3 | ; NAME: WAVETEST 4 | ; 5 | ; PURPOSE: Example IDL program for WAVELET, using ENSO SST dataset 6 | ; 7 | ; EXECUTION: 8 | ; 9 | ; IDL> .run wavetest 10 | ; 11 | ; 12 | ; See "http://paos.colorado.edu/research/wavelets/" 13 | ; Written January 1998 by C. Torrence 14 | ; 15 | ;- 16 | ;************************************************************** 17 | 18 | compile_opt idl2 19 | 20 | if (0) then begin ; original dataset 21 | n = 504 22 | sst = FLTARR(n) 23 | OPENR,1,'sst_nino3.dat' ; input SST time series 24 | READF,1,sst 25 | CLOSE,1 26 | dt = 0.25 27 | dtName = 'seasonal' 28 | years = [1871, 1996] 29 | contourLevels = [0.5,1,2,4] 30 | dataset = 'NINO3' 31 | endif else begin 32 | years = intarr(2) 33 | openr, 1, 'nino34.long.data' 34 | readf, 1, years 35 | data = fltarr(13, years[1] - years[0] + 1) 36 | readf, 1, data 37 | close, 1 38 | data = data[1:12,*] 39 | fullYears = total(data gt 0, 1) eq 12 40 | data = data[*, where(fullYears, nyears)] 41 | years[1] = years[0] + nyears - 1 42 | annualCycle = total(data, 2)/nyears 43 | sst = data - rebin(annualCycle, 12, nyears) 44 | sst = sst[*] 45 | dt = 1d/12 46 | dtName = 'monthly' 47 | n = n_elements(sst) 48 | contourLevels = [1, 2, 4, 8] 49 | dataset = 'NINO3.4' 50 | endelse 51 | 52 | ;------------------------------------------------------ Computation 53 | 54 | sst = sst - MEAN(sst) 55 | 56 | time = FINDGEN(n)*dt + years[0] ; construct time array 57 | xrange = [years[0]/10*10,(years[1] + 9)/10*10] ; plotting range 58 | pad = 1 59 | s0 = dt ; this says start at a scale of 3 months 60 | dj = 0.25 ; this will do 4 sub-octaves per octave 61 | j1 = 9./dj ; this says do 9 powers-of-two with dj sub-octaves each 62 | mother = 'Morlet' 63 | recon_sst = sst ; save an extra copy, so we don't erase original sst 64 | 65 | ; estimate lag-1 autocorrelation, for red-noise significance tests 66 | lag1 = (A_CORRELATE(sst,1) + SQRT(A_CORRELATE(sst,2)))/2. 67 | 68 | ; Wavelet transform: 69 | wave = WAVELET(recon_sst,dt,PERIOD=period,SCALE=scale,S0=s0, $ 70 | PAD=pad,COI=coi,DJ=dj,J=j1,MOTHER=mother,/RECON) 71 | power = (ABS(wave))^2 ; compute wavelet power spectrum 72 | global_ws = TOTAL(power,1)/n ; global wavelet spectrum (GWS) 73 | J = N_ELEMENTS(scale) - 1 74 | 75 | ; Significance levels: 76 | signif = WAVE_SIGNIF(sst,dt,scale,0, $ 77 | LAG1=lag1,SIGLVL=0.95,MOTHER=mother) 78 | signif = REBIN(TRANSPOSE(signif),n,J+1) ; expand signif --> (J+1)x(N) array 79 | signif = power/signif ; where ratio > 1, power is significant 80 | 81 | ; GWS significance levels: 82 | dof = n - scale ; the -scale corrects for padding at edges 83 | global_signif = WAVE_SIGNIF(sst,dt,scale,1, $ 84 | LAG1=lag1,DOF=dof,MOTHER=mother,CDELTA=Cdelta,PSI0=psi0) 85 | 86 | ; check total variance (Parseval's theorem) [Eqn(14)] 87 | scale_avg = REBIN(TRANSPOSE(scale),n,J+1) ; expand scale-->(J+1)x(N) array 88 | power_norm = power/scale_avg 89 | variance = (MOMENT(sst))[1] 90 | recon_variance = dj*dt/(Cdelta*n)*TOTAL(power_norm) ; [Eqn(14)] 91 | 92 | IF (N_ELEMENTS(recon_sst) GT 1) THEN BEGIN 93 | recon_variance = (MOMENT(recon_sst))[1] 94 | ; RMS of Reconstruction [Eqn(11)] 95 | rms_error = SQRT(TOTAL((sst - recon_sst)^2)/n) 96 | PRINT 97 | PRINT,' ******** RECONSTRUCTION ********' 98 | PRINT,'original variance =',variance,' degC^2' 99 | PRINT,'reconstructed var =',FLOAT(recon_variance),' degC^2' 100 | PRINT,'Ratio = ',recon_variance/variance 101 | PRINT,'root-mean-square error of reconstructed sst = ',rms_error,' degC' 102 | PRINT 103 | IF (mother EQ 'DOG') THEN BEGIN 104 | PRINT,'Note: for better reconstruction with the DOG, you need' 105 | PRINT,' to use a very small s0.' 106 | ENDIF 107 | PRINT 108 | ENDIF 109 | 110 | ; Scale-average between El Nino periods of 2--8 years 111 | avg = WHERE((scale GE 2) AND (scale LT 8)) 112 | scale_avg = dj*dt/Cdelta*TOTAL(power_norm[*,avg],2) ; [Eqn(24)] 113 | scaleavg_signif = WAVE_SIGNIF(sst,dt,scale,2, $ 114 | LAG1=lag1,SIGLVL=0.95,DOF=[2,7.9],MOTHER=mother) 115 | 116 | 117 | ;------------------------------------------------------ Plotting 118 | 119 | w = WINDOW(DIMENSIONS=[900,1000], LOCATION=[100, 0]) 120 | 121 | ;--- Plot time series 122 | pos1 = [0.1,0.75,0.7,0.95] 123 | p = PLOT(time, sst, '2', XRANGE=xrange, /CURRENT, $ 124 | XTITLE='Time (year)',YTITLE=dataset + ' SST (!Uo!NC)', $ 125 | TITLE='a) ' + dataset + ' Sea Surface Temperature (' + dtName + ')', $ 126 | LAYOUT=[1,3,1], MARGIN=[0.1,0.15,0.3,0.15], YMINOR=1) 127 | IF (N_ELEMENTS(recon_sst) GT 1) THEN begin 128 | ; p = PLOT(time,recon_sst,COLOR='red', /OVERPLOT) 129 | endif 130 | t = TEXT(0.85,0.85,/NORM,ALIGN=0.5,FONT_SIZE=12, $ 131 | 'Wavelet Analysis'+$ 132 | '!C!CC. Torrence & G.P. Compo'+$ 133 | '!C!Chttp://paos.colorado.edu/!Cresearch/wavelets/') 134 | 135 | ;--- Contour plot wavelet power spectrum 136 | yrange = [64,0.5] ; years 137 | colors = [80,120,160,200] 138 | colors = ['bisque','orange','orange_red','dark_red'] 139 | c_colors = (OrderedHash(!color))[colors.ToUpper()] 140 | c_colors = (c_colors.Values()).ToArray(/TRANSPOSE) 141 | period2 = FIX(ALOG(period)/ALOG(2)) ; integer powers of 2 in period 142 | ytickv = 2.^(period2[UNIQ(period2)]) ; unique powers of 2 143 | ytickv = ytickv[WHERE(ytickv ge MIN(yrange) and ytickv le MAX(yrange))] 144 | pos2 = [pos1[0],0.35,pos1[2],0.65] 145 | 146 | cLabel = STRING(contourLevels, format='(10(g0,:,","))') 147 | 148 | c = CONTOUR(power,time,period, /CURRENT, $ 149 | LAYOUT=[1,3,2], MARGIN=[0.1,0.15,0.3,0.15], $ 150 | AXIS_STYLE=1, XRANGE=xrange,YRANGE=yrange, /YLOG, $ 151 | YTICKV=ytickv, YMINOR=0, $ 152 | C_VALUE=contourLevels,C_COLOR=c_colors,/FILL, $ 153 | XTITLE='Time (year)',YTITLE='Period (years)', $ 154 | TITLE='b) Wavelet Power Spectrum (contours at ' + cLabel + '!Uo!NC!U2!N)') 155 | 156 | ; significance contour 157 | c = CONTOUR(signif,time,period,/OVERPLOT,C_VALUE=1,C_THICK=2, $ 158 | C_LABEL_SHOW=0, COLOR='black') 159 | 160 | ; cone-of-influence, anything "below" is dubious 161 | x = [time[0],time,time[-1]] 162 | y = [MAX(period),coi > 0.00001,MAX(period)] 163 | for angle=-45,45,90 do begin 164 | p = POLYGON(x, y, /DATA, TARGET=c, FILL_COLOR='gray', $ 165 | /FILL_BACKGROUND, PATTERN_ORIENT=angle, PATTERN_SPACING=15) 166 | endfor 167 | p = PLOT(time, coi, /OVERPLOT, COLOR='gray') 168 | 169 | ;--- Plot global wavelet spectrum 170 | pos3 = [0.74,pos2[1],0.95,pos2[3]] 171 | blank = REPLICATE(' ',29) 172 | p = PLOT(global_ws,period, /CURRENT, $ 173 | LAYOUT=[2,3,4], MARGIN=[0.49,0.15,0.1,0.15], $ 174 | AXIS_STYLE=1, XRANGE=[0,MAX(global_ws)], YRANGE=yrange, /YLOG, $ 175 | YTICKV=ytickv, YTICKNAME=blank, YMINOR=0, YTICKLEN=0.08, $ 176 | XTITLE='Power (!Uo!NC!U2!N)',TITLE='c) Global Wavelet Spectrum') 177 | p = PLOT(global_signif,period,'--', /OVERPLOT) 178 | 179 | ;--- Plot 2--8 yr scale-average time series 180 | pos4 = [pos1[0],0.05,pos1[2],0.25] 181 | p = PLOT(time, scale_avg, /CURRENT, $ 182 | LAYOUT=[1,3,3], MARGIN=[0.1,0.15,0.3,0.15], $ 183 | XRANGE=xrange,YRANGE=[0,MAX(scale_avg)*1.25],THICK=2, $ 184 | XTITLE='Time (year)',YTITLE='Avg variance (!Uo!NC!U2!N)', $ 185 | TITLE='d) 2-8 yr Scale-average Time Series') 186 | p = PLOT(xrange, scaleavg_signif+[0,0], '--', /OVERPLOT) 187 | 188 | END 189 | -------------------------------------------------------------------------------- /wave_idl/wave_coherency.pro: -------------------------------------------------------------------------------- 1 | ;****************************************************** WAVE_COHERENCY 2 | ;+ 3 | ; WAVE_COHERENCY 4 | ; 5 | ; PURPOSE: Compute the wavelet coherency between two time series. 6 | ; 7 | ; 8 | ; CALLING SEQUENCE: 9 | ; 10 | ; WAVE_COHERENCY, $ 11 | ; wave1,time1,scale1, $ 12 | ; wave2,time2,scale2, $ 13 | ; WAVE_COHER=wave_coher,WAVE_PHASE=wave_phase, $ 14 | ; TIME_OUT=time_out,SCALE_OUT=scale_out 15 | ; 16 | ; 17 | ; INPUTS: 18 | ; 19 | ; WAVE1 = wavelet power spectrum for time series #1 20 | ; TIME1 = a vector of times for time series #1 21 | ; SCALE1 = a vector of scales for time series #1 22 | ; WAVE2 = wavelet power spectrum for time series #2 23 | ; TIME2 = a vector of times for time series #2 24 | ; SCALE2 = a vector of scales for time series #2 25 | ; 26 | ; 27 | ; OPTIONAL KEYWORD INPUTS: 28 | ; 29 | ; DT = amount of time between each Y value, i.e. the sampling time. 30 | ; If not input, then calculated from TIME1(1)-TIME1(0) 31 | ; 32 | ; DJ = the spacing between discrete scales. 33 | ; If not input, then calculated from SCALE1 34 | ; 35 | ; VERBOSE = if set, then print out the scales and system time 36 | ; 37 | ; NOSMOOTH = if set, then just compute the GLOBAL_COHER, GLOBAL_PHASE, 38 | ; and the unsmoothed CROSS_WAVELET and return 39 | ; 40 | ; 41 | ; OPTIONAL KEYWORD OUTPUTS: 42 | ; 43 | ; WAVE_COHER = the wavelet coherency, as a function of 44 | ; TIME_OUT and SCALE_OUT 45 | ; 46 | ; TIME_OUT = the time vector, given by the overlap of TIME1 and TIME2 47 | ; 48 | ; SCALE_OUT = the scale vector of scale indices, given by the overlap 49 | ; of SCALE1 and SCALE2 50 | ; 51 | ; COI_OUT = the vector of the cone-of-influence 52 | ; 53 | ; GLOBAL_COHER = the global (or mean) coherence averaged over all times. 54 | ; 55 | ; GLOBAL_PHASE = the global (or mean) phase averaged over all times 56 | ; 57 | ; CROSS_WAVELET = the cross wavelet between the time series 58 | ; 59 | ; POWER1 = the wavelet power spectrum; should be the same as WAVE1 60 | ; if TIME1 and TIME2 are identical, otherwise it is only the 61 | ; overlapping portion. If NOSMOOTH is set, 62 | ; then this is unsmoothed, otherwise it is smoothed. 63 | ; 64 | ; POWER2 = same as POWER1 but for time series #2 65 | ; 66 | ; 67 | ;---------------------------------------------------------------------------- 68 | ; Copyright (C) 1998-2005, Christopher Torrence 69 | ; This software may be used, copied, or redistributed as long as it is not 70 | ; sold and this copyright notice is reproduced on each copy made. This 71 | ; routine is provided as is without any express or 72 | ; implied warranties whatsoever. 73 | ; 74 | ; Reference: Torrence, C. and P. J. Webster, 1999: Interdecadal changes in the 75 | ; ENSO-monsoon system. J. Climate, 12, 2679-2690. 76 | ; 77 | ; Please send a copy of any publications to C. Torrence: 78 | ; Dr. Christopher Torrence 79 | ; Research Systems, Inc. 80 | ; 4990 Pearl East Circle 81 | ; Boulder, CO 80301, USA 82 | ; E-mail: chris[AT]rsinc[DOT]com 83 | ;---------------------------------------------------------------------------- 84 | ;- 85 | 86 | 87 | 88 | ;****************************************************************** WAVELET 89 | PRO wave_coherency, $ 90 | wave1,time1,scale1,wave2,time2,scale2, $ ;*** required inputs 91 | COI1=coi1, $ 92 | DT=dt,DJ=dj, $ 93 | WAVE_COHER=wave_coher,WAVE_PHASE=wave_phase, $ 94 | TIME_OUT=time_out,SCALE_OUT=scale_out,COI_OUT=coi_out, $ 95 | GLOBAL_COHER=global_coher,GLOBAL_PHASE=global_phase, $ 96 | CROSS_WAVELET=cross_wavelet,POWER1=power1,POWER2=power2, $ 97 | NOSMOOTH=nosmooth, $ 98 | VERBOSE=verbose 99 | 100 | ; ON_ERROR,2 101 | 102 | verbose = KEYWORD_SET(verbose) 103 | 104 | ;*** find overlapping times 105 | time_start = MIN(time1) > MIN(time2) 106 | time_end = MAX(time1) < MAX(time2) 107 | time1_start = MIN(WHERE((time1 GE time_start))) 108 | time1_end = MAX(WHERE((time1 LE time_end))) 109 | time2_start = MIN(WHERE((time2 GE time_start))) 110 | time2_end = MAX(WHERE((time2 LE time_end))) 111 | 112 | ;*** find overlapping scales 113 | scale_start = MIN(scale1) > MIN(scale2) 114 | scale_end = MAX(scale1) < MAX(scale2) 115 | scale1_start = MIN(WHERE((scale1 GE scale_start))) 116 | scale1_end = MAX(WHERE((scale1 LE scale_end))) 117 | scale2_start = MIN(WHERE((scale2 GE scale_start))) 118 | scale2_end = MAX(WHERE((scale2 LE scale_end))) 119 | 120 | ;*** cross wavelet & individual wavelet power 121 | cross_wavelet = wave1(time1_start:time1_end,scale1_start:scale1_end)*$ 122 | CONJ(wave2(time2_start:time2_end,scale2_start:scale2_end)) 123 | power1 = ABS(wave1(time1_start:time1_end,scale1_start:scale1_end))^2 124 | power2 = ABS(wave2(time2_start:time2_end,scale2_start:scale2_end))^2 125 | 126 | IF (N_ELEMENTS(dt) LE 0) THEN dt = time1(1) - time1(0) 127 | ntime = time1_end - time1_start + 1 128 | nj = scale1_end - scale1_start + 1 129 | IF (N_ELEMENTS(dj) LE 0) THEN dj = ALOG(scale1(1)/scale1(0))/ALOG(2) 130 | scale = scale1(scale1_start:scale1_end) 131 | IF (verbose) THEN PRINT,dt,ntime,dj,nj 132 | time_out = time1(time1_start:time1_end) 133 | scale_out = scale1(scale1_start:scale1_end) 134 | IF (N_ELEMENTS(coi1) EQ N_ELEMENTS(time1)) THEN $ 135 | coi_out = coi1(time1_start:time1_end) 136 | 137 | ; calculate global coherency before doing local smoothing 138 | global1 = TOTAL(power1,1) 139 | global2 = TOTAL(power2,1) 140 | global_cross = TOTAL(cross_wavelet,1) 141 | global_coher = ABS(global_cross)^2/(global1*global2) 142 | global_phase = 180./!PI*ATAN(IMAGINARY(global_cross),FLOAT(global_cross)) 143 | 144 | IF KEYWORD_SET(nosmooth) THEN RETURN 145 | 146 | FOR j=0,nj-1 DO BEGIN ;*** time-smoothing 147 | st1 = SYSTIME(1) 148 | nt = LONG(4L*scale(j)/dt)/2L*4 + 1L 149 | time_wavelet = (FINDGEN(nt) - nt/2)*dt/scale(j) 150 | wave_function = EXP(-time_wavelet^2/2.) ;*** Morlet 151 | wave_function = FLOAT(wave_function/TOTAL(wave_function)) ; normalize 152 | nz = nt/2 153 | zeros = COMPLEX(FLTARR(nz),FLTARR(nz)) 154 | cross_wave_slice = [zeros,cross_wavelet(*,j),zeros] 155 | cross_wave_slice = CONVOL(cross_wave_slice,wave_function) 156 | cross_wavelet(*,j) = cross_wave_slice(nz:ntime+nz-1) 157 | zeros = FLOAT(zeros) 158 | power_slice = [zeros,power1(*,j),zeros] 159 | power_slice = CONVOL(power_slice,wave_function) 160 | power1(*,j) = power_slice(nz:ntime + nz - 1) 161 | power_slice = [zeros,power2(*,j),zeros] 162 | power_slice = CONVOL(power_slice,wave_function) 163 | power2(*,j) = power_slice(nz:ntime + nz - 1) 164 | IF (verbose) THEN PRINT,j,scale(j),SYSTIME(1)-st1;,FORMAT='(I4,$)' 165 | ENDFOR ;*** time-smoothing 166 | 167 | ;*** normalize by scale 168 | scales = REBIN(TRANSPOSE(scale),ntime,nj) 169 | cross_wavelet = TEMPORARY(cross_wavelet)/scales 170 | power1 = TEMPORARY(power1)/scales 171 | power2 = TEMPORARY(power2)/scales 172 | 173 | nweights = FIX(0.6/dj/2 + 0.5)*2 - 1 ; closest (smaller) odd integer 174 | weights = REPLICATE(1.,nweights) 175 | weights = weights/TOTAL(weights) ; normalize 176 | FOR i=0,ntime-1 DO BEGIN ;*** scale-smoothing 177 | cross_wavelet(i,*) = CONVOL((cross_wavelet(i,*))(*),weights) 178 | power1(i,*) = CONVOL((power1(i,*))(*),weights) 179 | power2(i,*) = CONVOL((power2(i,*))(*),weights) 180 | ENDFOR ;*** scale-smoothing 181 | 182 | wave_phase = 180./!PI*ATAN(IMAGINARY(cross_wavelet),FLOAT(cross_wavelet)) 183 | wave_coher = (ABS(cross_wavelet)^2)/(power1*power2 > 1E-9) 184 | ; wave_phase = wave_phase + 360.*(wave_phase LT 0.) 185 | END 186 | -------------------------------------------------------------------------------- /webplot-do-not-use/waveopt.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Wave:Interactive Wavelets:Plot 4 | 5 | 6 | 7 |
8 | 9 | 10 |
11 | 12 | # str0 = ''+alt+'' 15 | # str2 = ' 

click here for postscript file

' 17 | # IF (N_ELEMENTS(errors) GT 1) THEN FOR i=0,N_ELEMENTS(errors)-1 DO PRINTF,outf,errors(i) 18 | # IF (N_ELEMENTS(errors) LE 1) THEN IF (postscript) THEN PRINTF,outf,str2 ELSE PRINTF,outf,str1 19 |
20 | # IF (N_ELEMENTS(errors) GT 1) THEN PRINTF,outf,'


21 | 22 | Fig. 1: (a) 23 | # str1 = '.' 24 | # IF (source NE '') THEN str1 = ' (from ' + source + ')' + str1 25 | # PRINTF,outf,'Time series' 26 | # PRINTF,outf,' of ' + dataset1 + str1 27 | 28 | 29 | (b) The wavelet power spectrum. 30 | 31 | # str1 = 'The power has been scaled by the global wavelet spectrum (at right).' 32 | # str2 = 'The contour levels are chosen so that 75%, 50%, 25%, and 5% of the wavelet power is above each level, respectively. 33 | # IF (gws) THEN PRINTF,outf,str1 ELSE PRINTF,outf,str2 34 | 35 | # str1 = 'Cross-hatched region is the cone of influence, where zero padding has reduced the variance.' 36 | # IF (coi1) THEN PRINTF,outf,str1 37 | 38 | # background_str = 'using a white-noise background spectrum' 39 | # lag1_string = ' lag1=' + ROUND_ANY(lag1) 40 | # IF (lag1 GT 0.0) THEN background_str = 'using a red-noise (autoregressive' + lag1_string + ') background spectrum' 41 | # background_str = [background_str,'using the global wavelet spectrum as the background'] 42 | 43 | # str1 = 'Black contour is the '+ROUND_ANY(siglvl)+'% significance level, ' 44 | # IF (siglvl NE 0) THEN PRINTF,outf,str1+background_str[do_global]+'.' 45 | 46 | # str1 = '(c) The global wavelet power spectrum 47 | # str2 = ' (black line). The dashed line is the '+ROUND_ANY(siglvl)+'% significance level for the global wavelet spectrum, ' 48 | # str2 = str2 + background_str[0] 49 | # IF ((siglvl NE 0) AND (N_ELEMENTS(globalsignif) GT 1)) THEN str1 = str1 + str2 50 | # PRINTF,outf,str1+'.' 51 | 52 | # IF (N_ELEMENTS(errors) GT 1) THEN PRINTF,outf,'-->' ;comment out the caption 53 | 54 |
55 | 56 | 57 |
58 | 59 | 60 |
61 | 62 |

Wavelet Options:

63 | # select = (['',' SELECTED']) 64 | # morlet = (mother EQ "Morlet") 65 | # paul = (mother EQ "Paul") 66 | # dog = (mother EQ "DOG") 67 | Wavelet: 68 | 73 | # PRINTF,outf,'' 74 | 75 | Param: 76 | # str1 = '' 78 |
79 | 80 | s0/dt = 81 | # str1 = '' 83 | Starting scale, multiple of dt 84 |
85 | 86 |     dj = 87 | # str1 = '' 89 | delta-j, scale width 90 |
91 | 92 |   Oct = 93 | # str1 = '' 95 | #octaves, max scale is s0 2Oct 96 |
97 | 98 | # str1 = '' 100 |  Pad with zeroes 101 |
102 | 103 | # str1 = '' 105 |  Normalize by global wavelet 106 |
107 | 108 | Significance level = 109 | # str1 = '' 111 | % (0=don't plot) 112 |

113 | 114 | Background spectrum for significance:
115 | # str1 = ' ' 117 |  Global wavelet spectrum, or
118 | # str1 = ' ' 120 |  Red noise (lag1 autoregressive) 121 |

122 | 123 | Lag1* = 124 | # str1 = '' 126 | (white noise=0.0) 127 |

128 | 129 | 130 |

131 | 132 |

Plotting Options:

133 | 134 | # str1 = '' 136 | Screen 137 |
138 | # str1 = '' 140 | Postscript file 141 |
142 | # str1 = '' 144 | Encapsulated postscript file 145 | 146 |

147 | 148 | #; PRINTF,outf,'t0=' + ROUND_ANY(t0) + ',' 149 | #; PRINTF,outf,'dt=' + ROUND_ANY(dt) + '
' 150 | From 151 | # str1 = '' 153 | until 154 | # str1 = '' 156 |
157 | # PRINTF,outf,'Range = ' + ROUND_ANY(time0) + ' - ' + ROUND_ANY(time1) 158 |
159 | 160 | # str1 = '' 162 |  Cone of influence 163 |
164 | 165 | # str1 = '' 167 |  Black & white 168 |
169 | 170 | x-label: 171 | # str1 = '' 173 |
174 | 175 | y-label: 176 | # str1 = '' 178 | # PRINTF,outf,'' 179 |
180 | 181 | Long name: 182 | # str1 = '' 184 |
185 | 186 | Short name: 187 | # str1 = '' 189 |
190 | 191 | Data units: 192 | # str1 = '' 194 |
195 | 196 | Time units: 197 | # str1 = '' 199 | 200 |

201 | 202 | 203 |

204 | 205 |
206 |  
207 |    208 |   209 | 210 |
211 |
212 | *The initial Lag1 is estimated from 213 | (a1 + a21/2)/2, where a1 and a2 214 | are the lag1 and lag2 autocorrelations. 215 |

216 | [return to Wavelet Analysis homepage] 217 |

218 |

219 | 220 | 221 | -------------------------------------------------------------------------------- /wavelet2.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Wave:Wavelets 2 5 | 6 | 7 | 8 | 9 | 10 | 11 |

Wavelet Analysis

12 | 13 |

14 | 21 |

22 | 23 |
24 | 25 |

26 |

27 | Wavelets 28 |

29 | 30 |       In the previous section 31 | we saw how one measure of the stationarity 32 | of a time series was to calculate the running variance 33 | using a fixed-width window. Although we pointed out the disadvantage 34 | of using a fixed-width window, one could repeat 35 | the analysis with a variety of window widths. By smoothly varying the 36 | window width one could then build a picture of the changes in variance 37 | versus both time and window width. The obvious problem with this 38 | technique is the simple "boxcar" shape of the window function, which 39 | introduces edge effects such as ringing. As mentioned earlier, using 40 | such a black-box-car, we still have no information on what is going on 41 | within the box, but only recover the average energy. 42 |

43 | 44 |       In Figure 2a we see an example of a wave "packet", of finite duration 45 | and with a specific frequency. One could imagine using such a shape 46 | as our window function for our analysis of variance. This "wavelet" 47 | has the advantage of incorporating a wave of a certain period, as 48 | well as being finite in extent. In fact, the wavelet shown in Figure 2a 49 | (called the Morlet wavelet) is nothing more than a Sine wave 50 | (green curve in Figure 2b) multiplied by a Gaussian envelope (red curve). 51 |

52 | 53 |


54 |
55 | Morlet 56 |
57 |
58 | 59 |
60 |
61 | Fig 2. 62 |
(a) Morlet wavelet of arbitrary width and amplitude, 63 | with time along the x-axis. (b) Construction of the Morlet 64 | wavelet (blue dashed) as a Sine curve (green) modulated by 65 | a Gaussian (red). 66 |
67 |
68 |

69 | 70 |       Assuming that the total width of this wavelet is about 15 years, 71 | we can find the correlation 72 | between this curve and the first 15 years 73 | of our time series shown in 74 | Figure 1. 75 | This single number gives us a 76 | measure of the projection of this wave packet on our data during 77 | the 1876-1890 period, i.e. how much [amplitude] does our 15-year 78 | period resemble a Sine wave of this width [frequency]. By sliding this 79 | wavelet along our time series one can then construct a new time series 80 | of the projection amplitude versus time. 81 |

82 | 83 |       Finally, one can then vary the "scale" of the wavelet by changing 84 | its width. This is the real advantage of wavelet analysis over 85 | a moving Fourier spectrum. 86 | For a window of a certain width, the sliding FFT 87 | is fitting different numbers of waves, i.e. there can be many 88 | high-frequency waves within a window, while the same window can only 89 | contain a few (or less than one) low-frequency waves. The wavelet analysis 90 | always uses a wavelet of the exact same shape, only the size scales up 91 | or down with the size of the window. 92 |

93 | 94 | 95 |       In addition to the amplitude of any periodic signals, 96 | we would also like information on the phase. 97 | In practice, 98 | the Morlet wavelet shown in Figure 2a is defined as the product 99 | of a complex exponential wave and a Gaussian envelope: 100 | 101 |

102 | (2.1) . . . . . . . . . . 103 | 104 |

105 | 106 | 107 | where Psi is the wavelet value at non-dimensional time eta, 108 | and w0 is the wavenumber. This is the basic wavelet 109 | function, but we now need some way to change the 110 | overall size as well as slide the entire wavelet along in time. 111 | We thus define the "scaled wavelets" as: 112 | 113 |

114 | (2.2) . . . . . . . . . . 115 | 116 |

117 | 118 | where s is the "dilation" parameter used to change the scale, 119 | and n is the translation parameter used to slide in time. 120 | The factor of s-1/2 is a normalization to keep the total 121 | energy of the scaled wavelet constant. 122 |

123 | 124 | 125 |       We are given a time series X, with 126 | values of xn, at time index n. Each value is 127 | separated in time by a constant time interval dt. 128 | The wavelet transform Wn(s) 129 | is just the inner product (or convolution) of the 130 | wavelet function with our original timeseries: 131 | 132 |

133 | (2.3) . . . . . . . . . . 134 | 135 |

136 | 137 | where the asterisk (*) denotes complex conjugate. 138 |

139 | 140 |       The above integral can be evaluated for 141 | various values of the scale s 142 | (usually taken to be multiples of the lowest possible frequency), 143 | as well as all values of n between the start and end dates. 144 | A two-dimensional picture of the variability can then be constructed 145 | by plotting the wavelet amplitude and phase. 146 |

147 | 148 | 149 |       Figure 3 shows the power (absolute value 150 | squared) of the wavelet transform for the NINO3 SST data. 151 | The (absolute value)2 gives information on the relative 152 | power at a certain scale and a certain time. 153 | A plot of the amplitude and phase 154 | would show the actual oscillations of the individual wavelets, rather 155 | than just their magnitude. 156 |

157 | 158 |


159 |
160 | NINO3 Wavelet 162 |
163 |
164 | 165 |
166 |
167 | Fig 3. 168 |
(a) Time series of El Niño sea surface temperature. 169 | (b) The wavelet power spectrum, using the Morlet wavelet. 170 | The x-axis is the wavelet location in time. 171 | The y-axis is the wavelet period in years. 172 | The black contours are the 10% significance regions, using a 173 | red-noise background spectrum. 174 | The red areas indicate that high El Niño activity 175 | occurred during 1880-1920 and 1965-present, while 1920-1960 176 | was relatively calm. 177 |
178 |
179 |

180 | 181 |       Comparing Figures 1 and 3 182 | it is now much clearer that there 183 | was large power in the 2-7 year ENSO period during both the earlier 184 | and latter parts of this century. 185 | In addition we can now see hints of a 16-year 186 | oscillation as well as power at even lower frequencies. 187 |

188 | 189 |       The wavelet transform also gives information on changes in frequency 190 | that may have occured. Thus, from 1960-1990 191 | the ENSO time band (2-7 years) seems to have undergone a slow oscillation 192 | in period from a 3-year period between events back in 1965 up to 193 | about a 5-year period in the early 1980s. 194 |

195 | 196 |

197 |

198 | -- on to Algorithms -- 199 |

200 |
201 | 202 |
203 | back to Wavelet Home Page 204 | 205 | 206 | 207 | -------------------------------------------------------------------------------- /wave_idl/wave_signif.pro: -------------------------------------------------------------------------------- 1 | ;************************************************************** WAVE_SIGNIF 2 | ;+ 3 | ; NAME: WAVE_SIGNIF 4 | ; 5 | ; PURPOSE: Compute the significance levels for a wavelet transform. 6 | ; 7 | ; 8 | ; CALLING SEQUENCE: 9 | ; 10 | ; result = WAVE_SIGNIF(y,dt,scale,sigtest) 11 | ; 12 | ; 13 | ; INPUTS: 14 | ; 15 | ; Y = the time series, or, the VARIANCE of the time series. 16 | ; (If this is a single number, it is assumed to be the variance...) 17 | ; 18 | ; DT = amount of time between each Y value, i.e. the sampling time. 19 | ; 20 | ; SCALE = the vector of scale indices, from previous call to WAVELET. 21 | ; 22 | ; SIGTEST = 0, 1, or 2. If omitted, then assume 0. 23 | ; 24 | ; If 0 (the default), then just do a regular chi-square test, 25 | ; i.e. Eqn (18) from Torrence & Compo. 26 | ; If 1, then do a "time-average" test, i.e. Eqn (23). 27 | ; In this case, DOF should be set to NA, the number 28 | ; of local wavelet spectra that were averaged together. 29 | ; For the Global Wavelet Spectrum, this would be NA=N, 30 | ; where N is the number of points in your time series. 31 | ; If 2, then do a "scale-average" test, i.e. Eqns (25)-(28). 32 | ; In this case, DOF should be set to a 33 | ; two-element vector [S1,S2], which gives the scale 34 | ; range that was averaged together. 35 | ; e.g. if one scale-averaged scales between 2 and 8, 36 | ; then DOF=[2,8]. 37 | ; 38 | ; 39 | ; OUTPUTS: 40 | ; 41 | ; result = significance levels as a function of SCALE, 42 | ; or if /CONFIDENCE, then confidence intervals 43 | ; 44 | ; 45 | ; OPTIONAL KEYWORD INPUTS: 46 | ; 47 | ; MOTHER = A string giving the mother wavelet to use. 48 | ; Currently, 'Morlet','Paul','DOG' (derivative of Gaussian) 49 | ; are available. Default is 'Morlet'. 50 | ; 51 | ; PARAM = optional mother wavelet parameter. 52 | ; For 'Morlet' this is k0 (wavenumber), default is 6. 53 | ; For 'Paul' this is m (order), default is 4. 54 | ; For 'DOG' this is m (m-th derivative), default is 2. 55 | ; 56 | ; LAG1 = LAG 1 Autocorrelation, used for SIGNIF levels. Default is 0.0 57 | ; 58 | ; SIGLVL = significance level to use. Default is 0.95 59 | ; 60 | ; DOF = degrees-of-freedom for signif test. 61 | ; IF SIGTEST=0, then (automatically) DOF = 2 (or 1 for MOTHER='DOG') 62 | ; IF SIGTEST=1, then DOF = NA, the number of times averaged together. 63 | ; IF SIGTEST=2, then DOF = [S1,S2], the range of scales averaged. 64 | ; 65 | ; Note: IF SIGTEST=1, then DOF can be a vector (same length as SCALEs), 66 | ; in which case NA is assumed to vary with SCALE. 67 | ; This allows one to average different numbers of times 68 | ; together at different scales, or to take into account 69 | ; things like the Cone of Influence. 70 | ; See discussion following Eqn (23) in Torrence & Compo. 71 | ; 72 | ; GWS = global wavelet spectrum. If input then this is used 73 | ; as the theoretical background spectrum, 74 | ; rather than white or red noise. 75 | ; 76 | ; CONFIDENCE = if set, then return a Confidence INTERVAL. 77 | ; For SIGTEST=0,2 this will be two numbers, the lower & upper. 78 | ; For SIGTEST=1, this will return an array (J+1)x2, 79 | ; where J+1 is the number of scales. 80 | ; 81 | ; 82 | ; OPTIONAL KEYWORD OUTPUTS: 83 | ; 84 | ; PERIOD = the vector of "Fourier" periods (in time units) that corresponds 85 | ; to the SCALEs. 86 | ; 87 | ; FFT_THEOR = output theoretical red-noise spectrum as fn of PERIOD. 88 | ; 89 | ; 90 | ;---------------------------------------------------------------------------- 91 | ; 92 | ; EXAMPLE: 93 | ; 94 | ; IDL> wave = WAVELET(y,dt,PERIOD=period,SCALE=scale) 95 | ; IDL> signif = WAVE_SIGNIF(y,dt,scale) 96 | ; IDL> signif = REBIN(TRANSPOSE(signif),ntime,nscale) 97 | ; IDL> CONTOUR,ABS(wave)^2/signif,time,period, $ 98 | ; LEVEL=1.0,C_ANNOT='95%' 99 | ; 100 | ; 101 | ;---------------------------------------------------------------------------- 102 | ; Copyright (C) 1995-1998, Christopher Torrence and Gilbert P. Compo, 103 | ; University of Colorado, Program in Atmospheric and Oceanic Sciences. 104 | ; This software may be used, copied, or redistributed as long as it is not 105 | ; sold and this copyright notice is reproduced on each copy made. This 106 | ; routine is provided as is without any express or implied warranties whatsoever. 107 | ; 108 | ; Notice: Please acknowledge the use of the above software in any publications: 109 | ; ``Wavelet software was provided by C. Torrence and G. Compo, 110 | ; and is available at URL: http://paos.colorado.edu/research/wavelets/''. 111 | ; 112 | ;---------------------------------------------------------------------------- 113 | ;- 114 | ;************************************************************* WAVE_SIGNIF 115 | FUNCTION wave_signif,y,dt,scale,sigtest, $ ;*** required inputs 116 | MOTHER=mother,PARAM=param, $ ;*** optional inputs 117 | LAG1=lag1,SIGLVL=siglvl,DOF=dof, $ ;*** optional inputs 118 | GWS=gws,CONFIDENCE=confidence, $ ;*** optional inputs 119 | FFT_THEOR=fft_theor,PERIOD=period, $ ;*** optional outputs 120 | SAVG=Savg,SMID=Smid,CDELTA=CDelta,PSI0=psi0 ;*** optional outputs 121 | 122 | compile_opt idl2 123 | 124 | ON_ERROR,2 125 | IF (N_ELEMENTS(y) LT 1) THEN MESSAGE,'Time series Y must be input' 126 | IF (N_ELEMENTS(dt) LT 1) THEN MESSAGE,'DT must be input' 127 | IF (N_ELEMENTS(scale) LT 1) THEN MESSAGE,'Scales must be input' 128 | IF (N_PARAMS() LT 4) THEN sigtest = 0 ; the default 129 | variance = N_ELEMENTS(y) eq 1 ? y : (MOMENT(y))[1] 130 | 131 | ;....check keywords & optional inputs 132 | IF (N_ELEMENTS(mother) LT 1) THEN mother = 'MORLET' 133 | IF (N_ELEMENTS(param) LT 1) THEN param = -1 134 | IF (N_ELEMENTS(siglvl) LT 1) THEN siglvl = 0.95 135 | IF (N_ELEMENTS(lag1) LT 1) THEN lag1 = 0.0 136 | confidence = KEYWORD_SET(confidence) 137 | 138 | lag1 = lag1[0] 139 | 140 | J = N_ELEMENTS(scale) - 1 141 | s0 = MIN(scale) 142 | dj = ALOG(scale[1]/scale[0])/ALOG(2) 143 | 144 | CASE (STRUPCASE(mother)) OF 145 | 'MORLET': BEGIN 146 | IF (param EQ -1) THEN k0=6d ELSE k0=param 147 | fourier_factor = (4*!PI)/(k0 + SQRT(2+k0^2)) ; [Sec.3h] 148 | empir = [2.,-1,-1,-1] 149 | IF (k0 EQ 6) THEN empir[1:3]=[0.776,2.32,0.60] 150 | END 151 | 'PAUL': BEGIN ;****************** PAUL 152 | IF (param EQ -1) THEN m=4d ELSE m=param 153 | fourier_factor = 4*!PI/(2*m+1) 154 | empir = [2.,-1,-1,-1] 155 | IF (m EQ 4) THEN empir[1:3]=[1.132,1.17,1.5] 156 | END 157 | 'DOG': BEGIN ;******************* DOG 158 | IF (param EQ -1) THEN m=2 ELSE m=param 159 | fourier_factor = 2*!PI*SQRT(2./(2*m+1)) 160 | empir = [1.,-1,-1,-1] 161 | IF (m EQ 2) THEN empir[1:3] = [3.541,1.43,1.4] 162 | IF (m EQ 6) THEN empir[1:3] = [1.966,1.37,0.97] 163 | END 164 | ENDCASE 165 | 166 | period = scale*fourier_factor 167 | dofmin = empir[0] ; Degrees of freedom with no smoothing 168 | Cdelta = empir[1] ; reconstruction factor 169 | gamma = empir[2] ; time-decorrelation factor 170 | dj0 = empir[3] ; scale-decorrelation factor 171 | 172 | ;....significance levels [Sec.4] 173 | freq = dt/period ; normalized frequency 174 | fft_theor = (1-lag1^2)/(1-2*lag1*COS(freq*2*!PI)+lag1^2) ; [Eqn(16)] 175 | fft_theor = variance*fft_theor ; include time-series variance 176 | IF (N_ELEMENTS(gws) EQ (J+1)) THEN fft_theor = gws 177 | signif = fft_theor 178 | 179 | CASE (sigtest) OF 180 | 181 | 0: BEGIN ; no smoothing, DOF=dofmin 182 | dof = dofmin 183 | signif = fft_theor*CHISQR_CVF(1. - siglvl,dof)/dof ; [Eqn(18)] 184 | IF confidence THEN BEGIN 185 | sig = (1. - siglvl)/2. 186 | chisqr = dof/[CHISQR_CVF(sig,dof),CHISQR_CVF(1.-sig,dof)] 187 | signif = fft_theor # chisqr 188 | ENDIF 189 | END 190 | 191 | 1: BEGIN ; time-averaged, DOFs depend upon scale [Sec.5a] 192 | IF (N_ELEMENTS(dof) LT 1) THEN dof = dofmin 193 | IF (gamma EQ -1) THEN MESSAGE, $ 194 | 'Gamma (decorrelation factor) not defined for '+mother+ $ 195 | ' with param='+STRTRIM(param,2) 196 | IF (N_ELEMENTS(dof) EQ 1) THEN dof = FLTARR(J+1) + dof 197 | dof = dof > 1 198 | dof = dofmin*SQRT( 1 + (dof*dt/gamma/scale)^2 ) ; [Eqn(23)] 199 | dof = dof > dofmin ; minimum DOF is dofmin 200 | IF (NOT confidence) THEN BEGIN 201 | FOR a1=0,J DO BEGIN 202 | chisqr = CHISQR_CVF(1. - siglvl,dof[a1])/dof[a1] 203 | signif[a1] = fft_theor[a1]*chisqr 204 | ; print,"a1=",a1,"dof=",dof[a1],"chisquare=", chisqr 205 | ENDFOR 206 | ENDIF ELSE BEGIN 207 | signif = FLTARR(J+1,2) 208 | sig = (1. - siglvl)/2. 209 | FOR a1=0,J DO BEGIN 210 | chisqr = dof(a1)/ $ 211 | [CHISQR_CVF(sig,dof(a1)),CHISQR_CVF(1.-sig,dof(a1))] 212 | signif[a1,*] = fft_theor[a1]*chisqr 213 | ENDFOR 214 | ENDELSE 215 | END 216 | 217 | 2: BEGIN ; scale-averaged, DOFs depend upon scale range [Sec.5b] 218 | IF (N_ELEMENTS(dof) NE 2) THEN $ 219 | MESSAGE,'DOF must be set to [S1,S2], the range of scale-averages' 220 | IF (Cdelta EQ -1) THEN MESSAGE, $ 221 | 'Cdelta & dj0 not defined for '+mother+ $ 222 | ' with param='+STRTRIM(param,2) 223 | s1 = dof[0] 224 | s2 = dof[1] 225 | avg = WHERE((scale GE s1) AND (scale LE s2),navg) 226 | IF (navg LT 1) THEN MESSAGE,'No valid scales between ' + $ 227 | STRTRIM(s1,2) + ' and ' + STRTRIM(s2,2) 228 | s1 = MIN(scale[avg]) 229 | s2 = MAX(scale[avg]) 230 | Savg = 1./TOTAL(1./scale[avg]) ; [Eqn(25)] 231 | Smid = EXP((ALOG(s1)+ALOG(s2))/2.) ; power-of-two midpoint 232 | dof = (dofmin*navg*Savg/Smid)*SQRT(1 + (navg*dj/dj0)^2) ; [Eqn(28)] 233 | fft_theor = Savg*TOTAL(fft_theor[avg]/scale[avg]) ; [Eqn(27)] 234 | chisqr = CHISQR_CVF(1. - siglvl,dof)/dof 235 | IF confidence THEN BEGIN 236 | sig = (1. - siglvl)/2. 237 | chisqr = dof/[CHISQR_CVF(sig,dof),CHISQR_CVF(1.-sig,dof)] 238 | ENDIF 239 | signif = (dj*dt/Cdelta/Savg)*fft_theor*chisqr ; [Eqn(26)] 240 | END 241 | 242 | ENDCASE 243 | 244 | RETURN,signif 245 | 246 | END 247 | --------------------------------------------------------------------------------