示例#1
0
    'ExpLength'] = 1000  #None use the full nature run experiment. Else use this length.
conf.DAConf['NEns'] = 20  #Number of ensemble members
conf.DAConf[
    'Twin'] = True  #When True, model configuration will be replaced by the model configuration in the nature run.
conf.DAConf['Freq'] = 8  #Assimilation frequency (in number of time steps)
conf.DAConf[
    'TSFreq'] = 8  #Intra window ensemble output frequency (for 4D Data assimilation)
conf.DAConf['LocScalesLETKF'] = np.array([
    3.0, -1.0
])  #Localization scale is space and time (negative means no localization)
conf.DAConf['LocScalesLETPF'] = np.array([
    3.0, -1.0
])  #Localization scale is space and time (negative means no localization)
conf.DAConf[
    'BridgeParam'] = 0.0  #Bridging parameter for the hybrid 0-pure LETKF, 1.0-pure ETPF

conf.DAConf[
    'AddaptiveTemp'] = False  #Enable addaptive tempering time step in pseudo time.
conf.DAConf[
    'EnableTempering'] = False  #Enable tempered iterations. If False, then traditional RIP method is applied without using tempering.

conf.DAConf['InfCoefs'] = np.array([1.07, 0.0, 0.0, 0.0, 0.0])
conf.DAConf['NRip'] = 2

results = ahm.assimilation_hybrid_run(conf)

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']))
 add_inf_range = np.arange(0.001,0.01,0.001)
 
 nrip_range = np.arange(1,5,1)
 
 total_analysis_rmse = np.zeros( (len(add_inf_range),len(nrip_range)) )
 total_analysis_sprd = np.zeros( (len(add_inf_range),len(nrip_range)) )
 total_forecast_rmse = np.zeros( (len(add_inf_range),len(nrip_range)) )
 total_forecast_sprd = np.zeros( (len(add_inf_range),len(nrip_range)) )
 
 for iinf , add_inf in enumerate( add_inf_range ) :
     for inrip , nrip in enumerate( nrip_range )  :
         
         conf.DAConf['InfCoefs']=np.array([1.0,0.0,0.0,0.0,add_inf])
         conf.DAConf['NRip']=int(nrip) 
         
         results.append( ahm.assimilation_hybrid_run( conf ) )
              
         print('Additive Inflation',add_inf)
         print('Rip iteraations',nrip)
         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,inrip] = np.mean(results[-1]['XASRmse'])
         total_forecast_rmse[iinf,inrip] = np.mean(results[-1]['XFSRmse'])
         total_analysis_sprd[iinf,inrip] = np.mean(results[-1]['XASSprd'])
         total_forecast_sprd[iinf,inrip] = np.mean(results[-1]['XFSSprd'])
         
 f=open(out_filename,'wb')
 pickle.dump([results,add_inf_range,nrip_range,total_analysis_rmse,total_forecast_rmse,total_analysis_sprd,total_forecast_sprd],f)
示例#3
0
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'] = False  #Enable addaptive tempering time step in pseudo time.
conf.DAConf['NTemp'] = 1  #Number of temper iterations
conf.DAConf['InfCoefs'] = np.array([1.2, 0.0, 0.0, 0.0, 0.0])
conf.DAConf[
    'RejuvParam'] = 0.0  #Global particle rejuvenestion (For the ETPF only)
conf.DAConf['BridgeParam'] = 0.0
conf.DAConf['NRip'] = 2
conf.DAConf['EnableTempering'] = True

results = hymrip.assimilation_hybrid_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.2,0.0,0.0,0.0,0.0])
# conf.DAConf['BridgeParam']=0.2
# results =  hym.assimilation_hybrid_run( conf )

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