Kalman Filtering in Climate Models - Applied Mathematics · 2020-04-13 · Kalman Filtering in...

29
1/29 Kalman Filtering in Climate Models Kalman Filtering in Climate Models George Hu Brown University December 2019

Transcript of Kalman Filtering in Climate Models - Applied Mathematics · 2020-04-13 · Kalman Filtering in...

Page 1: Kalman Filtering in Climate Models - Applied Mathematics · 2020-04-13 · Kalman Filtering in Climate Models Kalman Filtering Energy Balance Application Kalman Filter for Earth’s

1/29

Kalman Filtering in Climate Models

Kalman Filtering in Climate Models

George Hu

Brown University

December 2019

Page 2: Kalman Filtering in Climate Models - Applied Mathematics · 2020-04-13 · Kalman Filtering in Climate Models Kalman Filtering Energy Balance Application Kalman Filter for Earth’s

2/29

Kalman Filtering in Climate Models

Table of Contents

1 Climate and StatisticsIntroductionData Assimilation

2 Kalman FilteringIntuition and ProofEnergy Balance ApplicationEnsemble Kalman Filter

3 Conclusion

Page 3: Kalman Filtering in Climate Models - Applied Mathematics · 2020-04-13 · Kalman Filtering in Climate Models Kalman Filtering Energy Balance Application Kalman Filter for Earth’s

3/29

Kalman Filtering in Climate Models

Climate and Statistics

Introduction

Climate Data and Statistics

Our knowledge about Earth’s climate relies on data at itscore.

”How is the Earth’s climate changing?” is inherently astatistical question.

What is an ”anomaly” when we have only 1 test subject(the Earth)?How can climate scientists account for less reliablemeasurements and proxies for past data?How do climate models properly incorporate uncertainty?

Page 4: Kalman Filtering in Climate Models - Applied Mathematics · 2020-04-13 · Kalman Filtering in Climate Models Kalman Filtering Energy Balance Application Kalman Filter for Earth’s

4/29

Kalman Filtering in Climate Models

Climate and Statistics

Introduction

Menard and Errera, International Space Science Institute

Page 5: Kalman Filtering in Climate Models - Applied Mathematics · 2020-04-13 · Kalman Filtering in Climate Models Kalman Filtering Energy Balance Application Kalman Filter for Earth’s

5/29

Kalman Filtering in Climate Models

Climate and Statistics

Data Assimilation

Data Assimilation

Main Focus

Data is integrated into mathematical processes consistent withthe physical sciences through Data Assimilation.

Applications:

CO2 Proxy Data (ice cores, sediment analysis, etc.)Temperature Data (sea surface, land, troposphere)Forecasting Atmospheric Dynamics

Page 6: Kalman Filtering in Climate Models - Applied Mathematics · 2020-04-13 · Kalman Filtering in Climate Models Kalman Filtering Energy Balance Application Kalman Filter for Earth’s

6/29

Kalman Filtering in Climate Models

Climate and Statistics

Data Assimilation

Data Assimilation Abstraction

Discrete Spatio-Temporal Process:

State Variables {Xi : i = 1, 2, . . .}, Xi ∈ Rn

Observation Variables {Yi : i = 2, 3, . . .}, Yi ∈ Rm

Transition Model f : Rn → Rn, Xi+1 = f (Xi)

Observation Model g : Rn → Rm, Yi = g(Xi)

Page 7: Kalman Filtering in Climate Models - Applied Mathematics · 2020-04-13 · Kalman Filtering in Climate Models Kalman Filtering Energy Balance Application Kalman Filter for Earth’s

7/29

Kalman Filtering in Climate Models

Climate and Statistics

Data Assimilation

Facets of Data Assimilation

Tasks in data assimilation include:

Finding some Xk given all observations Yi is the task ofreanalysis.

Finding some Xk given observations until the present, Yi ,i ≤ k , is the task of filtering.

Finding some Xk given past observations, Yi , i < k , is thetask of forecasting.

Page 8: Kalman Filtering in Climate Models - Applied Mathematics · 2020-04-13 · Kalman Filtering in Climate Models Kalman Filtering Energy Balance Application Kalman Filter for Earth’s

8/29

Kalman Filtering in Climate Models

Climate and Statistics

Data Assimilation

Facets of Data Assimilation

Data Assimilation can also be divided into:

Variational methods, in which the problem is framed asan optimization problem

minx

f (x)

Sequential methods, in which the problem is framed asusing conditioning

E[f (x) | some stuff ]

Page 9: Kalman Filtering in Climate Models - Applied Mathematics · 2020-04-13 · Kalman Filtering in Climate Models Kalman Filtering Energy Balance Application Kalman Filter for Earth’s

9/29

Kalman Filtering in Climate Models

Kalman Filtering

Kalman Filtering

Sequential Filtering

The Kalman Filter, proposed by Rudolf Kalman (1930-2016),is commonly used as a concise, easily implemented sequentialfiltering algorithm for linear systems with gaussian noise.

Page 10: Kalman Filtering in Climate Models - Applied Mathematics · 2020-04-13 · Kalman Filtering in Climate Models Kalman Filtering Energy Balance Application Kalman Filter for Earth’s

10/29

Kalman Filtering in Climate Models

Kalman Filtering

Intuition and Proof

Forecast and Analysis

Each iteration of the Kalman Filter is composed of

1 A forecast step

Uses the transition model to find the a priori distributionat time k given the posterior distribution at time k − 1.

2 An analysis step

Uses the observation model to find the posteriordistribution at time k given the a priori distribution attime k .

Note that we assume the process is Bayesian.

Page 11: Kalman Filtering in Climate Models - Applied Mathematics · 2020-04-13 · Kalman Filtering in Climate Models Kalman Filtering Energy Balance Application Kalman Filter for Earth’s

11/29

Kalman Filtering in Climate Models

Kalman Filtering

Intuition and Proof

Visualization

Laura Silvinski, Brown University

Page 12: Kalman Filtering in Climate Models - Applied Mathematics · 2020-04-13 · Kalman Filtering in Climate Models Kalman Filtering Energy Balance Application Kalman Filter for Earth’s

12/29

Kalman Filtering in Climate Models

Kalman Filtering

Intuition and Proof

Notation

Our new notation uses gaussian random variables.

A Priori and Posterior Distributions at Time k

X fk ∼ N(x fk ,P

fk ) X a

k ∼ N(xak ,Pak )

xk is the mean estimate, and Pk is the covariance matrix.

Page 13: Kalman Filtering in Climate Models - Applied Mathematics · 2020-04-13 · Kalman Filtering in Climate Models Kalman Filtering Energy Balance Application Kalman Filter for Earth’s

13/29

Kalman Filtering in Climate Models

Kalman Filtering

Intuition and Proof

Transition and Observation Models

Transition Model:

xk = Ak−1xk−1 + ξk

Ak−1 ∈ Rn×n is the linear transition matrix at time k − 1.

ξk ∈ Rn is a RV for gaussian noise, ξk ∼ N(0,Qk).

Observation Model:

yk = Hkxk + ζk

Hk ∈ Rm×n is the linear operator for the observation at timek .

ζk ∈ Rm is a RV for gaussian noise, ζk ∼ N(0,Rk).

Page 14: Kalman Filtering in Climate Models - Applied Mathematics · 2020-04-13 · Kalman Filtering in Climate Models Kalman Filtering Energy Balance Application Kalman Filter for Earth’s

14/29

Kalman Filtering in Climate Models

Kalman Filtering

Intuition and Proof

Forecast Step

The forecast step follows directly from linear algebra.

The a priori estimate follows directly from the transitionmodel

x fk = Ak−1xak−1

Calculating the covariance from the expression for thetransition model gives

P fk = Ak−1P

ak−1A

Tk−1 + Qk

Page 15: Kalman Filtering in Climate Models - Applied Mathematics · 2020-04-13 · Kalman Filtering in Climate Models Kalman Filtering Energy Balance Application Kalman Filter for Earth’s

15/29

Kalman Filtering in Climate Models

Kalman Filtering

Intuition and Proof

A Leap of FaithFor tha Analysis Step, let us assume that there is some matrix Kk

that satisfiesxak = x fk + Kk(yk − Hkx

fk )

(yk − Hkxfk ) is called the innovation.

Kk ∈ Rn×m is known as the Kalman gain matrix.

To find the posterior covariance, we can brute force using theexpectation

Pak = E[(xk − xak )(xk − xak )T ]

= (I − KkHk)P fk (I − KkHk)T + KkRkK

Tk

Page 16: Kalman Filtering in Climate Models - Applied Mathematics · 2020-04-13 · Kalman Filtering in Climate Models Kalman Filtering Energy Balance Application Kalman Filter for Earth’s

16/29

Kalman Filtering in Climate Models

Kalman Filtering

Intuition and Proof

Deriving the Kalman Gain Matrix

The trace of the covariance matrix is the sum of mean squareerror, so we can find the optimal Kk by minimizing the trace of Pa

k .

Tr [Pak ] = Tr [P f

k ]− 2Tr [KkHkPfk ] + Tr [Kk(HkP

fkH

Tk + Rk)KT

k ]

∂Tr [Pak ]

∂Kk= 0 =⇒ Kk = P f

kHTk (HkP

fkH

Tk + Rk)−1

Concise form for covariance is

Pak = (I − KkHk)P f

k

Page 17: Kalman Filtering in Climate Models - Applied Mathematics · 2020-04-13 · Kalman Filtering in Climate Models Kalman Filtering Energy Balance Application Kalman Filter for Earth’s

17/29

Kalman Filtering in Climate Models

Kalman Filtering

Intuition and Proof

Kalman Filter Algorithm

We finally arrive at our algorithm.

Kalman Filtering

Inputs: xa0 ,Pa0 , {Ai−1}, {Hi}, {Qi}, {Ri}, i ∈ {1, 2, . . .}

For k = 1, 2, . . .

x fk = Ak−1xpk−1 A Priori Estimate

P fk = Ak−1P

ak−1A

Tk−1 + Qk A Priori Covariance

Kk = P fkH

Tk (HkP

fkH

Tk + Rk)−1 Kalman Gain

xak = x fk + Kk(yk − Hkxfk ) Posterior Estimate

Pak = (I − KkHk)P f

k Posterior Covariance

Page 18: Kalman Filtering in Climate Models - Applied Mathematics · 2020-04-13 · Kalman Filtering in Climate Models Kalman Filtering Energy Balance Application Kalman Filter for Earth’s

18/29

Kalman Filtering in Climate Models

Kalman Filtering

Energy Balance Application

Using the Kalman Filter

Example: Energy Balance

Let us simulate Kalman Filtering for Earth’s Energy Balance asa process for temperature, with observation variables in threedimensions to represent three independent observations.

The transition model will be a discretization of

∂T

∂t= Ein − Eout

The observation model will use the matrix

H =(1 1 1

)T

Page 19: Kalman Filtering in Climate Models - Applied Mathematics · 2020-04-13 · Kalman Filtering in Climate Models Kalman Filtering Energy Balance Application Kalman Filter for Earth’s

19/29

Kalman Filtering in Climate Models

Kalman Filtering

Energy Balance Application

AlbedoAlbedo, denoted as α, is a coefficient for the measure of solarradiation reflected from Earth. For our purposes, we representalbedo as a function of temperature using a sigmoid function.

α(T ) = 0.7− 0.4

(e(T−285

5 )

1 + e(T−2855 )

)

α(T ) ≈ 0.3 when T > 305K , indicative of Earth’s surfacebeing mainly water.

α(T ) ≈ 0.7 when T < 265K , indicative of Earth’s surfacebeing mainly ice.

Note that this is a positive feedback loop.

Page 20: Kalman Filtering in Climate Models - Applied Mathematics · 2020-04-13 · Kalman Filtering in Climate Models Kalman Filtering Energy Balance Application Kalman Filter for Earth’s

20/29

Kalman Filtering in Climate Models

Kalman Filtering

Energy Balance Application

Energy Budget ODE

∂T

∂t=

1

C

((1− α(T ))

S

4− εσT 4

)

C is the specific heat capacity of the Earth

S is the solar constant, the average spatial energy density ofsunlight received at Earth’s atmosphere

ε is the ”greenhouse factor,” the permittivity of theatmosphere

σ is the Stefan-Boltzmann constant

T is temperature in Kelvin

t is time in seconds

Page 21: Kalman Filtering in Climate Models - Applied Mathematics · 2020-04-13 · Kalman Filtering in Climate Models Kalman Filtering Energy Balance Application Kalman Filter for Earth’s

21/29

Kalman Filtering in Climate Models

Kalman Filtering

Energy Balance Application

Kalman Filter for Earth’s Energy Budget

Parameters set up so that ∂T∂t

= 0 at an semi-stable pointat T = 264K .

Our demonstration uses xa0 = 265 with full confidence,i.e. Pa

0 =(0)

We discretize the ODE using Runge-Kutta-4 with timesteps on the order of 1013 seconds.

Transition covariance: Qi =(0.6)∀i

Observation covariance matrix: Ri = 1.5(I3), ∀i , where Iis the identity matrix.

Page 22: Kalman Filtering in Climate Models - Applied Mathematics · 2020-04-13 · Kalman Filtering in Climate Models Kalman Filtering Energy Balance Application Kalman Filter for Earth’s

22/29

Kalman Filtering in Climate Models

Kalman Filtering

Energy Balance Application

Results

Page 23: Kalman Filtering in Climate Models - Applied Mathematics · 2020-04-13 · Kalman Filtering in Climate Models Kalman Filtering Energy Balance Application Kalman Filter for Earth’s

23/29

Kalman Filtering in Climate Models

Kalman Filtering

Energy Balance Application

Results

Page 24: Kalman Filtering in Climate Models - Applied Mathematics · 2020-04-13 · Kalman Filtering in Climate Models Kalman Filtering Energy Balance Application Kalman Filter for Earth’s

24/29

Kalman Filtering in Climate Models

Kalman Filtering

Ensemble Kalman Filter

More Complex Cases

What if the dynamical system is multi-dimensional and/orlacks a closed form solution to linearize?

Providing an accurate linear transition matrix becomesdifficult; ODE solver approach earlier only works in onedimension.

Can approximate linear transition using the Jacobian, butthat requires closed form solution.

Known as Extended Kalman Filter

Idea: Monte Carlo Approach

Page 25: Kalman Filtering in Climate Models - Applied Mathematics · 2020-04-13 · Kalman Filtering in Climate Models Kalman Filtering Energy Balance Application Kalman Filter for Earth’s

25/29

Kalman Filtering in Climate Models

Kalman Filtering

Ensemble Kalman Filter

Ensemble Kalman Filter (EnKF)

For the forecast step:

1 Sample from previous posterior distribution.2 Update mean estimate by finding the sample mean of

the transitions.3 Update covariance by finding the sample covariance of

the transitions.

Analysis step remains the same.

Page 26: Kalman Filtering in Climate Models - Applied Mathematics · 2020-04-13 · Kalman Filtering in Climate Models Kalman Filtering Energy Balance Application Kalman Filter for Earth’s

26/29

Kalman Filtering in Climate Models

Kalman Filtering

Ensemble Kalman Filter

Lorenz 96

Arbitrary dynamical system governed by

∂xi∂t

= (xi+1 + xi−2)xi−1 − xi + F

Can set to any dimension. Used as a standard example indynamical system analysis.

Indices in xi are interpreted as modular with thedimension for boundary conditions.

F is the forcing term.

Page 27: Kalman Filtering in Climate Models - Applied Mathematics · 2020-04-13 · Kalman Filtering in Climate Models Kalman Filtering Energy Balance Application Kalman Filter for Earth’s

27/29

Kalman Filtering in Climate Models

Kalman Filtering

Ensemble Kalman Filter

Lorenz 96 EnKF Parameters

Process dimension and observation dimension of 40.

Initial value is xa0 =(0.1 0.1 0.1 . . .

)T. Initial

covariance is the zero matrix.

Transition covariance matrices are Qi = 0.6(I40) ∀i .Observation covariance matrices are Ri = 1.5(I40) ∀i .We set F to 8, known to have chaotic behavior.

Number of ensemble members is 100.

Page 28: Kalman Filtering in Climate Models - Applied Mathematics · 2020-04-13 · Kalman Filtering in Climate Models Kalman Filtering Energy Balance Application Kalman Filter for Earth’s

28/29

Kalman Filtering in Climate Models

Kalman Filtering

Ensemble Kalman Filter

Results

Page 29: Kalman Filtering in Climate Models - Applied Mathematics · 2020-04-13 · Kalman Filtering in Climate Models Kalman Filtering Energy Balance Application Kalman Filter for Earth’s

29/29

Kalman Filtering in Climate Models

Conclusion

Ending Remarks

Numerical Weather Prediction and Climate Modeling isactually one of the fastest advancing fields.

Scientists and other specialists in these areas literallyhave to predict the future.Data assimilation, first incorporated in the early 1990s,has been integral to geophysical modeling, by usingadvances in computer science and fluid dynamics forbetter modeling.