Esempio n. 1
0
def L63_gen():
    from dapper.mods.Lorenz63.sakov2012 import HMM as _HMM

    HMM = _HMM.copy()
    HMM.t.BurnIn = 0
    HMM.t.KObs = 10

    dpr.set_seed(3000)

    # xps
    xps = dpr.xpList()
    xps += da.Climatology()
    xps += da.OptInterp()
    xps += da.Var3D(xB=0.1)
    xps += da.ExtKF(infl=90)
    xps += da.EnKF("Sqrt", N=3, infl=1.30)
    xps += da.EnKF("Sqrt", N=10, infl=1.02, rot=True)
    xps += da.EnKF("PertObs", N=500, infl=0.95, rot=False)
    xps += da.EnKF_N(N=10, rot=True)
    xps += da.iEnKS("Sqrt", N=10, infl=1.02, rot=True)
    xps += da.PartFilt(N=100, reg=2.4, NER=0.3)
    xps += da.PartFilt(N=800, reg=0.9, NER=0.2)
    xps += da.PartFilt(N=4000, reg=0.7, NER=0.05)
    xps += da.PFxN(xN=1000, N=30, Qs=2, NER=0.2)

    # Run
    xps.launch(HMM, False, store_u=True)
    return xps
Esempio n. 2
0
def L63_gen():
    from dapper.mods.Lorenz63.sakov2012 import HMM as _HMM

    HMM = _HMM.copy()
    HMM.tseq.BurnIn = 0
    HMM.tseq.Ko = 10

    # xps
    xps = dpr.xpList()
    xps += da.Climatology()
    xps += da.OptInterp()
    xps += da.Persistence()
    xps += da.PreProg(lambda k, xx, yy: xx[k])
    xps += da.Var3D(xB=0.1)
    xps += da.ExtKF(infl=90)
    xps += da.EnKF("Sqrt", N=3, infl=1.30)
    xps += da.EnKF("Sqrt", N=10, infl=1.02, rot=True)
    xps += da.EnKF("PertObs", N=500, infl=0.95, rot=False)
    xps += da.EnKF_N(N=10, rot=True)
    xps += da.iEnKS("Sqrt", N=10, infl=1.02, rot=True)
    xps += da.PartFilt(N=100, reg=2.4, NER=0.3)
    xps += da.PartFilt(N=800, reg=0.9, NER=0.2)
    xps += da.PartFilt(N=4000, reg=0.7, NER=0.05)
    xps += da.PFxN(xN=1000, N=30, Qs=2, NER=0.2)

    xps += da.OptPF(N=100, Qs=2, reg=0.7, NER=0.3)
    xps += da.EnKS("Serial", N=30, Lag=1)
    xps += da.EnRTS("Serial", N=30, DeCorr=0.99)

    for xp in xps:
        xp.seed = 3000

    # Run
    xps.launch(HMM, False, store_u=True)
    return xps
Esempio n. 3
0
def test_L63():
    from dapper.mods.Lorenz63.sakov2012 import HMM as _HMM

    xps = dpr.xpList()
    xps += da.EnKF("Sqrt", N=10, infl=1.02, rot=True)
    xps += da.PartFilt(N=20, reg=2.4, NER=0.3)
    xps += da.OptInterp()
    # xps += da.iEnKS('Sqrt',  N=10,  infl=1.02,rot=True)

    HMM = _HMM.copy()
    HMM.tseq.BurnIn = HMM.tseq.dto
    HMM.tseq.Ko = 1

    xps.launch(
        HMM,
        free=False,
        statkeys=True,
        liveplots=None,
        store_u=False,
        fail_gently=False,
        save_as=False,
    )
    print(xps.tabulate_avrgs(["rmse.a"]))

    # Disabled coz magic doesn't work any more on python 3.7
    # spell_out(HMM)
    # spell_out(xps[-1])
    # spell_out(xps[-1].stats)
    # spell_out(xps[-1].avrgs)

    assert True  # An assertion for pytest to count
    return HMM, xps  # Return useful stuff
Esempio n. 4
0
def test_L63():
    from dapper.mods.Lorenz63.sakov2012 import HMM as _HMM

    xps = dpr.xpList()
    xps += da.EnKF('Sqrt', N=10, infl=1.02, rot=True)
    xps += da.PartFilt(N=20, reg=2.4, NER=0.3)
    xps += da.OptInterp()
    # xps += da.iEnKS('Sqrt',  N=10,  infl=1.02,rot=True)

    HMM = _HMM.copy()
    HMM.t.BurnIn = HMM.t.dtObs
    HMM.t.KObs = 1

    xps.launch(HMM,
               free=False,
               liveplots="all",
               store_u=False,
               fail_gently=False)

    for xp in xps:
        xp.stats.replay("all")

    xp.stats.replay(t2=1)
    xp.stats.replay(t2=0.0)
    xp.stats.replay(t2=0.3)
    xp.stats.replay(t2=0.8)
    xp.stats.replay(t2=0.8, t1=0.2)
    xp.stats.replay(t2=np.inf)
    xp.stats.replay(t2=np.inf, speed=1)
    xp.stats.replay(t2=np.inf, pause_a=0, pause_f=0)

    assert True  # An assertion for pytest to count
    return HMM, xps  # Return useful stuff
Esempio n. 5
0
# #### DA method configurations

xps = dpr.xpList()

from dapper.mods.Lorenz63.sakov2012 import HMM  # Expected rmse.a:

xps += da.Climatology()  # 7.6
xps += da.OptInterp()  # 1.25
xps += da.Var3D(xB=0.1)  # 1.03
xps += da.ExtKF(infl=90)  # 0.87
xps += da.EnKF('Sqrt', N=3, infl=1.30)  # 0.82
xps += da.EnKF('Sqrt', N=10, infl=1.02, rot=True)  # 0.63
xps += da.EnKF('PertObs', N=500, infl=0.95, rot=False)  # 0.56
xps += da.EnKF_N(N=10, rot=True)  # 0.54
xps += da.iEnKS('Sqrt', N=10, infl=1.02, rot=True)  # 0.31
xps += da.PartFilt(N=100, reg=2.4, NER=0.3)  # 0.38
xps += da.PartFilt(N=800, reg=0.9, NER=0.2)  # 0.28
# xps += da.PartFilt(       N=4000, reg=0.7  , NER=0.05)       # 0.27
# xps += da.PFxN(xN=1000,   N=30  , Qs=2     , NER=0.2)        # 0.56

# #### With Lorenz-96 instead

# +
# from dapper.mods.Lorenz96.sakov2008 import HMM   # Expected rmse.a:
# xps += da.Climatology()                                     # 3.6
# xps += da.OptInterp()                                       # 0.95
# xps += da.Var3D(xB=0.02)                                    # 0.41
# xps += da.ExtKF(infl=6)                                     # 0.24
# xps += da.EnKF('PertObs', N=40, infl=1.06)                  # 0.22
# xps += da.EnKF('Sqrt',    N=28, infl=1.02, rot=True)        # 0.18
#