コード例 #1
0
ファイル: profiles.py プロジェクト: j08lue/seabirdpy
def plot_profiles(fnames):

    fnames = ctdtools.sort_fnames(fnames)

    fig = plt.figure()
    ax = fig.gca()
    ax2 = ax.twiny()

    for fname in fnames:

        casttimestr = ctdtools.get_date(fname).strftime('UTC %Y-%m-%d %H:%M')

        data = ctdtools.get_data(fname) 
        data = ctdtools.remove_invalid(data)
        data = ctdtools.remove_cast(data,'up')

        ls = ctdtools.lscycle.next()
        ax.plot(data['temp'],-data['pressure'],'b',ls=ls,label=casttimestr)
        ax2.plot(data['sal'],-data['pressure'],'r',ls=ls)

    ax.set_xlabel('Temperature (degC)',color='b')
    ax2.set_xlabel('Salinity (PSU)',color='r')
    ax.set_ylabel('Pressure (dbar)')
    ax2.grid(False)

    ctdtools.set_n_linear_ticks(ax ,axis='x')
    ctdtools.set_n_linear_ticks(ax2,axis='x')

    ax.legend(loc=0)

    plt.show()

    return data
コード例 #2
0
ファイル: timeseries.py プロジェクト: j08lue/seabirdpy
def plot_timeseries(fnames):
    
    fnames = ctdtools.sort_fnames(fnames)

    fig = plt.figure()
    ax = fig.gca()
    ax2 = ax.twinx()

    for fname in fnames:

        starttime = ctdtools.get_date(fname)
        casttimestr = starttime.strftime('UTC %Y-%m-%d %H:%M')

        data = ctdtools.get_data(fname) 
        data = ctdtools.remove_invalid(data)
        data = ctdtools.remove_cast(data,'up')

        stationary = np.abs(data['pressure']) < data['pressure'].mean()+1e-2
        data = data[stationary]
        
        dt = ctdtools.get_dt(fname)
        time = starttime + (data['count']-1)*dt

        ls = ctdtools.lscycle.next()
        ax.plot(time,data['temp'],'b',ls=ls,label=casttimestr)
        ax2.plot(time,data['sal'],'r',ls=ls)

    fig.autofmt_xdate()

    ax.set_ylabel('Temperature (degC)',color='b')
    ax2.set_ylabel('Salinity (PSU)',color='r')
    ax.set_xlabel('Count')
    ax2.grid(False)

    ax.legend(loc=0)

    plt.show()

    return fig