mult_inf_range = np.arange(1.15, 1.35, 0.02)

    ntemp_range = np.arange(1, 5, 1)

    total_analysis_rmse = np.zeros((len(mult_inf_range), len(ntemp_range)))
    total_analysis_sprd = np.zeros((len(mult_inf_range), len(ntemp_range)))
    total_forecast_rmse = np.zeros((len(mult_inf_range), len(ntemp_range)))
    total_forecast_sprd = np.zeros((len(mult_inf_range), len(ntemp_range)))

    for iinf, mult_inf in enumerate(mult_inf_range):
        for intemp, ntemp in enumerate(ntemp_range):

            conf.DAConf['InfCoefs'] = np.array([mult_inf, 0.0, 0.0, 0.0, 0.0])
            conf.DAConf['NTemp'] = int(ntemp)

            results.append(ahm.assimilation_gm_run(conf))

            print('Multiplicative Inflation', mult_inf)
            print('Tempering iteraations', ntemp)
            print('Analisis RMSE: ', np.mean(results[-1]['XASRmse']))
            print('Forecast RMSE: ', np.mean(results[-1]['XFSRmse']))
            print('Analisis SPRD: ', np.mean(results[-1]['XASSprd']))
            print('Forecast SPRD: ', np.mean(results[-1]['XFSSprd']))

            total_analysis_rmse[iinf, intemp] = np.mean(results[-1]['XASRmse'])
            total_forecast_rmse[iinf, intemp] = np.mean(results[-1]['XFSRmse'])
            total_analysis_sprd[iinf, intemp] = np.mean(results[-1]['XASSprd'])
            total_forecast_sprd[iinf, intemp] = np.mean(results[-1]['XFSSprd'])

    f = open(out_filename, 'wb')
    pickle.dump([
コード例 #2
0
ファイル: test_gm_tempering.py プロジェクト: gustfrontar/DABA
    'ResamplingType'] = 2  #Resampling: 1-Liu 2016, 2-Acevedo et al. 2016, 3-NETPF without rotation, 4-NETPF with rotation.

#Introduce a model error in the model used for the assimilation experiment.
conf.DAConf[
    'Twin'] = True  #When True, model configuration will be replaced by the model configuration in the nature run.
conf.ModelConf['Coef'] = np.array(
    [8.0]
)  #Coefficient of parametrized forcing (polynom coefficients starting from coef[0]*x^0 + coef[1]*x ... )
conf.DAConf[
    'AddaptiveTemp'] = True  #Enable addaptive tempering time step in pseudo time.
conf.DAConf['NTemp'] = 1  #Number of temper iterations
conf.DAConf['InfCoefs'] = np.array([1.6, 0.0, 0.0, 0.0, 0.0])
conf.DAConf[
    'RejuvParam'] = 0.0  #Global particle rejuvenestion (For the ETPF only)

results = gmm.assimilation_gm_run(conf)

print('Multiplicative Inflation', conf.DAConf['InfCoefs'][0])
print('Tempering iteraations', conf.DAConf['NTemp'])
print('Analisis RMSE: ', np.mean(results['XASRmse']))
print('Forecast RMSE: ', np.mean(results['XFSRmse']))
print('Analisis SPRD: ', np.mean(results['XASSprd']))
print('Forecast SPRD: ', np.mean(results['XFSSprd']))

conf.DAConf['InfCoefs'] = np.array([1.06, 0.0, 0.0, 0.0, 0.0])
conf.DAConf[
    'BridgeParam'] = 0.4  #Global particle rejuvenestion (For the ETPF only)
results = hym.assimilation_hybrid_run(conf)

print('Multiplicative Inflation', conf.DAConf['InfCoefs'][0])
print('Tempering iteraations', conf.DAConf['NTemp'])