Beispiel #1
0
    # Specify labels for points in a list (M1 for model prediction # 1,
    # etc.).
    label = ['M1', 'M2', 'M3']
    '''
    Produce the target diagram

    Label the points and change the axis options. Increase the upper 
    limit for the axes, change color and line style of circles. Increase
    the line width of circles. Change color of labels and points. Add a
    legend. Suppress x-axis label for uRMSD = 30 so the markers appear 
    more clearly.

    For an exhaustive list of options to customize your diagram, 
    please call the function at a Python command line:
    >> target_diagram
    '''
    sm.target_diagram(bias,crmsd,rmsd, MarkerDisplayed = 'colorBar', \
                      titleColorbar = 'RMSD', nonRMSDz = 'on', \
                      markerLabel = label, markerLabelColor = 'b', \
                      markerColor = 'b', markerLegend = 'on', \
                      ticks = np.arange(-50,60,10), axismax = 50, \
                      xtickLabelPos = [np.arange(-50,20,20), 40, 50], \
                      circles = [20, 40, 50], \
                      circleLineSpec = '-.b', circleLineWidth = 1.5)

    # Write plot to file
    plt.savefig('target5.png')

    # Show plot
    plt.show()
Beispiel #2
0
                      target_stats3['crmsd']])
    rmsd = np.array([target_stats1['rmsd'], target_stats2['rmsd'], 
                     target_stats3['rmsd']])

    # Specify labels for points in a list (M1 for model prediction # 1, 
    # etc.).
    label = ['M1', 'M2', 'M3']

    '''
    Produce the target diagram

    Label the points and change the axis options. Increase the upper 
    limit for the axes, change color and line style of circles. Increase
    the line width of circles.

    For an exhaustive list of options to customize your diagram, 
    please call the function at a Python command line:
    >> target_diagram
    '''
    sm.target_diagram(bias,crmsd,rmsd, markerLabel = label,
                      markerLabelColor = 'r',
                      ticks = np.arange(-50,60,10),
                      axismax = 50.0,
                      circleLineSpec = 'b-.', circleLineWidth = 1.5)

    # Write plot to file
    plt.savefig('target3.png')

    # Show plot
    plt.show()
    
Beispiel #3
0
    # etc.).
    label = ['M1', 'M2', 'M3']

    '''
    Produce the target diagram

    Label the points and change the axis options. Increase the upper 
    limit for the axes, change color and line style of circles. 
    Increase the line width of circles.

    For an exhaustive list of options to customize your diagram, 
    please call the function at a Python command line:
    >> target_diagram
    '''
    sm.target_diagram(bias,crmsd,rmsd, \
                      markerLabel = label, markerLabelColor = 'r', \
                      ticks = np.arange(-60,70,10), axismax = 50, \
                      circleLineSpec = '-.b', circleLineWidth = 1.5)

    # Calculate a negative uRMSD for one of the data values.
    data.pred3['data'] = -data.pred3['data']
    target_stats3 = sm.target_statistics(data.pred3,data.ref,'data')
    bias = target_stats3['bias']
    crmsd = target_stats3['crmsd']
    rmsd = target_stats3['rmsd']

    # Overlay new data point (blue) on existing diagram
    label = ['M4']
    sm.target_diagram(bias,crmsd,rmsd, \
                      overlay = 'on', \
                      markerLabel = label, markerLabelColor = 'b', \
                      markerColor = 'b')
rmsd   = np.array([target_stats1['rmsd'],  target_stats2['rmsd'],  target_stats3['rmsd'],  target_stats4['rmsd'],  target_stats5['rmsd'],  target_stats6['rmsd'],
                   target_stats7['rmsd'] , target_stats8['rmsd'],  target_stats9['rmsd'],  target_stats10['rmsd'] ] )

label1 = ['Non-Dimensional Observation', 'M1', 'M2', 'M3', 'M4', 'M5', 'M6', 'M7', 'M8', 'M9', 'M10']
label2 = ['Non-Dimensional Observation', 'M1: NNLS', 'M2: X2-I', 'M3: X2-L1', 'M4: X2-L2','M5: L-curve-I', 'M6: L-curve-L1', 'M7: L-curve-L2', 'M8: GCV-I', 'M9: GCV-L1', 'M10: GCV-L2']

sm.taylor_diagram(sdev,crmsd,ccoef, MarkerDisplayed='marker', markerLabel = label1, markerColor='red', colRMS='green', colSTD='blue', colCOR='black', alpha=0.5, markerSize=13, titleOBS = 'observation', styleOBS = '-')
plt.savefig(path + 'taylor_SNR.png', dpi=300)
plt.close('all')

sm.taylor_diagram(sdev,crmsd,ccoef, MarkerDisplayed='marker', markerLabel = label2, colRMS='green', colSTD='blue', colCOR='black', alpha=0.5, markerLegend='on', markerSize=6)
plt.savefig(path + 'taylor_SNR_legend.png', dpi=300)
plt.close('all')

sm.target_diagram(100*bias, 100*crmsd2, 100*rmsd, markerLabel = label1[1:], markerLabelColor = 'r',
                 circleLineSpec = 'b-.', circleLineWidth = 1.5, alpha=0.5, markerSize=13)

plt.savefig(path + 'target_bias_SNR.png', dpi=300)
plt.close('all')

MAE_S = np.array([
           metric_vector_nnls[11],
           metric_vector_X2_I[11],
           metric_vector_X2_L1[11],
           metric_vector_X2_L2[11],
           metric_vector_L_curve_I[11],
           metric_vector_L_curve_L1[11],
           metric_vector_L_curve_L2[11],
           metric_vector_GCV_I[11],
           metric_vector_GCV_L1[11],
           metric_vector_GCV_L2[11],
    
    # Read target statistics for ERA Interim (stats1) and TRMM (stats2) 
    # data with respect to APHRODITE observations for each of years 2001 to 
    # 2014 from pickle file
    stats = load_obj('Mekong_Basin_data') # observations

    # Specify labels for points in a dictionary because only desire labels
    # for each data set.
    label = {'ERA-5': 'r', 'TRMM': 'b'}
    
    '''
    Produce the target diagram for the first dataset
    '''
    sm.target_diagram(stats.target_stats1['bias'], 
                      stats.target_stats1['crmsd'], 
                      stats.target_stats1['rmsd'], markercolor ='r', alpha = 0.0,
                      ticks=np.arange(-2.0,2.5,0.5), 
                      circles = [0.5, 1.0, 2.0],
                      circleLineSpec = 'k--', circleLineWidth = 1.0)

    '''
    Overlay the second dataset
    '''
    sm.target_diagram(stats.target_stats2['bias'], 
                      stats.target_stats2['crmsd'], 
                      stats.target_stats2['rmsd'], markercolor ='b', alpha = 0.0,
                      overlay = 'on', markerLabel = label)

    # Write plot to file
    plt.savefig('target8.png',dpi=150,facecolor='w')

    # Show plot
Beispiel #6
0
    # Read data from pickle file
    data = load_obj('target_data')

    # Calculate statistics for target diagram
    target_stats1 = sm.target_statistics(data.pred1, data.ref, 'data')
    target_stats2 = sm.target_statistics(data.pred2, data.ref, 'data')
    target_stats3 = sm.target_statistics(data.pred3, data.ref, 'data')

    # Store statistics in arrays
    bias = np.array(
        [target_stats1['bias'], target_stats2['bias'], target_stats3['bias']])
    crmsd = np.array([
        target_stats1['crmsd'], target_stats2['crmsd'], target_stats3['crmsd']
    ])
    rmsd = np.array(
        [target_stats1['rmsd'], target_stats2['rmsd'], target_stats3['rmsd']])
    '''
    Produce the target diagram
    
    Reference circles are plotted at the maximum range of the axes and at 0.7
    times the maximum range by default.
    '''
    sm.target_diagram(bias, crmsd, rmsd)

    # Write plot to file
    plt.savefig('target1.png')

    # Show plot
    plt.show()
Beispiel #7
0
    # Store statistics in arrays
    bias = np.array([target_stats1['bias'], target_stats2['bias'], 
                     target_stats3['bias']])
    crmsd = np.array([target_stats1['crmsd'], target_stats2['crmsd'], 
                      target_stats3['crmsd']])
    rmsd = np.array([target_stats1['rmsd'], target_stats2['rmsd'], 
                     target_stats3['rmsd']])

    # Specify labels for points in a list (M1 for model prediction # 1, 
    # etc.).
    label = ['M1', 'M2', 'M3']

    '''
    Produce the target diagram
    
    Label the points and change the axis options for BIAS and CRMSD.
    
    For an exhaustive list of options to customize your diagram, 
    please call the function at a Python command line:
    >> target_diagram
    '''
    sm.target_diagram(bias,crmsd,rmsd, markerLabel = label, \
                      ticks=np.arange(-50,60,10))

    # Write plot to file
    plt.savefig('target2.png')

    # Show plot
    plt.show()
    
Beispiel #8
0
    # Specify labels for points in a list (M1 for model prediction # 1,
    # etc.).
    label = ['M1', 'M2', 'M3']
    '''
    Produce the target diagram

    Label the points and change the axis options. Increase the upper limit
    for the axes, change color and line style of circles. Increase
    the line width of circles. Change color of labels and points. Add a
    legend.

    For an exhaustive list of options to customize your diagram, 
    please call the function at a Python command line:
    >> target_diagram
    '''
    #ToDo: fix placement of legend
    sm.target_diagram(bias,crmsd,rmsd, markerLabel = label, \
                      markerLabelColor = 'b', \
                      markerColor = 'b', markerLegend = 'on', \
                      ticks = np.arange(-50,60,10), \
                      axismax = 50.0, \
                      circles = [20, 40, 50], \
                      circleLineSpec = 'b-.', circleLineWidth = 1.5)

    # Write plot to file
    plt.savefig('target4.png')

    # Show plot
    plt.show()