Skip to content

Commit

Permalink
Updated 4dvar notation, working
Browse files Browse the repository at this point in the history
  • Loading branch information
kysolvik committed Nov 29, 2023
1 parent c93d4b1 commit c3f2f3b
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions dabench/dacycler/_var4d.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ def _cycle_obsop(self, xb0, obs_values, obs_loc_indices,
obs_values, H, B,
Rinv, M, obs_window_indices)


# forecast
x = self.step_forecast(
n_steps=n_steps,
Expand Down Expand Up @@ -176,8 +177,7 @@ def _innerloop_4d(self, system_dim, x, xb0, y, H, B, Rinv, M,
Args:
system_dim (int): The dimension of the system state.
x (ndarray): Current best guess for trajectory. Updated each outer
loop.
(time_dim, system_dim)
loop. (time_dim, system_dim)
xb0 (ndarray): Initial background estimate for initial conditions.
Stays constant throughout analysis cycle. Shape: (system_dim,)
y (ndarray): Time array of observation. Shape: (num_obs, obs_dim)
Expand All @@ -197,7 +197,7 @@ def _innerloop_4d(self, system_dim, x, xb0, y, H, B, Rinv, M,
Shape: (system_dim,)
"""
x0_last = x[0].ravel()
x0_last = x[0]

# Set up Variables
SumMtHtRinvD = np.zeros((system_dim, 1)) # b input
Expand All @@ -215,10 +215,10 @@ def _innerloop_4d(self, system_dim, x, xb0, y, H, B, Rinv, M,
SumMtHtRinvD += MtHtRinv @ D[:, None]

# Compute initial departure
db0 = x0_last - xb0.ravel()
db0 = x0_last - xb0

# Solve Ax=b for the initial perturbation
dx0 = self._solve(db0, SumMtHtRinvHM, SumMtHtRinvD, B)
dx0 = self._solve(-db0, SumMtHtRinvHM, SumMtHtRinvD, B)

# New x0 guess is the last guess plus the analyzed delta
x0_new = x0_last + dx0.ravel()
Expand Down

0 comments on commit c3f2f3b

Please sign in to comment.