TransportMaps.Distributions.Examples.Lorenz96.Lorenz96Distributions

Module Contents

Classes

Lorenz96DynamicsMap

Defines the evolution of the dynamics of the Lorenz-96 (model II) system.

Lorenz96ForwardEulerMap

Defines the evolution of the Lorenz-96 dynamics for one forward Euler step.

Lorenz96MultipleStepsForwardEulerMap

Defines the evolution of the Lorenz-96 dynamics for \(n\) forward Euler steps.

Lorenz96ForwardEulerDistribution

Defines the Hidden Markov Chain distribution defined by the Lorenz-96 dynamics.

Lorenz96ModalForwardEulerDistribution

Defines the Hidden Markov Chain distribution defined by the Lorenz-96 dynamics in modal form.

class TransportMaps.Distributions.Examples.Lorenz96.Lorenz96Distributions.Lorenz96DynamicsMap(d=40, K=1, F=8.0)[source]

Bases: TransportMaps.Maps.Map

Defines the evolution of the dynamics of the Lorenz-96 (model II) system.

Evaluates the right hand side the Lorenz-96 system:

\[\dot{x}_n = \sum_{j=-J}^J \sum_{i=-J}^J (-x_{n-2K-i} x_{n-K-j} + x_{n-K+j-i} x_{n+K+j})/K^2 - x_{n} + F\]

where \(J=(K-1)/2\) and \(K\) is odd.

The model is presented in

Lorenz, E. N. (2005). Designing Chaotic Models. Journal of the Atmospheric Sciences, 62(5), 1574–1587. https://doi.org/10.1175/JAS3430.1

For the parameter \(K=1\), this reverts to the original Lorenz-96 model

Lorenz, E. (1963). Deterministic nonperiodic flow. Journal of the Atmospheric Sciences. https://doi.org/10.1175/1520-0469(1963)020<0130%3ADNF>2.0.CO%3B2

__init__(d=40, K=1, F=8.0)[source]
Parameters:
  • d (int) – dimension of the state \({\bf x}\)

  • K (int) – smoothing term \(K\) (must be odd)

  • F (float) – forcing term \(F\)

property F[source]
evaluate(x, *args, **kwargs)[source]

[Abstract] Evaluate the map \(T\) at the points \({\bf x} \in \mathbb{R}^{m \times d_x}\).

Parameters:
  • x (ndarray [\(m,d_x\)]) – evaluation points

  • precomp (dict) – dictionary of precomputed values

  • idxs_slice (slice) – if precomputed values are present, this parameter indicates at which of the points to evaluate. The number of indices represented by idxs_slice must match x.shape[0].

Returns:

(ndarray [\(m,d_y\)]) – transformed points

Raises:

NotImplementedError – to be implemented in sub-classes

grad_x(x, *args, **kwargs)[source]

[Abstract] Evaluate the gradient \(\nabla_{\bf x}T\) at the points \({\bf x} \in \mathbb{R}^{m \times d_x}\).

Parameters:
  • x (ndarray [\(m,d_x\)]) – evaluation points

  • precomp (dict) – dictionary of precomputed values

  • idxs_slice (slice) – if precomputed values are present, this parameter indicates at which of the points to evaluate. The number of indices represented by idxs_slice must match x.shape[0].

Returns:

(ndarray [\(m,d_y,d_x\)]) – transformed points

Raises:

NotImplementedError – to be implemented in sub-classes

tuple_grad_x(x, *args, **kwargs)[source]

[Abstract] Evaluate the function and gradient.

Parameters:
  • x (ndarray [\(m,d_x\)]) – evaluation points

  • precomp (dict) – dictionary of precomputed values

  • idxs_slice (slice) – if precomputed values are present, this parameter indicates at which of the points to evaluate. The number of indices represented by idxs_slice must match x.shape[0].

Returns:

(tuple) – function and gradient evaluation

Raises:

NotImplementedError – to be implemented in sub-classes

hess_x(x, *args, **kwargs)[source]

[Abstract] Evaluate the Hessian \(\nabla^2_{\bf x}T\) at the points \({\bf x} \in \mathbb{R}^{m \times d_x}\).

Parameters:
  • x (ndarray [\(m,d_x\)]) – evaluation points

  • precomp (dict) – dictionary of precomputed values

  • idxs_slice (slice) – if precomputed values are present, this parameter indicates at which of the points to evaluate. The number of indices represented by idxs_slice must match x.shape[0].

Returns:

(ndarray [\(m,d_y,d_x,d_x\)]) – transformed points

Raises:

NotImplementedError – to be implemented in sub-classes

action_hess_x(x, dx, *args, **kwargs)[source]

[Abstract] Evaluate the action of the Hessian \(\langle\nabla^2_{\bf x}T,\delta{\bf x}\rangle\) at the points \({\bf x} \in \mathbb{R}^{m \times d_x}\).

Parameters:
  • x (ndarray [\(m,d_x\)]) – evaluation points

  • dx (ndarray [\(m,d_x\)]) – direction on which to evaluate the Hessian

  • precomp (dict) – dictionary of precomputed values

  • idxs_slice (slice) – if precomputed values are present, this parameter indicates at which of the points to evaluate. The number of indices represented by idxs_slice must match x.shape[0].

Returns:

(ndarray [\(m,d_y,d_x\)]) – transformed points

Raises:

NotImplementedError – to be implemented in sub-classes

class TransportMaps.Distributions.Examples.Lorenz96.Lorenz96Distributions.Lorenz96ForwardEulerMap(dt, d=40, K=1, F=8.0)[source]

Bases: TransportMaps.Maps.ODEs.AutonomousForwardEulerMap

Defines the evolution of the Lorenz-96 dynamics for one forward Euler step.

Evaluates the Euler step of the Lorenz-96 system:

\[\dot{x}_i^{(n+1)} = x_i^{(n)} + \Delta t \cdot (x_{i+1}^{(n)} - x_{i-2}^{(n)}) x_{i-1}^{(n)} / K^2 - x_{i}^{(n)} + F\]
__init__(dt, d=40, K=1, F=8.0)[source]
Parameters:
  • dt (float) – step site \(\Delta t\)

  • d (int) – dimension of the state \({\bf x}\)

  • K (int) – smoothing term \(K\) (must be odd)

  • F (float) – forcing term \(F\)

property K[source]
property F[source]
class TransportMaps.Distributions.Examples.Lorenz96.Lorenz96Distributions.Lorenz96MultipleStepsForwardEulerMap(n, dt, d=40, K=1, F=8.0)[source]

Bases: TransportMaps.Maps.ListCompositeMap

Defines the evolution of the Lorenz-96 dynamics for \(n\) forward Euler steps.

Evaluates \(n\) times the Euler step of the Lorenz-96 system:

\[\dot{x}_i^{(k)} \mapsto x_i^{(k)} + \Delta t \cdot (x_{i+1}^{(k)} - x_{i-2}^{(k)}) x_{i-1}^{(k)} / K^2 - x_{i}^{(k)} + F\]
__init__(n, dt, d=40, K=1, F=8.0)[source]
Parameters:
  • n (int) – number \(n\) of Euler steps.

  • dt (float) – step size \(\Delta t\)

  • d (int) – dimension of the state \({\bf x}\)

  • K (int) – smoothing term \(K\) (must be odd)

  • F (float) – forcing term \(F\)

property n[source]
property dt[source]
property K[source]
property F[source]
property l96femap[source]
class TransportMaps.Distributions.Examples.Lorenz96.Lorenz96Distributions.Lorenz96ForwardEulerDistribution(n, dt, d, K, F, pi_init, pi_dyn, obs_map, pi_noise)[source]

Bases: TransportMaps.Distributions.Decomposable.SequentialInferenceDistributions.HiddenLag1TransitionTimeHomogeneousMarkovChainDistribution

Defines the Hidden Markov Chain distribution defined by the Lorenz-96 dynamics.

For the index sets \(\Lambda={in : i=0,\ldots}\) and \(\Xi \subset \Lambda\) the model is defined by

\[\begin{split}\begin{cases} {\bf x}_{k+n} = g({\bf x}_k) + \varepsilon_{\text{dyn}} & \text{for } k \in \Lambda \\ {\bf y}_{k+n} &= h({\bf x}_{k+n}) + \varepsilon_{\text{noise}} & \text{for } k+n \in \Xi \;, \end{cases}\end{split}\]

where \(g:{\bf x}_k \mapsto {\bf x}_{k+n}\) is the map corresponding to \(n\) Euler steps of the discretized dynamics with time step \(\Delta t\), \(h\) is the observation operator, \(\varepsilon_{\text{dyn}} \sim \pi_{\text{dyn}}\) is the dynamics noise, \(\varepsilon_{\text{noise}} \sim \pi_{\text{noise}}\) is the observational noise and the initial conditions \({\bf x}_0\) are distributed according to \(\pi_{\text{init}}\).

property n[source]
property dt[source]
property K[source]
property F[source]
property t[source]
property t_obs[source]
property xs[source]
property l96map[source]
property obs_map[source]
step(y, x=None)[source]

Add a step to the hidden Markov Chain.

Parameters:
  • y – observation. None if missing.

  • x – state if known (for diagnostic)

class TransportMaps.Distributions.Examples.Lorenz96.Lorenz96Distributions.Lorenz96ModalForwardEulerDistribution(n, dt, d, K, F, modal_map, pi_init, pi_dyn, obs_map, pi_noise)[source]

Bases: Lorenz96ForwardEulerDistribution

Defines the Hidden Markov Chain distribution defined by the Lorenz-96 dynamics in modal form.

For the index sets \(\Lambda={in : i=0,\ldots}\) and \(\Xi \subset \Lambda\) the model is defined by

\[\begin{split}\begin{cases} {\bf b}_{k+n} = P_r^{-1} \circ g \circ P_r({\bf b}_k) + \varepsilon^r_{\text{dyn}} & \text{for } k \in \Lambda \\ {\bf y}_{k+n} &= h\circ P_r({\bf b}_{k+n}) + \varepsilon_{\text{noise}} & \text{for } k+n \in \Xi \;, \end{cases}\end{split}\]

where \(g:{\bf x}_k \mapsto {\bf x}_{k+n}\) is the map corresponding to \(n\) Euler steps of the discretized dynamics with time step \(\Delta t\), \(P_r:\mathbb{R}^d\rightarrow\mathbb{R}^r\) is a projection operator onto the modal subspace (\(r\leq d\)), \(h\) is the observation operator, \(\varepsilon^r_{\text{dyn}} \sim \pi^r_{\text{dyn}}\) is the noise of the modal dynamics, \(\varepsilon_{\text{noise}} \sim \pi_{\text{noise}}\) is the observational noise and the initial conditions \({\bf b}_0\) are distributed according to \(\pi^r_{\text{init}}\).

property modal_map[source]
property obs_map[source]
property bs[source]
step(y, x=None)[source]

Add a step to the hidden Markov Chain.

Parameters:
  • y – observation. None if missing.

  • x – state if known (for diagnostic)