dabench.dacycler ================ .. py:module:: dabench.dacycler .. autoapi-nested-parse:: Data Assimilation cyclers Classes ------- .. autoapisummary:: dabench.dacycler.DACycler dabench.dacycler.ETKF dabench.dacycler.Var3D dabench.dacycler.Var4D dabench.dacycler.Var4DBackprop Package Contents ---------------- .. py:class:: DACycler(system_dim, delta_t, model_obj, B = None, R = None, H = None, h = None) Base for all DACyclers :param system_dim: System dimension :param delta_t: The timestep of the model (assumed uniform) :param model_obj: Forecast model object. :param B: Initial / static background error covariance. Shape: (system_dim, system_dim). If not provided, will be calculated automatically. :param R: Observation error covariance matrix. Shape (obs_dim, obs_dim). If not provided, will be calculated automatically. :param H: Observation operator with shape: (obs_dim, system_dim). If not provided will be calculated automatically. :param h: Optional observation operator as function. More flexible (allows for more complex observation operator). Default is None. .. py:method:: cycle(input_state, start_time, obs_vector, n_cycles, obs_error_sd = None, analysis_window = 0.2, analysis_time_in_window = None, return_forecast = False) Perform DA cycle repeatedly, including analysis and forecast :param input_state: Input state as a Xarray Dataset :param start_time: Starting time. :param obs_vector: Observations vector. :param n_cycles: Number of analysis cycles to run, each of length analysis_window. :param analysis_window: Time window from which to gather observations for DA Cycle. :param analysis_time_in_window: Where within analysis_window to perform analysis. For example, 0.0 is the start of the window. Default is None, which selects the middle of the window. :param return_forecast: If True, returns forecast at each model timestep. If False, returns only analyses, one per analysis cycle. .. py:class:: ETKF(system_dim, delta_t, model_obj, B = None, R = None, H = None, h = None, ensemble_dim = 4, multiplicative_inflation = 1.0) Ensemble transform Kalman filter DA Cycler :param system_dim: System dimension. :param delta_t: The timestep of the model (assumed uniform) :param model_obj: Forecast model object. :param B: Initial / static background error covariance. Shape: (system_dim, system_dim). If not provided, will be calculated automatically. :param R: Observation error covariance matrix. Shape (obs_dim, obs_dim). If not provided, will be calculated automatically. :param H: Observation operator with shape: (obs_dim, system_dim). If not provided will be calculated automatically. :param h: Optional observation operator as function. More flexible (allows for more complex observation operator). Default is None. :param ensemble_dim: Number of ensemble instances for ETKF. Default is 4. Higher ensemble_dim increases accuracy but has performance cost. :param multiplicative_inflation: Scaling factor by which to multiply ensemble deviation. Default is 1.0 (no inflation). .. py:class:: Var3D(system_dim, delta_t, model_obj, B = None, R = None, H = None, h = None) 3D-Var DA Cycler :param system_dim: System dimension. :param delta_t: The timestep of the model (assumed uniform) :param model_obj: Forecast model object. :param B: Initial / static background error covariance. Shape: (system_dim, system_dim). If not provided, will be calculated automatically. :param R: Observation error covariance matrix. Shape (obs_dim, obs_dim). If not provided, will be calculated automatically. :param H: Observation operator with shape: (obs_dim, system_dim). If not provided will be calculated automatically. :param h: Optional observation operator as function. More flexible (allows for more complex observation operator). Default is None. .. py:class:: Var4D(system_dim, delta_t, model_obj, B = None, R = None, H = None, h = None, solver = 'bicgstab', n_outer_loops = 1, steps_per_window = 1, obs_window_indices = None, **kwargs) 4D-Var DA Cycler :param system_dim: System dimension. :param delta_t: The timestep of the model (assumed uniform) :param model_obj: Forecast model object. :param B: Initial / static background error covariance. Shape: (system_dim, system_dim). If not provided, will be calculated automatically. :param R: Observation error covariance matrix. Shape (obs_dim, obs_dim). If not provided, will be calculated automatically. :param H: Observation operator with shape: (obs_dim, system_dim). If not provided will be calculated automatically. :param h: Optional observation operator as function. More flexible (allows for more complex observation operator). Default is None. :param solver: Name of solver to use. Default is 'bicgstab'. :param n_outer_loops: Number of times to run through outer loop over 4DVar. Increasing this may result in higher accuracy but slower performance. Default is 1. :param steps_per_window: Number of timesteps per analysis window. If None (default), will calculate automatically based on delta_t and .cycle() analysis_window length. :param obs_window_indices: Timestep indices where observations fall within each analysis window. For example, if analysis window is 0 - 0.05 with delta_t = 0.01 and observations fall at 0, 0.01, 0.02, 0.03, 0.04, and 0.05, obs_window_indices = [0, 1, 2, 3, 4, 5]. If None (default), will calculate automatically. .. py:class:: Var4DBackprop(system_dim, delta_t, model_obj, B = None, R = None, H = None, h = None, learning_rate = 0.5, lr_decay = 0.5, num_iters = 3, steps_per_window = None, obs_window_indices = None, loss_growth_limit = 10, **kwargs) Backpropagation 4D-Var DA Cycler :param system_dim: System dimension. :param delta_t: The timestep of the model (assumed uniform) :param model_obj: Forecast model object. :param B: Initial / static background error covariance. Shape: (system_dim, system_dim). If not provided, will be calculated automatically. :param R: Observation error covariance matrix. Shape (obs_dim, obs_dim). If not provided, will be calculated automatically. :param H: Observation operator with shape: (obs_dim, system_dim). If not provided will be calculated automatically. :param h: Optional observation operator as function. More flexible (allows for more complex observation operator). Default is None. :param num_iters: Number of iterations for backpropagation per analysis cycle. Default is 3. :param steps_per_window: Number of timesteps per analysis window. If None (default), will calculate automatically based on delta_t and .cycle() analysis_window length. :param learning_rate: LR for backpropogation. Default is 0.5, but DA results can be quite sensitive to this parameter. :param lr_decay: Exponential learning rate decay. If set to 1, no decay. Default is 0.5. :param obs_window_indices: Timestep indices where observations fall within each analysis window. For example, if analysis window is 0 - 0.05 with delta_t = 0.01 and observations fall at 0, 0.01, 0.02, 0.03, 0.04, and 0.05, obs_window_indices = [0, 1, 2, 3, 4, 5]. If None (default), will calculate automatically. :param loss_growth_limit: If loss grows by more than this factor during one analysis cycle, JAX will cut off computation and return an error. This prevents it from hanging indefinitely when loss grows exponentionally. Default is 10.