def forecast(u, dx, dt, nu, kmax, htype): for k in range(kmax): u = step(u, dx, dt, nu) #if htype["perturbation"] == "etkf" or htype["perturbation"] == "po" \ # or htype["perturbation"] == "letkf" or htype["perturbation"] == "srf" \ # or htype["perturbation"] == "mlefb" or htype["perturbation"] == "gradb": # u[:, 0] = np.mean(u[:, 1:], axis=1) return u
def gen_true(x, dt, nu, t0true, t0f, nt, na): nx = x.size nmem = len(t0f) u = np.zeros_like(x) u[0] = 1 dx = x[1] - x[0] ut = np.zeros((na, nx)) u0 = np.zeros((nx, nmem)) for k in range(t0true): u = step(u, dx, dt, nu) ut[0, :] = u for i in range(na-1): for k in range(nt): u = step(u, dx, dt, nu) j = (i + 1) * nt + k if j in t0f: u0[:, t0f.index(j)] = u ut[i+1, :] = u return ut, u0