- 积分
- 653
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2015-4-21
- 最后登录
- 1970-1-1
|
登录后查看更多精彩内容~
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
想问一下各位大神,想要对厄尔尼诺尼诺前一个夏天,冬天,和第二个夏天的850风场u,v做合成分析,之后用bootstrap来做检验,检验之后发现所有的的结果都会大于bootstrap的低值(ci_l1,ci_l2),也就是全都超过了置信区间,感觉不太对,想请问一下大家。代码里ujjaano表示u分量在夏天的距平,udevelop表示在厄尔尼诺前夏的合成,以此类推。
- from scipy import stats
- import glob
- import math
- from tqdm import tqdm
- import numpy as np
- import pandas as pd
- import xarray as xr
- import netCDF4 as nc
- import datetime
- import matplotlib.pyplot as plt
- import cartopy.crs as ccrs
- from cartopy.mpl.ticker import LongitudeFormatter, LatitudeFormatter
- import cartopy.feature as cfeature
- from scipy.stats import bootstrap
- f1 = xr.open_dataset("ujjaano.nc")
- f2 = xr.open_dataset("vjjaano.nc")
- f3 = xr.open_dataset("udjfano.nc")
- f4 = xr.open_dataset("vdjfano.nc")
- f5 = xr.open_dataset('onidjf.nc')
- ujjaano = f1['u']
- vjjaano = f2['v']
- udjfano = f3['u']
- vdjfano = f4['v']
- oni = f5['nino']
- u = f1['u']
- v = f2['v']
- oni = f3['nino']
- nino = oni[1:-1]
- elnino = nino.where(nino > 0.5)
- elnino = elnino.dropna(dim='time')
- nino = oni[1:-1]
- elnino = nino.where(nino > 0.5)
- elnino = elnino.dropna(dim='time')
- u_develop = ujjaano.loc[ujjaano.year.isin(elnino.time.dt.year)]
- v_develop = vjjaano.loc[vjjaano.year.isin([elnino.time.dt.year])]
- u_mature = udjfano.loc[udjfano.year.isin([elnino.time.dt.year + 1])]
- v_mature = vdjfano.loc[vdjfano.year.isin([elnino.time.dt.year + 1])]
- u_decay = ujjaano.loc[ujjaano.year.isin([elnino.time.dt.year + 1])]
- v_decay = vjjaano.loc[vjjaano.year.isin([elnino.time.dt.year + 1])]
- u_develop = np.nanmean(u_develop, axis=0)
- v_develop = np.nanmean(v_develop, axis=0)
- u_mature = np.nanmean(u_mature, axis=0)
- v_mature = np.nanmean(v_mature, axis=0)
- u_decay = np.nanmean(u_decay, axis=0)
- v_decay = np.nanmean(v_decay, axis=0)
- ci_l1, ci_u1 = np.zeros((281,441)), np.zeros((281,441))
- ci_l2, ci_u2 = np.zeros((281,441)), np.zeros((281,441))
- sig1, sig2 = np.zeros((281,441)), np.zeros((281,441))
- for i in tqdm(range(281)):
- for j in range(441):
- res1 = bootstrap((ujjaano[:,i,j],), np.std, confidence_level=0.9,n_resamples=1000)
- res2 = bootstrap((vjjaano[:,i,j],), np.std, confidence_level=0.9,n_resamples=1000)
- ci_l1[i,j], ci_u1[i,j] = res1.confidence_interval
- ci_l2[i,j], ci_u2[i,j] = res2.confidence_interval
- sig1 = np.where(np.logical.or(u_develop < ci_l1, u_develop > ci_u1),1,0)
- sig2 = np.where(np.logical.or(v_develop < ci_l2, v_develop > ci_u2),1,0)
复制代码
|
|