dapper.mods.Lorenz96.bocquet2015loc
Settings as in bib.bocquet2016localization
.
1"""Settings as in `bib.bocquet2016localization`.""" 2 3import numpy as np 4 5from dapper.mods.Lorenz96.sakov2008 import HMM as _HMM 6 7 8# Shift localization indices to adjust for time (i.e. in smoothing) 9def loc_shift(ii, dt): 10 shift = int(np.round(6.0 * dt)) # Taken from Fig 4 of bocquet2016localization 11 # NB: don't use builtin round; it returns integers -- except for round(0.0) !!! 12 ii_new = ii + shift 13 ii_new = np.remainder(ii_new, HMM.Nx) # periodicity 14 assert HMM.Nx == HMM.Obs.M, "This func assumes the obs operator is identity." 15 return ii_new 16 17 18HMM = _HMM.copy() 19HMM.Obs.loc_shift = loc_shift 20 21 22#################### 23# Suggested tuning 24#################### 25# Reproduce data point dt=0.4 from figure 5 # rmse.a: 26# HMM.tseq.dko = 8 27# xps += iEnKS('-N' , N=20) # 0.40 28# xps += iLEnKS('Sqrt',N=10,loc_rad=12/1.82,infl=1.07) # 0.42 29# xps += iLEnKS('-N' , N=10,loc_rad=12/1.82) # 0.45 30 31# Reproduce data point L=10 from figure 6.a 32# xps += iLEnKS('Sqrt' ,infl=1.02, N=10,nIter=4,Lag=10,loc_rad=12/1.82) # 0.17 33# xps += iLEnKS('-N' , N=10,nIter=4,Lag=10,loc_rad=12/1.82) # 0.18
def
loc_shift(ii, dt):
10def loc_shift(ii, dt): 11 shift = int(np.round(6.0 * dt)) # Taken from Fig 4 of bocquet2016localization 12 # NB: don't use builtin round; it returns integers -- except for round(0.0) !!! 13 ii_new = ii + shift 14 ii_new = np.remainder(ii_new, HMM.Nx) # periodicity 15 assert HMM.Nx == HMM.Obs.M, "This func assumes the obs operator is identity." 16 return ii_new
HMM =
HiddenMarkovModel({
'Dyn':
Operator({
'M': 40,
'model': <function step>,
'noise':
GaussRV({
'mu': array([0., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0.]),
'M': 40,
'C': 0
}),
'linear': <function dstep_dx>
}),
'Obs':
<TimeDependentOperator> CONSTANT operator sepcified by .Op1:
Operator({
'M': 40,
'model':
Direct obs. at [ 0 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]
<function partial_Id_Obs.<locals>.model>,
'noise':
GaussRV({
'C': <CovMat>
M: 40
kind: 'diag'
trunc: 1.0
rk: 40
full: (only computing/printing corners)
[[1. 0. 0. ... 0. 0. 0.]
[0. 1. 0. ... 0. 0. 0.]
[0. 0. 1. ... 0. 0. 0.]
...
[0. 0. 0. ... 1. 0. 0.]
[0. 0. 0. ... 0. 1. 0.]
[0. 0. 0. ... 0. 0. 1.]]
diag:
[1. 1. 1. ... 1. 1. 1.],
'mu': array([0., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0.]),
'M': 40
}),
'linear':
Constant matrix
[[1. 0. 0. ... 0. 0. 0.]
[0. 1. 0. ... 0. 0. 0.]
[0. 0. 1. ... 0. 0. 0.]
...
[0. 0. 0. ... 1. 0. 0.]
[0. 0. 0. ... 0. 1. 0.]
[0. 0. 0. ... 0. 0. 1.]]
<function partial_Id_Obs.<locals>.linear>,
'localizer':
<function
localization_setup.<locals>.localization_now at
0x7fa23ff61ab0>
}),
'tseq':
<Chronology>
- K: 1001
- Ko: 1000
- T: 50.050000000000004
- BurnIn: 20
- dto: 0.05
- dt: 0.05,
'X0':
GaussRV({
'C': <CovMat>
M: 40
kind: 'diag'
trunc: 1.0
rk: 40
full: (only computing/printing corners)
[[0.001 0. 0. ... 0. 0. 0. ]
[0. 0.001 0. ... 0. 0. 0. ]
[0. 0. 0.001 ... 0. 0. 0. ]
...
[0. 0. 0. ... 0.001 0. 0. ]
[0. 0. 0. ... 0. 0.001 0. ]
[0. 0. 0. ... 0. 0. 0.001]]
diag:
[0.001 0.001 0.001 ... 0.001 0.001 0.001],
'mu': array([1., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 0., 0., 0.]),
'M': 40
}),
'liveplotters':
[(1, <function spatial1d.<locals>.init at
0x7fa23ff62560>), (1, <class
'dapper.tools.liveplotting.correlations'>), (0, <class
'dapper.tools.liveplotting.spectral_errors'>), (0,
<function phase_particles.<locals>.init at
0x7fa23ff625f0>), (0, <function
sliding_marginals.<locals>.init>)],
'sectors': {},
'name': 'Lorenz96/sakov2008.py'
})