def data(): from dapper.mods.LA.small import HMM as _HMM HMM = _HMM.copy() HMM.t.BurnIn = 0 HMM.t.KObs = 10 xps = dpr.xpList(unique=True) # yapf: disable xps += da.EnKF('Sqrt' , N=20) xps += da.EnKF('PertObs', N=20) xps += da.EnKF('DEnKF' , N=20) for Lag in [0, 1, 3]: xps += da.EnKS('Sqrt' , N=20, Lag=Lag) xps += da.EnKS('PertObs', N=20, Lag=Lag) xps += da.EnKS('DEnKF' , N=20, Lag=Lag) for nIter in [1, 4]: for MDA in [False, True]: xps += da.iEnKS('Sqrt' , N=20, Lag=Lag, nIter=nIter, MDA=MDA) xps += da.iEnKS('PertObs', N=20, Lag=Lag, nIter=nIter, MDA=MDA) xps += da.iEnKS('Order1' , N=20, Lag=Lag, nIter=nIter, MDA=MDA) # yapf: enable for xp in xps: xp.seed = 3000 xps.launch(HMM, store_u=True, save_as=False) print(xps.tabulate_avrgs(["rmse.a", "rmse.f", "rmse.u", "rmse.s"])) return xps
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)
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
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
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
return xx, yy # Note: An alternative approach might be to simply # write our own `simulate()` which merely sets the `Force` parameter, # rather than sampling it. # #### DA methods configurations xps = dpr.xpList() # xps += da.PartFilt(N=1000, reg=1) # works OK with Nx=6 for N in [20, 50]: # xps += da.EnKF('Sqrt', N, infl=1.04) xps += da.EnKF_N(N, xN=2) for Lag in [1, 4, 20]: xps += da.iEnKS("Sqrt", N, Lag=Lag, xN=2, wtol=1e-5) # TODO 4: Add 3D- and 4D-Var # #### Launch experiments scriptname = "basic_3" if nb else __file__ save_as = xps.launch( HMM, scriptname, setup=set_X0_and_simulate, mp=False, # Multiprocessing fail_gently=False, # Facilitate debugging liveplots=False, # NB: Turn off if running iEnKS free=False, # Don't delete time series (enables replay) )
# #### 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