Ejemplo n.º 1
0
"""Uses `nU`, `J`, `F` as in `dapper.mods.LorenzUV` ie. from `bib.wilks2005effects`.

Obs settings taken from different places (=> quasi-linear regime).
"""

import numpy as np

import dapper.mods as modelling
from dapper.mods.LorenzUV import model_instance

from ..utils import rel2mods

LUV = model_instance()
nU = LUV.nU

# Wilks2005 uses dt=1e-4 with RK4 for the full model,
# and dt=5e-3 with RK2 for the forecast/truncated model.
# As berry2014linear notes, this is possible coz
# "numerical stiffness disappears when fast processes are removed".

################
# Full
################

# tseq = modelling.Chronology(dt=0.001,dto=0.05,T=4**3,BurnIn=6) # allows using rk2
tseq = modelling.Chronology(dt=0.005, dto=0.05, T=4**3,
                            BurnIn=6)  # requires rk4

Dyn = {
    'M': LUV.M,
    'model': modelling.with_rk4(LUV.dxdt, autonom=True),
Ejemplo n.º 2
0
def test_LUV():
    from dapper.mods.LorenzUV import model_instance
    LUV = model_instance(nU=10, J=4, F=10)
    assert _allclose(LUV.dxdt, LUV.d2x_dtdx, LUV.x0)
Ejemplo n.º 3
0
"""As in `bib.lorenz1996predictability`."""

import numpy as np

import dapper.mods as modelling
from dapper.mods.LorenzUV import model_instance

from ..utils import rel2mods

LUV = model_instance(nU=36, J=10, F=10)
nU = LUV.nU

################
# Full
################

t = modelling.Chronology(dt=0.005, dtObs=0.05, T=4**3, BurnIn=6)

Dyn = {
    'M': LUV.M,
    'model': modelling.with_rk4(LUV.dxdt, autonom=True),
    'noise': 0,
    'linear': LUV.dstep_dx,
}

X0 = modelling.GaussRV(mu=LUV.x0, C=0.01)

R = 1.0
jj = np.arange(nU)
Obs = modelling.partial_Id_Obs(LUV.M, jj)
Obs['noise'] = R
Ejemplo n.º 4
0
def test_VL20():
    from dapper.mods.VL20 import model_instance
    VL20 = model_instance(nX=18, F=10, G=10)
    assert _allclose(VL20.dxdt, VL20.d2x_dtdx, VL20.x0)