DART Tutorial Sec’on 1: Filtering For a One Variable System · DART Tutorial Sec’on 1: Slide 2...

Preview:

Citation preview

TheNa'onalCenterforAtmosphericResearchissponsoredbytheNa'onalScienceFounda'on.Anyopinions,findingsandconclusionsorrecommenda'onsexpressedinthispublica'onarethoseoftheauthor(s)anddonotnecessarilyreflecttheviewsoftheNa'onalScienceFounda'on.

©UCAR

DARTTutorialSec'on1:FilteringForaOneVariableSystem

DARTTutorialSec'on1:Slide2

Introduc'on

Thisseriesoftutorialpresenta'onsisdesignedtointroducebothbasicEnsembleKalmanfiltertheoryandtheDataAssimila'onResearchTestbedCommunityFacilityforEnsembleDataAssimila'on.ThereissignificantoverlapwiththeDART_LABtutorialthatisalsopartoftheDARTsubversioncheckout.IfyouhavealreadystudiedDART_LAB,feelfreetoskipthroughtheredundanttheoryslides.However,doingtheexercisesinallsec'onsofthistutorialisrecommendedinordertolearnthebestwaystousetheDARTsystem.

−6 −4 −2 0 2 4 60

0.05

0.1

0.15

0.2 Prior PDF

Prob

abilit

y

A :PriorEs'matebasedonallpreviousinforma'on,C.B :Anaddi'onalobserva'on.p(A|BC) :Posterior(updatedes'mate)basedonCandB.

p A | BC( ) = p(B | AC)p(A |C)p(B |C)

= p(B | AC)p(A |C)p(B | x)p(x |C)dx∫

Bayes’Rule

DARTTutorialSec'on1:Slide3DARTTutorialSec'on1:Slide3

A :PriorEs'matebasedonallpreviousinforma'on,C.B :Anaddi'onalobserva'on.p(A|BC) :Posterior(updatedes'mate)basedonCandB.

−6 −4 −2 0 2 4 60

0.05

0.1

0.15

0.2 Prior PDF

Prob

abilit

y Obs. Likelihood

p A | BC( ) = p(B | AC)p(A |C)p(B |C)

= p(B | AC)p(A |C)p(B | x)p(x |C)dx∫

Bayes’Rule

DARTTutorialSec'on1:Slide4

A :PriorEs'matebasedonallpreviousinforma'on,C.B :Anaddi'onalobserva'on.p(A|BC) :Posterior(updatedes'mate)basedonCandB.

−6 −4 −2 0 2 4 60

0.05

0.1

0.15

0.2 Prior PDF

Prob

abilit

y Obs. Likelihood

Product (Numerator)

p A | BC( ) = p(B | AC)p(A |C)p(B |C)

= p(B | AC)p(A |C)p(B | x)p(x |C)dx∫

Bayes’Rule

DARTTutorialSec'on1:Slide5

A :PriorEs'matebasedonallpreviousinforma'on,C.B :Anaddi'onalobserva'on.p(A|BC) :Posterior(updatedes'mate)basedonCandB.

−6 −4 −2 0 2 4 60

0.05

0.1

0.15

0.2 Prior PDF

Prob

abilit

y Obs. Likelihood

Normalization (Denom.)

p A | BC( ) = p(B | AC)p(A |C)p(B |C)

= p(B | AC)p(A |C)p(B | x)p(x |C)dx∫

Bayes’Rule

DARTTutorialSec'on1:Slide6

−6 −4 −2 0 2 4 60

0.05

0.1

0.15

0.2 Prior PDF

Prob

abilit

y Obs. Likelihood

Normalization (Denom.)

Posterior

p A | BC( ) = p(B | AC)p(A |C)p(B |C)

= p(B | AC)p(A |C)p(B | x)p(x |C)dx∫

A :PriorEs'matebasedonallpreviousinforma'on,C.B :Anaddi'onalobserva'on.p(A|BC) :Posterior(updatedes'mate)basedonCandB.

Bayes’Rule

DARTTutorialSec'on1:Slide7

Green==Prior

Red==Observa'on

Blue==Posterior

ThesamecolorschemeisusedthroughoutALLTutorialmaterials.

ColorScheme

DARTTutorialSec'on1:Slide8

ThisproductisclosedforGaussiandistribu'ons.

−4 −2 0 2 40

0.2

0.4

0.6

Prob

abilit

y

Prior PDF

Obs. Likelihood

p A | BC( ) = p(B | AC)p(A |C)p(B |C)

= p(B | AC)p(A |C)p(B | x)p(x |C)dx∫

ProductofTwoGaussians

DARTTutorialSec'on1:Slide9

ThisproductisclosedforGaussiandistribu'ons.

−4 −2 0 2 40

0.2

0.4

0.6

Prob

abilit

y

Prior PDF

Obs. Likelihood

Posterior PDF

p A | BC( ) = p(B | AC)p(A |C)p(B |C)

= p(B | AC)p(A |C)p(B | x)p(x |C)dx∫

ProductofTwoGaussians

DARTTutorialSec'on1:Slide10

N (µ1,∑1)N (µ2 ,∑2 ) = cN (µ,∑)

Productofd-dimensionalnormalswithmeansandandcovariancematricesand

isnormal.

µ1 µ2∑1 ∑2

ProductofTwoGaussians

DARTTutorialSec'on1:Slide11

Productofd-dimensionalnormalswithmeansandandcovariancematricesand

isnormal.

Covariance:

Mean:

N (µ1,∑1)N (µ2 ,∑2 ) = cN (µ,∑)

∑ = (∑1−1+∑2

−1)−1

µ = (∑1−1+∑2

−1)−1(∑1−1µ1 +∑2

−1µ2 )

µ1 µ2∑1 ∑2

ProductofTwoGaussians

DARTTutorialSec'on1:Slide12

Productofd-dimensionalnormalswithmeansandandcovariancematricesand

isnormal.

Covariance:

Mean:

Weight:

N (µ1,∑1)N (µ2 ,∑2 ) = cN (µ,∑)

∑ = (∑1−1+∑2

−1)−1

µ = (∑1−1+∑2

−1)−1(∑1−1µ1 +∑2

−1µ2 )

µ1 µ2∑1 ∑2

We’llignoretheweightunlessnotedsinceweimmediatelynormalizeproductstobePDFs.

ProductofTwoGaussians

c = 1(2∏)d /2 ∑1 +∑2

1/2 exp − 12

µ2 − µ1( )T (∑1 +∑2 )−1 µ2 − µ1( )⎡

⎣⎤⎦

⎧⎨⎩

⎫⎬⎭

DARTTutorialSec'on1:Slide13

Productofd-dimensionalnormalswithmeansandandcovariancematricesand

isnormal.

Covariance:

Mean:

Weight:

N (µ1,∑1)N (µ2 ,∑2 ) = cN (µ,∑)

∑ = (∑1−1+∑2

−1)−1

µ = (∑1−1+∑2

−1)−1(∑1−1µ1 +∑2

−1µ2 )

µ1 µ2∑1 ∑2

Easytoderivefor1-DGaussians;justdoproductsofexponen'als.

ProductofTwoGaussians

c = 1(2∏)d /2 ∑1 +∑2

1/2 exp − 12

µ2 − µ1( )T (∑1 +∑2 )−1 µ2 − µ1( )⎡

⎣⎤⎦

⎧⎨⎩

⎫⎬⎭

DARTTutorialSec'on1:Slide14

ThisproductisclosedforGaussiandistribu'ons.

−4 −2 0 2 40

0.1

0.2

0.3

Prob

abilit

y Prior PDF

Thereareotherfamiliesoffunc'onsforwhichitisclosed…But,forgeneraldistribu'ons,there’snoanaly'calproduct.

ProductofTwoGaussians

p A | BC( ) = p(B | AC)p(A |C)p(B |C)

= p(B | AC)p(A |C)p(B | x)p(x |C)dx∫

DARTTutorialSec'on1:Slide15

−4 −2 0 2 40

0.1

0.2

0.3

Prob

abilit

y Prior PDF

Obs. Likelihood

ProductofTwoGaussians

p A | BC( ) = p(B | AC)p(A |C)p(B |C)

= p(B | AC)p(A |C)p(B | x)p(x |C)dx∫

ThisproductisclosedforGaussiandistribu'ons.

Thereareotherfamiliesoffunc'onsforwhichitisclosed…But,forgeneraldistribu'ons,there’snoanaly'calproduct.

DARTTutorialSec'on1:Slide16

−4 −2 0 2 40

0.1

0.2

0.3

Prob

abilit

y Prior PDF

Obs. Likelihood

Posterior PDF

ProductofTwoGaussians

p A | BC( ) = p(B | AC)p(A |C)p(B |C)

= p(B | AC)p(A |C)p(B | x)p(x |C)dx∫

ThisproductisclosedforGaussiandistribu'ons.

Thereareotherfamiliesoffunc'onsforwhichitisclosed…But,forgeneraldistribu'ons,there’snoanaly'calproduct.

DARTTutorialSec'on1:Slide17

Don’tknowmuchaboutproper'esofthissample.Maynaivelyassumeitisrandomdrawfrom‘truth’.

Ensemblefilters:Priorisavailableasfinitesample.

−4 −2 0 2 40

0.2

0.4

0.6

Prob

abilit

y

Prior Ensemble

ProductofTwoGaussians

p A | BC( ) = p(B | AC)p(A |C)p(B |C)

= p(B | AC)p(A |C)p(B | x)p(x |C)dx∫

DARTTutorialSec'on1:Slide18

Howcanwetakeproductofsamplewithcon'nuouslikelihood?

Fitacon'nuous(Gaussianfornow)distribu'ontosample.−4 −2 0 2 40

0.2

0.4

0.6

Prob

abilit

y

Prior PDF

Prior Ensemble

ProductofTwoGaussians

p A | BC( ) = p(B | AC)p(A |C)p(B |C)

= p(B | AC)p(A |C)p(B | x)p(x |C)dx∫

DARTTutorialSec'on1:Slide19

Observa'onlikelihoodusuallycon'nuous(nearlyalwaysGaussian).

IfObs.Likelihoodisn’tGaussian,cangeneralizemethodsbelow.Forinstance,canfitsetofGaussiankernelstoobs.likelihood.

−4 −2 0 2 40

0.2

0.4

0.6

Prob

abilit

y

Prior PDF

Obs. Likelihood

Prior Ensemble

ProductofTwoGaussians

p A | BC( ) = p(B | AC)p(A |C)p(B |C)

= p(B | AC)p(A |C)p(B | x)p(x |C)dx∫

DARTTutorialSec'on1:Slide20

ProductofpriorGaussianfitandObs.likelihoodisGaussian.

Compu'ngcon'nuousposteriorissimple.BUT,needtohaveaSAMPLEofthisPDF.

−4 −2 0 2 40

0.2

0.4

0.6

Prob

abilit

y

Prior PDF

Obs. Likelihood

Posterior PDF

Prior Ensemble

ProductofTwoGaussians

p A | BC( ) = p(B | AC)p(A |C)p(B |C)

= p(B | AC)p(A |C)p(B | x)p(x |C)dx∫

DARTTutorialSec'on1:Slide21

Therearemanywaystodothis.

Exactproper'esofdifferentmethodsmaybeunclear.Trialanderrors'llbestwaytoseehowtheyperform.Willinteractwithproper'esofpredic'onmodels,etc.

−2 −1 0 1 2 30

0.2

0.4

0.6Posterior PDF

Prob

abilit

y

SamplingPosteriorPDF

DARTTutorialSec'on1:Slide22

EnsembleAdjustment(Kalman)Filter

−4 −2 0 2 40

0.2

0.4

0.6

Prior Ensemble

Prob

abilit

y

SamplingPosteriorPDF

DARTTutorialSec'on1:Slide23

EnsembleAdjustment(Kalman)Filter

Again,fitaGaussiantosample.

−4 −2 0 2 40

0.2

0.4

0.6

Prior Ensemble

Prob

abilit

y

Prior PDF

SamplingPosteriorPDF

DARTTutorialSec'on1:Slide24

EnsembleAdjustment(Kalman)Filter

ComputeposteriorPDF(sameaspreviousalgorithms).

−4 −2 0 2 40

0.2

0.4

0.6

Prior Ensemble

Prob

abilit

y

Prior PDFObs. Likelihood

Posterior PDF

SamplingPosteriorPDF

DARTTutorialSec'on1:Slide25

EnsembleAdjustment(Kalman)Filter

Usedeterminis'calgorithmto‘adjust’ensemble.1.  ‘Shil’ensembletohaveexactmeanofposterior.2.  Uselinearcontrac'ontohaveexactvarianceofposterior.

−4 −2 0 2 40

0.2

0.4

0.6

Prob

abilit

y

Posterior PDF

SamplingPosteriorPDF

DARTTutorialSec'on1:Slide26

EnsembleAdjustment(Kalman)Filter

−4 −2 0 2 40

0.2

0.4

0.6

Prob

abilit

y

Posterior PDF

Mean Shifted

Usedeterminis'calgorithmto‘adjust’ensemble.1.  ‘Shil’ensembletohaveexactmeanofposterior.2.  Uselinearcontrac'ontohaveexactvarianceofposterior.

SamplingPosteriorPDF

DARTTutorialSec'on1:Slide27

EnsembleAdjustment(Kalman)Filter

−4 −2 0 2 40

0.2

0.4

0.6

Prob

abilit

y

Posterior PDF

Mean ShiftedVariance Adjusted

Usedeterminis'calgorithmto‘adjust’ensemble.1.  ‘Shil’ensembletohaveexactmeanofposterior.2.  Uselinearcontrac'ontohaveexactvarianceofposterior.

SamplingPosteriorPDF

DARTTutorialSec'on1:Slide28

p isprior,u isupdate(posterior),

isstandarddevia'on,overbarisensemblemean.

EnsembleAdjustment(Kalman)Filter

−4 −2 0 2 40

0.2

0.4

0.6

Prob

abilit

y

Posterior PDF

Mean ShiftedVariance Adjusted

xiu = xi

p − x p( ) i σ u /σ p( ) + x uσi=1,...,ensemblesize.

SamplingPosteriorPDF

DARTTutorialSec'on1:Slide29

EnsembleAdjustment(Kalman)Filter

−4 −2 0 2 40

0.2

0.4

0.6

Prob

abilit

y

Posterior PDF

Mean ShiftedVariance Adjusted

Bimodalitymaintained,butnotappropriatelyposi'onedorweighted.Noproblemwithrandomoutliers.

SamplingPosteriorPDF

DARTTutorialSec'on1:Slide30

EnsembleAdjustment(Kalman)Filter

−4 −2 0 2 40

0.2

0.4

0.6

Prob

abilit

y

Posterior PDF

Mean ShiftedVariance Adjusted

Thereareavarietyofotherwaystodeterminis'callyadjustensemble.Classofalgorithmssome'mescalleddeterminis'csquarerootfilters.

SamplingPosteriorPDF

DARTTutorialSec'on1:Slide31

1stlookatDARTDiagnos'cs

cd models/lorenz_63/work inyourDARTsandbox.csh workshop_setup.csh Doesstuffyou’lllearntodolater.matlab -nodesktop

OutputfromaDARTassimila'onin3-variablemodel.20memberensemble.Observa'onsofeachvariableonceevery‘6hours’;errorvariance8.Observa'onONLYimpactsitsownstatevariable.Forassimila'on,lookslike3independentsinglevariableproblems.Modeladvancebetweenassimila'onsisn’tindependent.

Ini'alensemblemembersarerandomselec'onfromlongmodelrun.Ini'alerrorshouldbeanupperbound(randomguess).

DARTTutorialSec'on1:Slide32

1stlookatDARTDiagnos'cs

TrythefollowingMatlabcommands.Eachwillaskyouto:Inputnameofensembletrajectoryfile:<cr>forpreassim.nc

JustselectthedefaultfilebyhipngcarriagereturnforallMatlabexercisesfornow.

'meseriesofdistancebetweenpriorensemblemeanandtruthinblue;spread,averagepriordistancebetweenensemblemembersandmean,inred.(Recordtotalvaluesoftotalerrorandspreadforlater.)'meseriesoftruthinblue;ensemblemeanpriorinred.Figure1isseparatepanelforeachstatevariable.Figure2isthree-dimensionalplot.alsoincludespriorensemblemembersingreenforFigure1.

plot_total_err

plot_ens_mean_-me_series

plot_ens_-me_series

DARTTutorialSec'on1:Slide33

SimpleExample:Lorenz633-variablechao'cmodel

−20

0

20 −20

0

2010203040

Observa'oninred.Priorensembleingreen.Observingallthreestatevariables.Obs.Errorvariance=4.0.Four20-memberensembles.

DARTTutorialSec'on1:Slide34

SimpleExample:Lorenz633-variablechao'cmodel

−20

0

20 −20

0

2010203040

Observa'oninred.Priorensembleingreen.

DARTTutorialSec'on1:Slide35

SimpleExample:Lorenz633-variablechao'cmodel

−20

0

20 −20

0

2010203040

Observa'oninred.Priorensembleingreen.

DARTTutorialSec'on1:Slide36

SimpleExample:Lorenz633-variablechao'cmodel

−20

0

20 −20

0

2010203040

Observa'oninred.Priorensembleingreen.

DARTTutorialSec'on1:Slide37

SimpleExample:Lorenz633-variablechao'cmodel

−20

0

20 −20

0

2010203040

Observa'oninred.Priorensembleingreen.Ensembleispassingthroughanunpredictableregion.

DARTTutorialSec'on1:Slide38

SimpleExample:Lorenz633-variablechao'cmodel

−20

0

20 −20

0

2010203040

Observa'oninred.Priorensembleingreen.Partoftheensembleheadsforonelobe,therestfortheother..

DARTTutorialSec'on1:Slide39

SimpleExample:Lorenz633-variablemodel

−20

0

20 −20

0

2010203040

Observa'oninred.Priorensembleingreen.

DARTTutorialSec'on1:Slide40

UsingDARTDiagnos'cs

UsingDARTdiagnos'csfromthesimpleLorenz63assimila'on:Canyouseeevidenceofenhanceduncertainty?Wheredoesthisoccur?Doestheensembleappeartobeconsistentwiththetruth?

(Isthetruthnormallyinsidetheensemblerange?)

DARTTutorialSec'on1:Slide41

1.   FilteringForaOneVariableSystem2.   TheDARTDirectoryTree3.   DARTRun>meControlandDocumenta>on4.   Howshouldobserva>onsofastatevariableimpactanunobservedstatevariable?

Mul>variateassimila>on.5.   ComprehensiveFilteringTheory:Non-Iden>tyObserva>onsandtheJointPhaseSpace6.   OtherUpdatesforAnObservedVariable7.   SomeAddi>onalLow-OrderModels8.   DealingwithSamplingError9.   MoreonDealingwithError;Infla>on10.   RegressionandNonlinearEffects11.   Crea>ngDARTExecutables12.   Adap>veInfla>on13.   HierarchicalGroupFiltersandLocaliza>on14.   QualityControl15.   DARTExperiments:ControlandDesign16.   Diagnos>cOutput17.   Crea>ngObserva>onSequences18.   LostinPhaseSpace:TheChallengeofNotKnowingtheTruth19.   DART-CompliantModelsandMakingModelsCompliant20.   ModelParameterEs>ma>on21.   Observa>onTypesandObservingSystemDesign22.   ParallelAlgorithmImplementa>on23.  Loca'onmoduledesign(notavailable)24.  Fixedlagsmoother(notavailable)25.   Asimple1Dadvec>onmodel:TracerDataAssimila>on

DARTTutorialIndextoSec'ons

DARTTutorialSec'on1:Slide42

Recommended