Presentation is loading. Please wait.

Presentation is loading. Please wait.

Smoothing and Filtering. My subroutines state.edu/geog8901/data/subroutines/http://lightning.sbs.ohio- state.edu/geog8901/data/subroutines/

Similar presentations


Presentation on theme: "Smoothing and Filtering. My subroutines state.edu/geog8901/data/subroutines/http://lightning.sbs.ohio- state.edu/geog8901/data/subroutines/"— Presentation transcript:

1 Smoothing and Filtering

2 My subroutines http://lightning.sbs.ohio- state.edu/geog8901/data/subroutines/http://lightning.sbs.ohio- state.edu/geog8901/data/subroutines/

3 S pectral analysis Assume a time series Y has N data points Y 0, Y 1, Y 2, …, Y N-1. It can be expanded to: N/2 Y(t) =  a k cos(2  kt) + b k sin(2  kt) k=0 Where N-1 N-1 a k =  Y m cos(2  mt) and b k =  Y m sin(2  mt) m=0m=0 Then the power spectral density is: psd k = a k 2 + b k 2 Generally psd needs to be smoothed to get a stable spectrum.

4 The resultant spectrum

5 ;first need to run sub_spectrum.pro n = 256 x = findgen(n) y = cos(x*!pi/20)+0.4*sin(x*!pi/3) fs_base,n,nf,f,cosu,sinu fs,n,cosu,sinu,y,a,b,psd !p.multi=[0, 1, 2] plot, x, y plot, f, psd end

6 Smoothing (low-pass filter) Remove the high frequency components Keep the low frequency components Syntax d2=smooth(d, nsmooth, /edge_truncate) where nsmooth is the number of data points used for smoothing (should be odd number) f 0 0.1 0.2 0.3 0.4 0.5 Response function 0 1

7 ;first need to run sub_spectrum.pro n = 256 x = findgen(n) y = cos(x*!pi/20)+0.4*sin(x*!pi/3) fs_base,n,nf,f,cosu,sinu fs,n,cosu,sinu,y,a,b,psd y2=smooth(y, 11, /edge_truncate) fs,n,cosu,sinu,y2,a,b,psd2 !p.multi=[0, 1, 2] plot, x, y oplot, x, y2, thick=4 plot, f, psd oplot, f, psd2, thick=4 end

8 High-pass filter Remove the low frequency components Keep the high frequency components A simple way is to subtract the low frequency component from the raw data f 0 0.1 0.2 0.3 0.4 0.5 Response function 0 1

9 ;first need to run sub_spectrum.pro n = 256 x = findgen(n) y = cos(x*!pi/20)+0.4*sin(x*!pi/3) fs_base,n,nf,f,cosu,sinu fs,n,cosu,sinu,y,a,b,psd y2=smooth(y, 11, /edge_truncate) fs,n,cosu,sinu,y2,a,b,psd2 y3=y-y2 fs,n,cosu,sinu,y3,a,b,psd3 !p.multi=[0, 1, 2] plot, x, y oplot, x, y2, thick=4 oplot, x, y3, thick=4, line=2 plot, f, psd oplot, f, psd2, thick=4 oplot, f, psd3, thick=4, line=2 end

10 Band-pass filter Remove both the lower and higher frequency components Keep the middle frequency components In my sub_mode.pro, there are two filters: butterworth, and lanczos f 0 0.1 0.2 0.3 0.4 0.5 Response function 0 1

11 Convective available potential energy (CAPE) is the amount of energy a parcel of air would have if lifted a certain distance vertically through the atmosphere is effectively the positive buoyancy of an air parcel and is an indicator of atmospheric instability, i.e., the easiness to generate thunderstorms Definition: Tv is virtual temperature, Zf is level of free convection, Zn is level of neutral buoyancy

12 ;first need to run sub_theory_convection.pro openr,1,'gate.dat' readf,1,n p=fltarr(n) T=fltarr(n) wt=fltarr(n) for k=n-1,0,-1 do begin readf,1,p1,T1,wt1 p(k)=p1 T(k)=T1 wt(k)=wt1*0.001 endfor close,1 !p.multi=[0,1,1] plot,T,p,xtitle='T (K)',ytitle='P (mb)',yrange=[1000,50],charsize=2.0 ks=0 kt=36 Tli1=273.15 ; High temperature boundary for mixed phase Tli2=263.15 ; Low temperature boundary for mixed phase base_move,n,ks,kt,p,T,wt,s,Tep,Tli1,Tli2,Trom,dTrodsm,hm,wcm calc_cape,n,ks,kt,p,Trom,dTrodsm,wcm,CAPE,dCAPEds,ktop,wc,dTro,CI print, 'CAPE=', CAPE end

13 In-class assignment XIII Data files are stored at: http://lightning.sbs.ohio-state.edu/geog8901/data/ Read the netCDF file sst.mnmean.nc for NOAA sea surface temperature (SST) data. Extract the time series of SST for a grid near 0N190E (a grid representing the El Nino). Smooth the data using a 25-month running mean. Calculate and plot the discrete Fourier spectrum of the raw data, the smoothed data (low-pass component), and the residual (high-pass component). Go to University of Wyoming sounding data site: http://weather.uwyo.edu/upperair/sounding.html select a sounding in the tropics that goes above 15km. Calculate the CAPE of the sounding. http://weather.uwyo.edu/upperair/sounding.html

14 Works cited http://www.nature.com/nclimate/journal/v2/n11/fig_ta b/nclimate1583_F3.htmlhttp://www.nature.com/nclimate/journal/v2/n11/fig_ta b/nclimate1583_F3.html


Download ppt "Smoothing and Filtering. My subroutines state.edu/geog8901/data/subroutines/http://lightning.sbs.ohio- state.edu/geog8901/data/subroutines/"

Similar presentations


Ads by Google