Skip to main content

Symbolic Calculation for the Parametric Dynamics

Project description

SymPKF: a symbolic and computational toolbox for the design of parametric Kalman filter dynamics

Introduction

Recent researches in data assimilation lead to the introduction of the parametric Kalman filter (PKF): an implementation of the Kalman filter, where the covariance matrices are approximated by a parameterized covariance model. In the PKF, the dynamics of the covariance during the forecast step relies on the prediction of the covariance parameters. Hence, the design of the parameter dynamics is crucial while it can be tedious to do this by hand. This contribution introduces a python package, SymPKF, able to compute PKF dynamics for univariate statistics and when the covariance model is parameterized from the variance and the local anisotropy of the correlations. The ability of SymPKF to produce the PKF dynamics is shown on a non-linear diffusive advection (Burgers equation) over a 1D domain and the linear advection over a 2D domain. The computation of the PKF dynamics is performed at a symbolic level using sympy (Meurer2017), but an automatic code generator is also introduced to perform numerical simulations. A final multivariate example illustrates the potential of SymPKF to go beyond the univariate case.

This work has been supported by the French INSU-LEFE, grant KAPA
logo lefe

Examples

PKF for the Burgers equation

To illustrate SymPKF, we first consider the Burgers' equation. The dynamics is defined thanks to sympy Meurer2017

Definition of the dynamics by using sympy

The definition of the Burgers dynamics relies on the definition of a coordinate system $(t,x)$ and the function $u(t,x)$. A pre-processing of the dynamics is performed by the class PDESystem of SymPKF, as shown in the following illustration.

Computation of the PKF dynamics using SymPKF Then, the computation of the PKF dynamics is performed in SymPKF by using the class SymPKF as follows

It appears that the dynamics is not closed since the expression can not be computed from the known quantities $u$, $V_u$ and $s_u$.

This shows that, in general, the PKF dynamics is not closed. To go further, a closure is needed, either from an analytical expression or from a data-driven strategy as proposed in PDE-NetGen

Automatic code generation for numerical simulations

To illustrate the potential of using SymPKF, we introduce the closure proposed by Pannekoucke2018, and from which a numerical code can be rendered as follows

Here, closed_kf_burgers is an instance of the class ClosedPKFBurgers which has been generated at runtime. This class inherit from an abstract class Model useful methods. It can perform a forecast as well as an ensemble_forecast as shown in the following UML diagram

An example of numerical simulation performed from the runtime code is given here:

The notebook corresponding to the Burgers' dynamics can be found in the ./example/ directory PKF on Burgers (see pdf file ).

PKF for the 2D advection

While SymPKF applies in 1D, it also applies in 2D and 3D domains. As shown in the following two pictures which detail the case of the advection equation.

see the corresponding notebooks PKF for 2D advection (pdf output. An ensemble validation is also provided as an example, but it relies on a side package pydap not published PKF 2D with ensemble validation (see pdf output )

Illustration of the PKF applied on a system of evolution equation

The present implementation of SymPKF can also be used to study the dynamic of multivariate situation as shown below.

See the corresponding notebooks PKF for 1D harmonic oscillator ( see pdf output ) and PKF for 2D harmonic oscillator (see pdf output)

Note that this example shows that SymPKF can handle a system of partial differential equation.

Install

  1. Clone the repository git clone https://github.com/opannekoucke/sympkf.git
  2. Install the package make install (or python setup.py install)
  3. Examples are given as jupyter notebooks (see ./example/)

Citation

@Article{Pannekoucke2021GMD,
  author    = {Olivier Pannekoucke and Philippe Arbogast},
  journal   = {Geoscientific Model Development},
  title     = {{SymPKF} (v1.0): a symbolic and computational toolbox for the design of parametric Kalman filter dynamics},
  year      = {2021},
  month     = {oct},
  number    = {10},
  pages     = {5957--5976},
  volume    = {14},
  doi       = {10.5194/gmd-14-5957-2021},  
  publisher = {Copernicus {GmbH}},
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sympkf-1.0.3.tar.gz (47.1 kB view details)

Uploaded Source

Built Distribution

sympkf-1.0.3-py3-none-any.whl (52.1 kB view details)

Uploaded Python 3

File details

Details for the file sympkf-1.0.3.tar.gz.

File metadata

  • Download URL: sympkf-1.0.3.tar.gz
  • Upload date:
  • Size: 47.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/3.10.0 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.8.8

File hashes

Hashes for sympkf-1.0.3.tar.gz
Algorithm Hash digest
SHA256 4d0ffbc36694cc08f9338281cc328e9978ffe72e39e175b801c120c3a3a903d7
MD5 b03041057e4862b5261e2346f6141705
BLAKE2b-256 62ab11a4cf6d17a75a0ec5272cef1c2af46f263cadfe6b50bcc57d9c547861a9

See more details on using hashes here.

File details

Details for the file sympkf-1.0.3-py3-none-any.whl.

File metadata

  • Download URL: sympkf-1.0.3-py3-none-any.whl
  • Upload date:
  • Size: 52.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/3.10.0 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.8.8

File hashes

Hashes for sympkf-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 cc6dfc919bb5cefc52c110ef1c1002825cb56b814c07214dbf3aa2e8f31ef91d
MD5 5b4ef9ca95bca2f6a6fb15f5c359e811
BLAKE2b-256 9b436e80f37d922d805181913bb2c946d2442f3975e48448e3c126ae828abc70

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page