NEDAS.assim_tools.assimilators.serial module
- class NEDAS.assim_tools.assimilators.serial.SerialAssimilator(c: Context)[source]
Bases:
AssimilatorSubclass for serial assimilation algorithms
- assim_mode: str = 'serial'
- assign_obs(c: Context)[source]
Assign the observation sequence to each partition par_id
- Parameters:
c (Context) – the runtime context object
- Returns:
Indices in the full obs_seq for the subset of obs that belongs to partition par_id
- Return type:
dict[ObsRecordID, dict[PartitionID, np.ndarray]]
- property loop_cost: CallCost
The three per-observation calls of the serial loop, timed (NEDAS/utils/call_cost.py; opt-in with NEDAS_CALL_COST, otherwise the functions are called untouched). Shared by every serial assimilator, so the native EAKF and a compiled one are timed at the same boundaries; what the loop spends outside them is the broadcast, the distance computations and bookkeeping, which are the same Python for every backend.
- assimilation_algorithm(c: Context)[source]
Implementation of the serial assimilation algorithm.
Notes
serial assimilation goes through the list of observations one by one for each obs the near by state variables are updated one by one. so each update is a scalar problem, which is solved in 2 steps: obs_increment, update_ensemble
- abstractmethod obs_increment(obs_prior, obs_prior_static, obs, obs_err) ndarray[source]
Compute observation-space analysis increments.
- Parameters:
obs_prior (np.ndarray) – Observation priors, 1-D float array of length nens
obs_prior_static (np.ndarray) – Observation priors of the static members (covariance_def.nens_static)
obs (float) – The real observation value
obs_err (float) – Observation error std
- Returns:
observation-space analysis increments
- Return type:
ndarray
- abstractmethod update_local_state(state_prior, state_static, obs_prior, obs_prior_static, obs_incr, ind, state_h_dist, state_v_dist, state_t_dist, hroi, vroi, troi, h_local_func, v_local_func, t_local_func, correlation_local_func, impact_on_variable) None[source]
Update the local state vector with the analysis increments.
- Parameters:
state_prior (np.ndarray) – Local state vector, point-major, shape (nloc, nfld, nens)
state_static (np.ndarray) – Local state of the static members, shape (nloc, nfld, nens_static), not updated
obs_prior (np.ndarray) – Observation priors, shape (nens,)
obs_prior_static (np.ndarray) – Observation priors of the static members, shape (nens_static,)
obs_incr (np.ndarray) – Analysis increments, shape (nens,)
ind (np.ndarray) – The candidate points (indices into nloc) the distances are given for
state_h_dist (np.ndarray) – Distances, shapes (nind,), (nfld, nind), (nfld,)
state_v_dist (np.ndarray) – Distances, shapes (nind,), (nfld, nind), (nfld,)
state_t_dist (np.ndarray) – Distances, shapes (nind,), (nfld, nind), (nfld,)
impact_on_variable (np.ndarray) – Cross-variable localization factor per variable, shape (nfld,)
- abstractmethod update_local_obs(obs_data, obs_data_static, used, obs_prior, obs_prior_static, obs_incr, ind, h_dist, v_dist, t_dist, hroi, vroi, troi, h_local_func, v_local_func, t_local_func, correlation_local_func, impact_on_variable) None[source]
Update the local observations with analysis increments.
- Parameters:
obs_data (np.ndarray) – obs prior ensemble, point-major, shape (nlobs, nens)
obs_data_static (np.ndarray) – obs priors of the static members, shape (nlobs, nens_static), not updated
used (np.ndarray) – boolean mask of already-assimilated obs
ind (np.ndarray) – The candidate obs (indices into nlobs) the distances and impact_on_variable are given for
- class NEDAS.assim_tools.assimilators.serial.BoxBins(grid, x, y, w)[source]
Bases:
objectNeighbor search as DART’s get_close: the points (x, y) are sorted into bins about w wide once, then candidates() returns the points in the bins that overlap grid.search_box, so distances are computed for those alone. Bins count from the grid corner; along a cyclic dim they split the period evenly and wrap around. Every point is a candidate when the grid gives no box.