コード例 #1
0
with Dataset(GCM_temp,'r') as D:
    lat=D.variables['lat'][:]
    lon=D.variables['lon'][:]
    Y= lat.size
    X= lon.size

vars= ['PRECT']
data_filt={}
data_map_filt={}
self_corr= {}
self_corr_mask= {}
for vv in vars:
  #== trop mean data
  tmp= data[vv]
  tmp= tmp.reshape(tmp.size)
  tmp= panta(tmp)
  tmp_smooth= running_mean(tmp,6)
  tmp_f = tmp - tmp_smooth;  data_filt[vv]= tmp_f
  #== map data
  tmp= data_map[vv]
  tmp= tmp.reshape(tmp.shape[0]*tmp.shape[1], tmp.shape[2], tmp.shape[3])
  tmp= panta(tmp)
  tmp_smooth= running_mean(tmp,6)
  tmp_map_f= tmp - tmp_smooth; data_map_filt[vv]= tmp_map_f
  #== correlation
  Y,X= tmp_map_f.shape[1:3]
  cor= np.zeros((Y,X))
  cor_mask= np.zeros((Y,X))
  for yy in range(Y):
    for xx in range(X):
      tmp_map_f_loc= tmp_map_f[:, yy, xx]
コード例 #2
0
data_file = data_path_map + 'RCE.pk'
with open(data_file, 'rb') as f:
    data_map = pickle.load(f)

data_file = data_path_P
with open(data_file, 'rb') as f:
    pEOF = pickle.load(f)
    plat = pEOF['lat']
    plon = pEOF['lon']

data_file = '/data/cloud/Goldtimes5/data/GCM_SPCAM/CPL64/CRM_region_mean/PRECT.pk'
with open(data_file, 'rb') as f:
    CRMP = pickle.load(f)

CRMP = CRMP.reshape((CRMP.size))
CRMP = panta(CRMP)
CRMP_f = running_mean(CRMP, 6)
CRMP = CRMP_f
#Slow
CRMP = CRMP * 0.2583  # CRM region area / total tropical area

vars = [
    'RCE', 'PRECT', 'Rad_cool', 'SHFLX', 'FLNS', 'FSNS', 'FLNT', 'FSNTOA',
    'FSDTOA', 'FSUTOA'
]
data_filt = {}
data_map_filt = {}
self_corr = {}
for vv in vars:
    #== trop mean data
    tmp = data[vv]
コード例 #3
0
Rad = data['Rad_cool']
Radr = Rad.reshape(Rad.size)
pr = data['PRECT']
prr = pr.reshape(pr.size)
LWs = data['FLNS']
LWsr = LWs.reshape(LWs.size)
SWs = data['FSNS']
SWsr = SWs.reshape(SWs.size)
LWt = data['FLNT']
LWtr = LWt.reshape(LWt.size)
SWt = data['FSNTOA']
SWtr = SWt.reshape(SWt.size)
prl = data['PRECT_largeVar']
prlr = prl.reshape(prl.size)

RCEr = panta(RCEr)
cvr = panta(cvr)
prr = panta(prr)
prlr = panta(prlr)
Radr = panta(Radr)
CRMP = panta(CRMP)
LWsr = panta(LWsr)
SWsr = panta(SWsr)
LWtr = panta(LWtr)
SWtr = panta(SWtr)

#  5 yr
plt.figure(figsize=(8, 3))
plt.plot(np.arange(1, 6, 5 / 365), np.zeros(RCEr.size), 'k', linewidth=0.5)
plt.plot(np.arange(1, 6, 5 / 365),
         RCEr - np.mean(RCEr),
コード例 #4
0
maxY = lat.size
maxX = lon.size

Lv = 2.477 * 10**6  # J/kg
rho = 1000  # kg/m3

#=== load data and plot
with open(data_file, 'rb') as f:
    data = pickle.load(f)

#=== data process
Nyr, Nd = data.shape[0:2]
data = data * Lv * rho  # convert m/s to W/m2
data = data.reshape((Nyr * Nd, maxY, maxX))  # Time, lat, lon
data = panta(data)
Nt = data.shape[0]  # panta mean
data_mean = np.mean(data, axis=0).reshape((1, maxY, maxX))
data_mean = np.tile(data_mean, [Nt, 1, 1])
data = data - data_mean  # anomaly

#=== weighting matrix
weight = np.array(np.cos(lat * np.pi / 180)**0.5, dtype='float')
weight = weight.reshape((1, maxY, 1))
weight = np.tile(weight, [Nt, 1, maxX])
data = data * weight  # weight by square cos(lat)

#=== mask
lat_mask = np.squeeze(np.array([(lat >= -30) & (lat <= 30)], dtype='bool'))
data_r = data[:, lat_mask, :]
Nt2, Ny, Nx = data_r.shape