Beispiel #1
0
writefile_T_surf_var[:] = T_surf
writefile_T_surf_var.units = 'K'
writefile_T_surf_var.description = 'surface absolute temperature'

writefile_w_ls_var = writefile_forcing_grp.createVariable(
    'w_ls', 'f4', (
        'levels',
        'time',
    ))
writefile_w_ls_var[:] = w_sub
writefile_w_ls_var.units = 'm s^-1'
writefile_w_ls_var.description = 'large scale vertical velocity'

#convert to w
omega = np.zeros((levels.size, time.size), dtype=float)
T_abs = ffc.theta_to_T(thetal, levels)
for t in range(time.size):
    omega[:, t] = ffc.w_to_omega(w_sub[:, t], levels, T_abs)

writefile_omega_var = writefile_forcing_grp.createVariable(
    'omega', 'f4', (
        'levels',
        'time',
    ))
writefile_omega_var[:] = omega
writefile_omega_var.units = 'Pa s^-1'
writefile_omega_var.description = 'large scale pressure velocity'

#ASTEX input file has one value per time for the following variables; need to expand the dimenions of the array to have levels and times
ug_tile = np.tile(u_g.transpose(), (len(levels), 1))
writefile_u_g_var = writefile_forcing_grp.createVariable(
nc_fid_o3 = Dataset("../../data/raw_case_input/mid_lat_summer_std.nc", 'r')

oz_pres = nc_fid_o3.variables['pressure']
oz_data = nc_fid_o3.variables['o3']

oz_f = scipy.interpolate.interp1d(oz_pres, oz_data)
o3 = oz_f(levels[:])
nc_fid_o3.close()

#get initial theta

theta_pert = nc_fid_wrf.variables['T']
theta_pert = np.mean(theta_pert, axis=(0,2,3))

theta = theta_pert + 300.0 #instructions say to add 300 K to theta perturbation
T = ffc.theta_to_T(theta, levels)

#get initial water species mixing ratios and convert to specific humidity
qv_mr = nc_fid_wrf.variables['QVAPOR']
qv_mr = np.mean(qv_mr, axis=(0,2,3))
qv = qv_mr/(1.0 + qv_mr) #convert to specific humidity from mixing ratio

ql_mr = nc_fid_wrf.variables['QCLOUD']
ql_mr = np.mean(ql_mr, axis=(0,2,3))
ql = ql_mr/(1.0 + ql_mr) #convert to specific humidity from mixing ratio

qi_mr = nc_fid_wrf.variables['QICE']
qi_mr = np.mean(qi_mr, axis=(0,2,3))
qi = qi_mr/(1.0 + qi_mr) #convert to specific humidity from mixing ratio

#calc qt and theta_il