Esempio n. 1
0
def L96_table():
    import dapper.mods.Lorenz96 as model
    from dapper.mods.Lorenz96.sakov2008 import HMM as _HMM

    model.Force = 8.0  # undo pinheiro2019
    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.02)
    xps += da.ExtKF(infl=6)
    xps += da.EnKF("PertObs", N=40, infl=1.06)
    xps += da.EnKF("Sqrt", N=28, infl=1.02, rot=True)

    xps += da.EnKF_N(N=24, rot=True)
    xps += da.EnKF_N(N=24, rot=True, xN=2)
    xps += da.iEnKS("Sqrt", N=40, infl=1.01, rot=True)

    xps += da.LETKF(N=7, rot=True, infl=1.04, loc_rad=4)
    xps += da.SL_EAKF(N=7, rot=True, infl=1.07, loc_rad=6)

    xps.launch(HMM, store_u=True)

    table = xps.tabulate_avrgs(statkeys, decimals=4)
    return table.splitlines(True)
Esempio n. 2
0
def L96_gen():
    import dapper.mods.Lorenz96 as model
    from dapper.mods.Lorenz96.sakov2008 import HMM as _HMM

    model.Force = 8.0  # undo pinheiro2019
    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.02)
    xps += da.ExtKF(infl=6)
    xps += da.EnKF("PertObs", N=40, infl=1.06)
    xps += da.EnKF("Sqrt", N=28, infl=1.02, rot=True)

    xps += da.EnKF_N(N=24, rot=True)
    xps += da.EnKF_N(N=24, rot=True, xN=2)
    xps += da.iEnKS("Sqrt", N=40, infl=1.01, rot=True)

    xps += da.LETKF(N=7, rot=True, infl=1.04, loc_rad=4)
    xps += da.SL_EAKF(N=7, rot=True, infl=1.07, loc_rad=6)

    for xp in xps:
        xp.seed = 3000

    xps.launch(HMM, store_u=True)
    return xps
Esempio n. 3
0
def test_L96():
    xps = dpr.xpList()

    from dapper.mods.Lorenz96.sakov2008 import HMM as _HMM
    xps += da.EnKF('PertObs', N=40, infl=1.06)
    xps += da.EnKF('Serial', N=28, infl=1.02, rot=True)
    xps += da.OptInterp()
    xps += da.Var3D(xB=0.02)
    xps += da.ExtKF(infl=10)
    xps += da.LETKF(N=6, rot=True, infl=1.05, loc_rad=4, taper='Step')

    # from dapper.mods.Lorenz96.bocquet2015loc import HMM
    # xps += da.EnKF_N(  N=24, rot=True ,infl=1.01)
    # xps += da.PartFilt(N=3000,NER=0.20,reg=1.2)
    # xps += da.PFxN(    N=1000,xN=100, NER=0.9,Qs=0.6)

    HMM = _HMM.copy()
    # HMM.t.BurnIn = 10*HMM.t.dtObs
    # HMM.t.KObs = 30
    HMM.t.BurnIn = HMM.t.dtObs
    HMM.t.KObs = 2

    xps.launch(HMM,
               free=False,
               liveplots="all",
               store_u=False,
               fail_gently=False,
               save_as=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. 4
0
def test_L96():
    xps = dpr.xpList()

    from dapper.mods.Lorenz96.sakov2008 import HMM as _HMM

    xps += da.EnKF("PertObs", N=40, infl=1.06)
    xps += da.EnKF("Serial", N=28, infl=1.02, rot=True)
    xps += da.OptInterp()
    xps += da.Var3D(xB=0.02)
    xps += da.ExtKF(infl=10)
    xps += da.LETKF(N=6, rot=True, infl=1.05, loc_rad=4, taper="Step")

    # from dapper.mods.Lorenz96.bocquet2015loc import HMM
    # xps += da.EnKF_N(  N=24, rot=True ,infl=1.01)
    # xps += da.PartFilt(N=3000,NER=0.20,reg=1.2)
    # xps += da.PFxN(    N=1000,xN=100, NER=0.9,Qs=0.6)

    HMM = _HMM.copy()
    # HMM.tseq.BurnIn = 10*HMM.tseq.dto
    # HMM.tseq.Ko = 30
    HMM.tseq.BurnIn = HMM.tseq.dto
    HMM.tseq.Ko = 2

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

    # 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