pyPDAF.PDAF.get_state

pyPDAF.PDAF.get_state(steps: int, doexit: int, py__next_observation_pdaf: Callable, py__distribute_state_pdaf: Callable, py__prepoststep_pdaf: Callable, outflag: int) tuple[int, float, int, int]

Distribute analysis state vector to an array.

The primary purpose of this function is to distribute the analysis state vector to the model. This is attained by the user-supplied function py__distribute_state_pdaf(). One can also use this function to get the state vector for other purposes, e.g. to write the state vector to a file.

In this function, the user-supplied function py__next_observation_pdaf() is executed to specify the number of forecast time steps until the next assimilation step. One can also use the user-supplied function to end the assimilation.

In an online DA system, this function also execute the user-supplied function py__prepoststep_state_pdaf(), when this function is first called. The purpose of this design is to call this function right after pyPDAF.PDAF.init() to process the initial ensemble before using it to initialse model forecast. This user-supplied function will not be called afterwards.

This function is also used in flexible parallel system where the number of ensemble members are greater than the parallel model tasks. In this case, this function is called multiple times to distribute the analysis ensemble.

User-supplied function are executed in the following sequence:

  1. py__prepoststep_state_pdaf (only in online system when first called)

  2. py__distribute_state_pdaf

  3. py__next_observation_pdaf

Parameters:
  • steps (int) – Flag and number of time steps

  • doexit (int) – Whether to exit from forecasts

  • py__next_observation_pdaf (Callable) – Provide information on next forecast

  • py__distribute_state_pdaf (Callable) – Routine to distribute a state vector

  • py__prepoststep_pdaf (Callable) – User supplied pre/poststep routine

  • outflag (int) – Status flag

Returns:

  • steps (int) – Flag and number of time steps

  • time (double) – current model time

  • doexit (int) – Whether to exit from forecasts

  • outflag (int) – Status flag