Beispiel #1
0
def plotRow(row):
    p = main.text2wod(row['raw'][1:-1])
    fig = plt.figure()
    ax1 = fig.add_subplot(111)
    im = ax1.scatter(p.z(),p.t(), c=row['leveltruth'][0], norm=matplotlib.colors.Normalize(vmin=1, vmax=10), cmap='tab10')
    fig.colorbar(im, ax=ax1)
    plt.xlabel('Depth [m]')
    plt.ylabel('Temperature [C]')
    plt.title(str(p.uid()))
    range = plt.ylim()
    plt.ylim(max(-10, range[0]), min(40, range[1]))
    range = plt.ylim()
    dom = plt.xlim()
    plt.xlim(max(-10, dom[0]), min(10000, dom[1]))
    dom = plt.xlim()
    xmargin = (dom[1] - dom[0])*0.7 + dom[0]
    yspace = (range[1] - range[0])*0.05
    ymargin = (range[1] - range[0])*0.95 + range[0]
    plt.text(xmargin,ymargin - 2*yspace, 'Lat: ' + str(p.latitude()))
    plt.text(xmargin,ymargin - 3*yspace, 'Long: ' + str(p.longitude()))
    plt.text(xmargin,ymargin - 4*yspace, 'Probe: ' + str(p.probe_type()))
    plt.text(xmargin,ymargin - 5*yspace, 'Date: ' + str(p.year()) + '/' + str(p.month()) + '/' + str(p.day())    )
    plt.text(xmargin,ymargin - 6*yspace, 'Originator: ' + str(p.originator_flag_type()))
    if row['Truth'] and row['roc']:
        dir = figdir+'/TP/'
    elif row['Truth'] and not row['roc']:
        dir = figdir+'/FN/'
    elif not row['Truth'] and not row['roc']:
        dir = figdir+'/TN/'
    elif not row['Truth'] and row['roc']:
        dir = figdir+'/FP/'
    pylab.savefig(dir + str(p.uid()) + '.png', bbox_inches='tight')
    plt.close()
Beispiel #2
0
def plotRow(row):
    p = main.text2wod(row['raw'][1:-1])
    fig = plt.figure()
    ax1 = fig.add_subplot(111)
    im = ax1.scatter(p.z(),p.t(), c=row['leveltruth'][0], norm=matplotlib.colors.Normalize(vmin=1, vmax=10), cmap='tab10')
    fig.colorbar(im, ax=ax1)
    plt.xlabel('Depth [m]')
    plt.ylabel('Temperature [C]')
    plt.title(str(p.uid()))
    range = plt.ylim()
    plt.ylim(max(-10, range[0]), min(40, range[1]))
    range = plt.ylim()
    dom = plt.xlim()
    plt.xlim(max(-10, dom[0]), min(10000, dom[1]))
    dom = plt.xlim()
    xmargin = (dom[1] - dom[0])*0.7 + dom[0]
    yspace = (range[1] - range[0])*0.05
    ymargin = (range[1] - range[0])*0.95 + range[0]
    plt.text(xmargin,ymargin - 2*yspace, 'Lat: ' + str(p.latitude()))
    plt.text(xmargin,ymargin - 3*yspace, 'Long: ' + str(p.longitude()))
    plt.text(xmargin,ymargin - 4*yspace, 'Probe: ' + str(p.probe_type()))
    plt.text(xmargin,ymargin - 5*yspace, 'Date: ' + str(p.year()) + '/' + str(p.month()) + '/' + str(p.day())    )
    plt.text(xmargin,ymargin - 6*yspace, 'Originator: ' + str(p.originator_flag_type()))
    if row['Truth'] and row['roc']:
        dir = figdir+'/TP/'
    elif row['Truth'] and not row['roc']:
        dir = figdir+'/FN/'
    elif not row['Truth'] and not row['roc']:
        dir = figdir+'/TN/'
    elif not row['Truth'] and row['roc']:
        dir = figdir+'/FP/'
    pylab.savefig(dir + str(p.uid()) + '.png', bbox_inches='tight')
    plt.close()
Beispiel #3
0
def plotPathology(row, figdir):
    '''
    look for a transition from all good to all bad, and plot that region
    just do plotRow if no such transition is found. 
    '''

    p = main.text2wod(row['raw'][1:-1])

    def cat(flag):
        if flag == 3 or flag == 4:
            return True
        else:
            return False

    category = [cat(x) for x in row['leveltruth'][0]]
    total = sum(category)
    if sum(category[len(category) - total:]) != total:
        plotRow(row, figdir)
        return 0

    z_transition = p.z()[len(category) - total]
    t_transition = p.t()[len(category) - total]

    fig = plt.figure()
    ax1 = fig.add_subplot(111)
    im = ax1.scatter(p.z(),
                     p.t(),
                     c=row['leveltruth'][0],
                     norm=matplotlib.colors.Normalize(vmin=1, vmax=10),
                     cmap='tab10')
    fig.colorbar(im, ax=ax1)
    plt.xlabel('Depth [m]')
    plt.ylabel('Temperature [C]')
    plt.title(str(p.uid()))
    range = plt.ylim()
    plt.ylim(t_transition - 1, t_transition + 1)
    range = plt.ylim()
    dom = plt.xlim()
    plt.xlim(z_transition - 20, z_transition + 20)
    dom = plt.xlim()
    xmargin = (dom[1] - dom[0]) * 0.7 + dom[0]
    yspace = (range[1] - range[0]) * 0.05
    ymargin = (range[1] - range[0]) * 0.95 + range[0]
    plt.text(xmargin, ymargin - 2 * yspace, 'Lat: ' + str(p.latitude()))
    plt.text(xmargin, ymargin - 3 * yspace, 'Long: ' + str(p.longitude()))
    plt.text(xmargin, ymargin - 4 * yspace, 'Probe: ' + str(p.probe_type()))
    plt.text(
        xmargin, ymargin - 5 * yspace,
        'Date: ' + str(p.year()) + '/' + str(p.month()) + '/' + str(p.day()))
    plt.text(xmargin, ymargin - 6 * yspace,
             'Originator: ' + str(p.originator_flag_type()))
    plt.text(xmargin, ymargin - 7 * yspace,
             'Instrument: ' + str(probe_detail(p)))
    pylab.savefig(figdir + '/' + str(p.uid()) + '.png', bbox_inches='tight')
    plt.close()
Beispiel #4
0
def plotRow(row, figdir):
    '''
    generate a plot of the profile in QC table <row>
    <row> must include the raw profile text and the per-level truth
    fig saved as figdir/uid.png
    row should have 'raw' and 'leveltuth' cols
    '''

    p = main.text2wod(row['raw'][1:-1])
    fig = plt.figure()
    ax1 = fig.add_subplot(111)
    im = ax1.scatter(p.z(),
                     p.t(),
                     c=row['leveltruth'][0],
                     norm=matplotlib.colors.Normalize(vmin=1, vmax=10),
                     cmap='tab10')
    fig.colorbar(im, ax=ax1)
    plt.xlabel('Depth [m]')
    plt.ylabel('Temperature [C]')
    plt.title(str(p.uid()))
    range = plt.ylim()
    plt.ylim(max(-10, range[0]), min(40, range[1]))
    range = plt.ylim()
    dom = plt.xlim()
    plt.xlim(max(-10, dom[0]), min(10000, dom[1]))
    dom = plt.xlim()
    xmargin = (dom[1] - dom[0]) * 0.7 + dom[0]
    yspace = (range[1] - range[0]) * 0.05
    ymargin = (range[1] - range[0]) * 0.95 + range[0]
    plt.text(xmargin, ymargin - 2 * yspace, 'Lat: ' + str(p.latitude()))
    plt.text(xmargin, ymargin - 3 * yspace, 'Long: ' + str(p.longitude()))
    plt.text(xmargin, ymargin - 4 * yspace, 'Probe: ' + str(p.probe_type()))
    plt.text(
        xmargin, ymargin - 5 * yspace,
        'Date: ' + str(p.year()) + '/' + str(p.month()) + '/' + str(p.day()))
    plt.text(xmargin, ymargin - 6 * yspace,
             'Originator: ' + str(p.originator_flag_type()))
    plt.text(xmargin, ymargin - 7 * yspace,
             'Instrument: ' + str(probe_detail(p)))
    pylab.savefig(figdir + '/' + str(p.uid()) + '.png', bbox_inches='tight')
    plt.close()
Beispiel #5
0
def aircraft_raw(raw):
    trk = main.text2wod(raw)
    return isAircraft(trk)
Beispiel #6
0
def assess_usability_raw(raw):
    p = main.text2wod(raw)
    return assess_usability(p)
Beispiel #7
0
def aircraft_raw(raw):
    trk = main.text2wod(raw)
    return isAircraft(trk)
Beispiel #8
0
def assess_usability_raw(raw):
    p = main.text2wod(raw)
    return assess_usability(p)