forked from nansencenter/DAPPER
-
Notifications
You must be signed in to change notification settings - Fork 0
/
example_1.py
56 lines (41 loc) · 1.23 KB
/
example_1.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
"""Illustrate how to use DAPPER to run a 'twin experiment'."""
# Load DAPPER
from dapper import *
# Load experiment setup: the hidden Markov Model (HMM)
from dapper.mods.Lorenz63.sak12 import HMM
HMM.t.T = 30 # shorten experiment
# Simulate synthetic truth (xx) and noisy obs (yy)
xx,yy = simulate(HMM)
# Specify a DA method configuration
config = EnKF('Sqrt', N=10, infl=1.02, rot=True)
# config = Var3D()
# config = PartFilt(N=100,reg=2.4,NER=0.3)
# Turn on liveplotting
config.liveplotting = True
# Assimilate yy, knowing the HMM; xx is used for assessment.
stats = config.assimilate(HMM,xx,yy)
# Average stats time series
avrgs = stats.average_in_time()
# Print averages
print_averages(config,avrgs,[],['rmse_a','rmv_a'])
# Replay liveplotters -- can adjust speed, time-window, etc.
replay(stats)
# Further diagnostic plots:
# plot_rank_histogram(stats)
# plot_err_components(stats)
# plot_hovmoller(xx)
# Explore objects:
# print(HMM)
# print(config)
# print(stats)
# print(avrgs)
# Excercise: Try using
# - Optimal interpolation
# - The (extended) Kalman filter
# - The iterative EnKS
# Hint: suggested DA configs are listed in the HMM file.
# Excercise: Run an experiment for each of the models:
# - LotkaVolterra
# - Lorenz95
# - LA
# - QG