コード例 #1
0
def get_event_fc_loop(data_fc, events):

    event_fc={}
    for event in events:
        event_fc[event]={}

        event_pm=event[0]
        event_thres=convert_fracstr_to_flt(event[1:])
        
        for start_date in start_dates:
            event_fc[event][start_date]={}
            
            for model in data_fc[start_date]:
                event_fc[event][start_date][model]=get_event_fc_rel(np.rollaxis(np.rollaxis(data_fc[start_date][model]['data'],2),2),event_pm,event_thres)  #rollaxis commands to get ens_member and start_year dimensions at the front
                event_fc[event][start_date][model]=np.rollaxis(event_fc[event][start_date][model],2)

    return event_fc
コード例 #2
0
     
 #Find whether an event occurred in observations on each forecast date
 if args.events:
     event_fc_veri={}
     for event in args.events:
         event_fc_veri[event]={}
 
         event_pm=event[0]
         event_thres=convert_fracstr_to_flt(event[1:])
         
         for veri in args.veri:
             event_fc_veri[event][veri]={}
             for start_date in start_dates:
                 event_fc_veri[event][veri][start_date]={}
                 for model in data_fc[start_date]:
                     event_fc_veri[event][veri][start_date][model]=get_event_fc_rel(fc_veri[veri][start_date][model].T[np.newaxis,...], event_pm,event_thres).T[...,0] #transpose fc_veri arrays and add axis at the front in the function call so their first two dimensions correspond to the ensemble members and different start dates, as expected by get_event_fc_rel()
                     
 
 #Plotting diagnostics as a function of lead time
 
 #Assign linecolour and style to each model
 linecolors=['k','b','g','r','c','m','y','brown','gray']
 ncols=len(linecolors)
 linestyles=['-', ':','-.']  #linestyles to cycle through for each set of colours - don't use '--' as I use this for plotting model RMSS below.
 model_lines={}
 model_no=0
 for model in model_list:
     model_lines[model]={}
     model_lines[model]['color']=linecolors[model_no % ncols]
     model_lines[model]['style']=linestyles[model_no/ncols]
     model_no+=1