results_sst_olr_Elizabeth

====**1. Load in your data again, and extract 240-month time series ts1(t) and ts2(t) at some longitude ( the central Pacific, longitude index 80 = 200E = 160W will have a lot of ENSO signal, or pick your own). Take these series from array x and y, not anomx and anomy -- we'll keep the annual cycle in here to help make sure the frequency axis is right (there should be a distinctive peak there). The mean of your time series will appear in the real (cosine) zero frequency bin if you don't remove it.** ====

1. What is the fundamental (lowest) frequency possible in this time series?

2. What is the //bandwidth// or spectral resolution (Δf) of the spectrum you will create from it?
 * 1) Fundamental frequency f=1/T, T is the fundamental period. Since the fundamental period is 20 years or 240months. Thus f=1cycle/20years=1cycle/240months. (where 1cycle=2*pi).

3. What is the Nyquist (highest resolvable) frequency in this time series?
 * 1) Spectral resolution is same as the fundamental frequency

4. Based on the above, make a 1D frequency array f to use as the x axis on your plots in part 2. f=2*pi.*[-0.5+1/240:1/240:0.5];
 * 1) (sampling frequency/2)=1cycle/2months (sampling frequency = 1cycle/1month)

**2. Make the 1D power spectrum of your first field time series: ** **power per frequency bin ** **Pow = abs(fft(ts1)).^2, ** **Pow = abs(fft(ts1))^2 **

o You may want to center it on 0 frequency (by shifting the array) to show a symmetric spectrum with positive and negative frequencies. o Or you may prefer to just half the spectrum (PSD vs. the absolute value of f -- remember to double the positive frequency part of Pow so area = variance). You may also choose to rebin f and PSD to coarser spectral bands, if the plot is too noisy.

<span style="color: #000000; font-family: Arial,Helvetica,sans-serif; font-size: 12pt; line-height: 14.25pt; margin-bottom: 0pt;"><span style="color: black; font-family: 'Courier New'; font-size: 10pt; line-height: 14.25pt; margin-left: 0in; text-indent: -0.25in;">

<span style="color: black; font-family: Arial,sans-serif; font-size: 10pt;">2. **<span style="color: black; font-family: Arial,sans-serif; font-size: 10pt;">Plot the spectrum ** <span style="color: black; font-family: Arial,sans-serif; font-size: 10pt;">as an indefinite integral (cumulative power) vs. period or log period. <span style="color: black; font-family: Arial,sans-serif; font-size: 10pt;"> 3. **<span style="color: black; font-family: Arial,sans-serif; font-size: 10pt;">Plot the spectrum ** <span style="color: black; font-family: Arial,sans-serif; font-size: 10pt;">as f*power vs. log(f). Area under the curve should still be proportional to total power (variance).

<span style="color: black; font-family: Arial,sans-serif; font-size: 10pt;"> 4. **<span style="color: black; font-family: Arial,sans-serif; font-size: 10pt;">Plot the spectrum ** <span style="color: black; font-family: Arial,sans-serif; font-size: 10pt;">as f*power vs. log(period). Area under the curve should still be proportional to total power (variance). <span style="color: black; font-family: arial,helvetica,sans-serif; font-size: 10pt; line-height: 14.25pt; margin-left: 0in; text-indent: -0.25in;"> <span style="color: black; font-family: Arial,sans-serif; font-size: 10pt;"> 5. **<span style="color: black; font-family: Arial,sans-serif; font-size: 10pt;">Plot the spectrum ** <span style="color: black; font-family: Arial,sans-serif; font-size: 10pt;">as log(Pow) vs. log(f).

====<span style="color: #000000; font-family: Arial,Helvetica,sans-serif; font-size: 12pt; font-weight: normal; line-height: 14.25pt; margin-bottom: 0pt; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 5px;"> ==== o <span style="color: black; font-family: Arial,sans-serif; font-size: 10pt;">Why this way? Area under the curve is no longer meaningful. The reason to plot a spectrum this way is to see if it looks like a straight line. If the slope is -1, you have Pink Noise <span style="color: blue; font-family: Arial,sans-serif; font-size: 10pt;">[] <span style="color: black; font-family: Arial,sans-serif; font-size: 10pt;">aka <span style="color: blue; font-family: Arial,sans-serif; font-size: 10pt;">[|Flicker noise] <span style="color: black; font-family: Arial,sans-serif; font-size: 10pt;">aka <span style="color: blue; font-family: Arial,sans-serif; font-size: 10pt;">[] <span style="color: black; font-family: Arial,sans-serif; font-size: 10pt;">. If the slope is -2, you have <span style="color: blue; font-family: Arial,sans-serif; font-size: 10pt;">[|Brownian noise (hear an acoustic sample here!)] <span style="color: black; font-family: Arial,sans-serif; font-size: 10pt;">. Slopes of -3 or -5/3 are predicted for KE (velocity variance) by 3D and 2D turbulence theory (based solely on scaling arguments). No matter what the slope, a straight line implies a power law, although the <span style="color: blue; font-family: Arial,sans-serif; font-size: 10pt;">[|implications of finding a power law may be less profound than they appear] <span style="color: black; font-family: Arial,sans-serif; font-size: 10pt;">.

<span style="color: black; font-family: Arial,sans-serif; font-size: 10pt;">6. **<span style="color: black; font-family: Arial,sans-serif; font-size: 10pt;">Plot the spectrum in your favorite format, after rebinning ** <span style="color: black; font-family: Arial,sans-serif; font-size: 10pt;">f and Pow to coarser frequency bins. (Rebinning commands are in HW3 question 4). <span style="color: black; font-family: Arial,sans-serif; font-size: 10pt; line-height: 14.25pt; margin-left: 0in; text-indent: -0.25in;"> // <span style="color: black; font-family: Arial,sans-serif; font-size: 10pt;">7. **<span style="color: black; font-family: Arial,sans-serif; font-size: 10pt;">Plot the spectrum in your favorite format, **<span style="color: black; font-family: Arial,sans-serif; font-size: 10pt;"> **overplotting** the PSD you get //when you **pad the ends of the time series with zeroes**//. This will highlight the errors associated with making your time series as if it were periodic.//

====<span style="color: #000000; font-family: Arial,Helvetica,sans-serif; font-size: 12pt; font-weight: normal; line-height: 14.25pt; margin-bottom: 0pt; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 5px;"> ==== <span style="color: black; font-family: Wingdings; font-size: 10pt; line-height: 14.25pt; margin-bottom: 12pt; margin-left: 0in; text-indent: -0.25in;">§ <span style="color: black; font-family: Arial,sans-serif; font-size: 10pt;">8. **<span style="color: black; font-family: Arial,sans-serif; font-size: 10pt;">Extra ** <span style="color: black; font-family: Arial,sans-serif; font-size: 10pt;">credit on 1D spectra: explore end explain some of the virtues of one of the MANY special built-in functions or packages for spectral analysis (periodogram or other special functions in Matlab, IDL wavelet GUI, spectraworks.com package for Mac, etc etc.).

**<span style="color: black; font-family: Arial,sans-serif; font-size: 13pt;">3. Significance testing of peaks: Overplot a red noise spectrum and its 95% significance level (the F test). ** <span style="color: black; font-family: Arial,sans-serif; font-size: 10pt;">1. **<span style="color: black; font-family: Arial,sans-serif; font-size: 10pt;">Estimate ** <span style="color: black; font-family: Arial,sans-serif; font-size: 10pt;">your lag-1 autocorrelation value r1 for your field1. Get r1=0.9959 <span style="color: black; font-family: Arial,sans-serif; font-size: 10pt; line-height: 14.25pt; margin-left: 0in; text-indent: -0.25in;"> 2. Use r1 to **create and overplot** the power spectrum of an autoregressive (AR(1)) or "red noise" process with the same r1 and same variance as your series. <span style="color: black; font-family: Arial,sans-serif; font-size: 10pt;"> 3. Use the <span style="color: blue; font-family: Arial,sans-serif; font-size: 10pt;">[|F test] <span style="color: black; font-family: Arial,sans-serif; font-size: 10pt;">to **overplot** a line indicating the 99% significance level for spectral peaks. (used 4.79 for f-test)

====<span style="color: #000000; font-family: Arial,Helvetica,sans-serif; font-size: 12pt; font-weight: normal; line-height: 14.25pt; margin-bottom: 0pt; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 5px;"> ====

<span style="display: block; line-height: 14.25pt; margin-bottom: 6pt; margin-left: 0in; margin-right: 0in; margin-top: 6pt; text-align: center;">

**<span style="color: black; font-family: Arial,sans-serif; font-size: 13pt;">4. Cross-spectrum of your 2 variables. (see section 3.1.2 of Hsieh handout). ** <span style="color: black; font-family: Arial,sans-serif; font-size: 10pt;">1. **<span style="color: black; font-family: Arial,sans-serif; font-size: 10pt;">Compute the 2 FFTs ** <span style="color: black; font-family: Arial,sans-serif; font-size: 10pt;">of your 2 time series. xhat = fft(ts1); yhat = fft(ts2); **and plot the spectrum of your field 2** in your favorite depiction from Part 2.6 above, if you didn't already. (refer to part 2 above for OLR spectrum) <span style="color: black; font-family: Arial,sans-serif; font-size: 10pt;"> 2. **<span style="color: black; font-family: Arial,sans-serif; font-size: 10pt;">Compute the cross-spectrum ** <span style="color: black; font-family: Arial,sans-serif; font-size: 10pt;">by complex multiplication: Cross = xhat .* conj(yhat) <span style="color: black; font-family: Arial,sans-serif; font-size: 10pt;"> 3. **<span style="color: black; font-family: Arial,sans-serif; font-size: 10pt;">Separate ** <span style="color: black; font-family: Arial,sans-serif; font-size: 10pt;">the cross spectrum into its real and imaginary parts. o <span style="color: black; font-family: Arial,sans-serif; font-size: 10pt;">R and I in Hsieh (handout) section 3.1.2 o <span style="color: black; font-family: Arial,sans-serif; font-size: 10pt;">I often see them called P(f) and Q(f) (the "in-phase" and "quadrature" parts). Quadrature means 90 degrees out of phase: sin and cos components. <span style="color: black; font-family: Arial,sans-serif; font-size: 10pt;">4. **<span style="color: black; font-family: Arial,sans-serif; font-size: 10pt;">Plot a cumulative spectrum of the in-phase part P (or R) as in 2.2 above. ** <span style="color: black; font-family: Arial,sans-serif; font-size: 10pt;">Show that it ends up at the covariance of ts1 and ts2, mean( (ts1-mean(ts1)) * (ts2-mean(ts2)) ). What timescales contribute the most to the overall correlation (or covariance) of your 2 time series, according to this plot? <span style="color: black; font-family: Arial,sans-serif; font-size: 10pt; line-height: 14.25pt; margin-left: 0in; text-indent: -0.25in;"> <span style="color: black; font-family: Arial,sans-serif; font-size: 10pt;"> 5. **<span style="color: black; font-family: Arial,sans-serif; font-size: 10pt;">Plot the squared coherency spectrum ** <span style="color: black; font-family: Arial,sans-serif; font-size: 10pt;">(or just "coherence" in lazy language you will often hear). It is (P2+Q2) /(xPow2) /(yPow2). Why is it always 1?? (Hsieh 3.33-3.36) <span style="color: black; font-family: Arial,sans-serif; font-size: 10pt; line-height: 14.25pt; margin-left: 0in; text-indent: -0.25in;"> <span style="color: black; font-family: Arial,sans-serif; font-size: 10pt;"> 6. **<span style="color: black; font-family: Arial,sans-serif; font-size: 10pt;">Plot the squared coherency spectrum after rebinning ** <span style="color: black; font-family: Arial,sans-serif; font-size: 10pt;">P, Q, xPow and yPow to coarser frequency bins. <span style="color: black; font-family: Arial,sans-serif; font-size: 10pt; line-height: 14.25pt; margin-left: 0in; text-indent: -0.25in;"> o <span style="color: black; font-family: Arial,sans-serif; font-size: 10pt;">Reasoning: For physically real phenomena operating in a general, broad frequency band (like ENSO), the variables x and y will have the same phase relationship for all frequencies since they are physically linked, so averaging (rebinning) won't decrease coherency much. For random, non physically linked fluctuations of x and y, the in-phase and quadrature components will both be random (positive at one frequency, negative at the next), so the averaging will weaken the coherency when the phase relationship is random. See Hsieh handout, (3.37). <span style="color: black; font-family: Arial,sans-serif; font-size: 10pt;">7. **<span style="color: black; font-family: Arial,sans-serif; font-size: 10pt;">Plot the phase spectrum ** <span style="color: black; font-family: Arial,sans-serif; font-size: 10pt;">arctan(Q/P), and interpret the phase relationship between your variables in a frequency band where there is strong coherence (like ENSO) by showing this phase relationship using time series plots zoomed in to one dominant case of this strong oscillation (like an ENSO event). <span style="font-family: Arial,sans-serif;">

**<span style="color: black; font-family: Arial,sans-serif; font-size: 13pt;">5. 2D FFT ** <span style="color: black; font-family: Arial,sans-serif; font-size: 10pt;">1. **<span style="color: black; font-family: Arial,sans-serif; font-size: 10pt;">Compute the 2D FFT (xhat) of your primary field's time-longitude section (fft2 in Matlab, fft in IDL). ** <span style="color: black; font-family: Arial,sans-serif; font-size: 10pt;"> 2. **<span style="color: black; font-family: Arial,sans-serif; font-size: 10pt;">Display this 2D fft ** <span style="color: black; font-family: Arial,sans-serif; font-size: 10pt;">as an image or contour plot, as a function of frequency f and zonal wavenumber k.   o <span style="color: black; font-family: Arial,sans-serif; font-size: 10pt;">You have an f array: you just need to make a k array, following the logic in question 1 above in the x direction. o <span style="color: black; font-family: Arial,sans-serif; font-size: 10pt;">Shift the Power array (with fftshift in Matlab, or the shifting keyword in IDL8's FFT routine) to put low frequencies in the middle of the image. o <span style="color: black; font-family: Arial,sans-serif; font-size: 10pt;">You may want to display the log or square root of power, so the lowest frequencies don't dominate so stro <span style="font-family: Arial,sans-serif;">ngly and you see more structure. <span style="color: black; font-family: Arial,sans-serif; font-size: 10pt; line-height: 14.25pt; margin-left: 0in; text-indent: -0.25in;"> o <span style="color: black; font-family: Arial,sans-serif; font-size: 10pt;">You should probably zoom in on the lowest frequency region. <span style="color: black; font-family: Arial,sans-serif; font-size: 10pt;">5. Can you interpret this spectrum directly in terms of the size and orientation of <span style="color: blue; font-family: Arial,sans-serif; font-size: 10pt;">stripes seen in the time-longitude section image? >> <span style="color: black; font-family: Arial,sans-serif; font-size: 10pt; line-height: 14.25pt; margin-left: 0in; text-indent: -0.25in;"> 6. Can you interpret this spectrum in terms of the rebinned variance diagram from HW3, problem 4?


 * <span style="color: black; font-family: Arial,sans-serif; font-size: 10pt; line-height: 115%;">3. Show a filtered data image **<span style="color: black; font-family: Arial,sans-serif; font-size: 10pt; line-height: 115%;">: Multiply the xhat 2-dimensional array by zero wherever k>10 or f>10. Transform back to x-t space with ifft in Matlab or fft(xhat, /inverse). Display.
 * <span style="color: black; font-family: Arial,sans-serif; font-size: 10pt; line-height: 115%;">4. Extra credit **<span style="color: black; font-family: Arial,sans-serif; font-size: 10pt; line-height: 115%;">: Explore filtering a bit more, and figure out better how the 2D spectrum relates to the rebinned variance diagram from HW3, problem 4.