Exemplo n.º 1
0
print('calculate dta')
dta = fourxCO2['ta'] - PiCon['ta']

CMIP_File = Dataset('/praid/users/jgvirgin/Radiative_Kernels/CAM3_Kernels.nc')

lat = np.squeeze(CMIP_File.variables['lat'])
lon = np.squeeze(CMIP_File.variables['lon'])

CMIP_plevs_scalar = np.squeeze(CMIP_File.variables['lev'])
CMIP_plevs = np.tile(CMIP_plevs_scalar[None, :, None, None],
                     (12, 1, lat.size, lon.size))

print('Calculating...')
print('saturdation specific humidity for the baseline')
Sat_Hum_base = jf.Calc_SatSpec_Hum(Ta=PiCon['ta'], P=CMIP_plevs)

print('saturation specific humidity for the response')
Sat_Hum_resp = jf.Calc_SatSpec_Hum(Ta=fourxCO2['ta'], P=CMIP_plevs)

print(
    'rate of change of saturation specific humidity with respect to temperature'
)
dqsdt = (Sat_Hum_resp - Sat_Hum_base) / dta

print('relative humidity for the model')
Rel_Hum = (
    1000 * PiCon['hus']
) / Sat_Hum_base  #swap specific humidity units to g/kg to match specific humidity

print('rate of change of specific humidity with respect to temperature')
Exemplo n.º 2
0
Kernels_interpolated.pop('CloudSat')

# In[11]:

ps_path = '/praid/users/jgvirgin/CanESM_Data/CanESM2/Raw/vars_interp_Amon_CanESM2_piControl_r1i1p1_201501-241012.nc'
PS = np.squeeze(nc.Dataset(ps_path).variables['ps'])[:12, :, :]

#Calculate pressure level thickness using CMIP pressure levels and surface pressure
dp = np.zeros([12, 17, 64, 128])

for i in range(12):
    for j in range(64):
        for k in range(128):
            dp[i, :, j, k] = jf.PlevThck(PS=PS[i, j, k] / 100,
                                         plevs=CMIP_plevs_scalar,
                                         p_top=min(CMIP_plevs_scalar))

dp = dp / 100  #Kernel units are per 100 hPa

# In[12]:

print(
    'calculate stratosphere flux perturbations due to adjustments & feedbacks separately'
)
#multiply all nonlinear & linear strato temperature perturbations by the proper kernels
#integrate throughout the stratosphere
#take the annual mean

temp_fb_strato_tot = dict()
temp_fb_strato_clr = dict()
Exemplo n.º 3
0
print('unpack and store as a single time series array')

RCP45_PS_TmSrs = np.zeros([720,96,144])
wAVD_PS_TmSrs = np.zeros([720,96,144])

RCP45_PS_TmSrs = np.stack((np.hstack(RCP45_PS_TmSrs_Stacked[0:60,0:12])[0:720]),axis=0)
wAVD_PS_TmSrs = np.stack((np.hstack(wAVD_PS_TmSrs_Stacked[0:60,0:12])[0:720]),axis=0)

print('Calculate Pressure levels')

#calculate pressure levels
plevs_RCP45 = np.zeros([720,47,96,144])
plevs_wAVD = np.zeros([720,47,96,144])

for i in range(720):
    plevs_RCP45[i,:,:,:] = JF.HybSig2Plev(P0=p0,PS=RCP45_PS_TmSrs[i,:,:],\
        coef_A=hyam,coef_B=hybm)/100 #in hPa

    plevs_wAVD[i,:,:,:] = JF.HybSig2Plev(P0=p0,PS=wAVD_PS_TmSrs[i,:,:],\
        coef_A=hyam,coef_B=hybm)/100 #in hPa

print('Tropopause estimation')

p_tropopause_zonalmean_linear = np.zeros([96])

for y in range(96):
    if y <= len(WACCM4_Lat)/2:
        if y == 0:
            p_tropopause_zonalmean_linear[y] = 300
        elif y == len(WACCM4_Lat)/2:
            p_tropopause_zonalmean_linear[y] = 100
        else: