def plume_center(d, t): """ Compute plume center of mass :param d: open NetCDF4 dataset :param t: number of timestep """ tr = d.variables['tr17_1'][t, :, :, :] smoke_int = np.sum(tr, axis=0) z = height8p(d, t) h = np.sum(z * tr, axis=0) h[smoke_int <= smoke_threshold_int] = 0 smoke_int[smoke_int <= smoke_threshold_int] = 1 return h / smoke_int
def plume_height(d, t): """ Compute plume height :param d: open NetCDF4 dataset :param t: number of timestep """ z = height8p(d, t) tr = d.variables['tr17_1'][t, :, :, :] h = np.zeros(tr.shape[1:]) for i in range(0, tr.shape[2]): for j in range(0, tr.shape[1]): for k in range(tr.shape[0] - 1, -1, -1): if tr[k, j, i] > smoke_threshold: h[j, i] = z[k, j, i] break return h
def smoke_at_height(varname,d,t,level): s = interpolate2height(smoke_concentration(d,t),height8p(d,t),level) print_stats(varname,s,'ug/m^3') return s