# Initialize the timesteps #----------------------------------------------------------------------- t_nature = sv.getTimes() acyc_step = das.acyc_step # (how frequently to perform an analysis) dtau = das.dtau dt = das.dt fcst_step= das.fcst_step fcst_dt = das.fcst_dt maxit = das.maxit xdim = das.xdim ydim = das.ydim #----------------------------------------------------------------------- # Initialize the model #----------------------------------------------------------------------- l96 = lorenz96() #----------------------------------------------------------------------- # Choose DA method: #----------------------------------------------------------------------- method = das.getMethod() #----------------------------------------------------------------------- # Conduct data assimilation process #----------------------------------------------------------------------- # xa = das.x0 xa_history = np.zeros_like(x_nature) xa_history[:] = np.nan KH_history = [] KH_idx = []
#initial_perturbation = np.squeeze(0.01*(np.random.rand(1,3)*2-1)) #print('initial_perturbation = ', initial_perturbation) #climate_std = [3.63477096 3.63919927 3.30788215 3.76514026 3.62503822] #print('climate_std = ', climate_std) #state0 = state0 + initial_perturbation*climate_std #print('initial state = ', state0) #------------------------------------------------------------------ # Setup state vector object #------------------------------------------------------------------ sv = state_vector(params=params, x0=state0, t=tvec, name=name) #------------------------------------------------------------------ # Initialize the l96 object #------------------------------------------------------------------ l96 = lorenz96(F=F) #------------------------------------------------------------------ # Run L96 to generate a nature run with the specified parameters #------------------------------------------------------------------ print('Run l96...') trajectory = l96.run(sv.x0, sv.t) sv.setTrajectory(trajectory) #------------------------------------------------------------------ # Output the beginning and end states, and compute model climatology #------------------------------------------------------------------ print(sv) #------------------------------------------------------------------ # Store the nature run data