Example #1
0
if not (lowpass):
    Tn = 0.

if rENSO:
    sste = st2.regressout_x(enso, sst)
    Q_se = st2.regressout_x(enso, Q_s)
    Q_re = st2.regressout_x(enso, Q_r)
    Q_tote = st2.regressout_x(enso, Q_tot)

# Scaling factor (to convert from units of W*K/(s*m^2) to K^2)
#G = (2*dt**2/(Cbar**2*(1-r2corrs)))

#lambdaQ_tot = st.cov(sste, Q_tote, lagx=-1)/st.cov(sste,sste, lagx=-1)

lambdaQ_totlag0 = st.cov(sste, Q_tote, lagx=0) / st.cov(sste, sste, lagx=0)
lambdaQ_totlag1 = st.cov(sste, Q_tote, lagx=-1) / st.cov(sste, sste, lagx=-1)
lambdaQ_totlag2 = st.cov(sste, Q_tote, lagx=-2) / st.cov(sste, sste, lagx=-2)
lambdaQ_totlag3 = st.cov(sste, Q_tote, lagx=-3) / st.cov(sste, sste, lagx=-3)

#lambdaQ_tot = (lambdaQ_totlag1 + lambdaQ_totlag2 + lambdaQ_totlag3)/3.
lambdaQ_tot = lambdaQ_totlag1

lambdaQ_slag0 = st.cov(sste, Q_se, lagx=0) / st.cov(sste, sste, lagx=0)
lambdaQ_slag1 = st.cov(sste, Q_se, lagx=-1) / st.cov(sste, sste, lagx=-1)
lambdaQ_slag2 = st.cov(sste, Q_se, lagx=-2) / st.cov(sste, sste, lagx=-2)
lambdaQ_slag3 = st.cov(sste, Q_se, lagx=-3) / st.cov(sste, sste, lagx=-3)

lambdaQ_rlag0 = st.cov(sste, Q_re, lagx=0) / st.cov(sste, sste, lagx=0)
lambdaQ_rlag1 = st.cov(sste, Q_re, lagx=-1) / st.cov(sste, sste, lagx=-1)
lambdaQ_rlag2 = st.cov(sste, Q_re, lagx=-2) / st.cov(sste, sste, lagx=-2)
Example #2
0
order = 5
fs = 1     # sample rate, (cycles per month)
Tn_enso = 12.*2
cutoff_enso = 1/Tn_enso  # desired cutoff frequency of the filter (cycles per month)
enso = st2.spatial_ave_xr(sst.sel(lon=slice(190,240)), lats=lats.sel(lat=slice(-5,5)))

enso = st.butter_lowpass_filter_xr(enso,cutoff_enso,fs,order) 

sste = st2.regressout_x(enso, sste)
Q_se = st2.regressout_x(enso, Q_se)
Q_re = st2.regressout_x(enso, Q_re)
Q_tote = st2.regressout_x(enso, Q_tote)
    
#lambdaQ_totlag0 = st.cov(sste, Q_tote, lagx=0)/st.cov(sste,sste, lagx=0)
lambdaQ_totlag1 = st.cov(sste, Q_tote, lagx=-1)/st.cov(sste,sste, lagx=-1)
#lambdaQ_totlag2 = st.cov(sste, Q_tote, lagx=-2)/st.cov(sste,sste, lagx=-2)
#lambdaQ_totlag3 = st.cov(sste, Q_tote, lagx=-3)/st.cov(sste,sste, lagx=-3)

#lambdaQ_tot = (lambdaQ_totlag1 + lambdaQ_totlag2 + lambdaQ_totlag3)/3.

lambdaQ_tot = lambdaQ_totlag1
#lambdaQ_tot = lambdaQ_totlag3

#lambda: find the 'response' time of the atmosphere (lets just assume global mean e-folding sst autocorrelation time)
# then 


#lambdaQ_tot = lambdaQ_totlag0

#lambdaQ_slag0 = st.cov(sste, Q_se, lagx=0)/st.cov(sste,sste, lagx=0)
cutoff = 1/Tn  # desired cutoff frequency of the filter (cycles per month)
enso = st2.spatial_ave_xr(sst.sel(lon=slice(190,240)), lats=lats.sel(lat=slice(-5,5)))

enso = st.butter_lowpass_filter_xr(enso,cutoff,fs,order) 

if rENSO:
   sste = st2.regressout_x(enso, sst)
   Q_se = st2.regressout_x(enso, Q_s)
   Q_re = st2.regressout_x(enso, Q_r)
   
   
if not(lowpass):
    Tn = 0.
       

lambdaQ_s_lag1 = st.cov(sste, Q_se, lagx=-1)/st.cov(sste,sste, lagx=-1)
#lambdaQ_s_lag2 = st.cov(sste, Q_se, lagx=-2)/st.cov(sste,sste, lagx=-2)
#lambdaQ_s_lag3 = st.cov(sste, Q_se, lagx=-3)/st.cov(sste,sste, lagx=-3)

lambdaQ_r_lag1 = st.cov(sste, Q_re, lagx=-1)/st.cov(sste,sste, lagx=-1)
#lambdaQ_r_lag2 = st.cov(sste, Q_re, lagx=-2)/st.cov(sste,sste, lagx=-2)
#lambdaQ_r_lag3 = st.cov(sste, Q_re, lagx=-3)/st.cov(sste,sste, lagx=-3)


lambdaQ_s = (lambdaQ_s_lag1)
lambdaQ_r = (lambdaQ_r_lag1)

Q_sstar = Q_s - lambdaQ_s*sst
Q_rstar = Q_r - lambdaQ_r*sst

Q_s_var = Q_s.var(dim='time')