コード例 #1
0
def get_fc_diag_loop(data_fc, fc_veri, diag):
    diag_dict={}
    for veri in fc_veri:
        diag_dict[veri]={}
        for start_date in fc_veri[veri]:
            diag_dict[veri][start_date]={}
            for model in data_fc[start_date]:
                print 'Getting '+diag+' for '+model
                diag_dict[veri][start_date][model]=get_fc_diag(data_fc[start_date][model]['data'],fc_veri[veri][start_date][model],diag)
                
    return diag_dict           
コード例 #2
0
     if 'rmss' in args.diags_cont and 'rmse' in args.diags_cont:
         args.diags_cont.insert(0, args.diags_cont.pop(args.diags_cont.index('rmss')))
 
     diags_cont={}
     for diag in args.diags_cont:
         scores=get_fc_diag_loop(data_fc, fc_veri, get_score_name(diag))
         
         #Convert to skill scores where appropriate
         diags_cont[diag]={}
         for veri in args.veri:
             diags_cont[diag][veri]={}
             for start_date in start_dates:
                 diags_cont[diag][veri][start_date]={}
                 for model in model_list:
                     if diag!=get_score_name(diag):  #true only if a skill score can be sensibly computed
                         score_perf=get_fc_diag(fc_veri[veri][start_date][model], fc_veri[veri][start_date][model], get_score_name(diag))  #perfect skill score
                         diags_cont[diag][veri][start_date][model]=get_skill_score(scores[veri][start_date][model],scores[veri][start_date]['clim_'+veri][:len(scores[veri][start_date][model])],score_perf)
         
                     else:
                         diags_cont[diag][veri][start_date][model]=scores[veri][start_date][model]
 
         #Plotting diagnostic as a function of lead time
         if not (diag=='rmss' and 'rmse' in args.diags_cont):  #don't plot rmss separately from rmse.
             for veri in diags_cont[diag]:
                 for start_date in diags_cont[diag][veri]:
                     fig,ax=plt.subplots(1)
                     plt_count=0
                     for model in model_list:  #to get lines plotted in order, with multi-model combinations put first in the legend
 
                         if not ((diag=='acc' or (diag!=get_score_name(diag))) and fnmatch.fnmatch(model,'clim*')):  #don't plot anomaly correlation or skill scores for climatology, as these are just zero 
                             xpts=1+np.arange(diags_cont[diag][veri][start_date][model].shape[0])