예제 #1
0
def plotAx():
    ax = []
    for i in np.arange(0, 6):
        ax1 = fig.add_subplot(2, 3, i + 1)
        plotter.add_bathy(ax1)
        plotter.add_coast(ax1)
        plotter.layout_surface(ax1, xLim=[-129, -123], yLim=[41, 49])

        ax1.yaxis.set_major_locator(ticker.MultipleLocator(2))
        ax1.xaxis.set_major_locator(ticker.MultipleLocator(2))
        if np.mod(i, 3) == 0:
            ax1.set_ylabel(r'Latitude')
            ax1.yaxis.set_major_formatter(ticker.StrMethodFormatter('{x:.0f}'))
        else:
            ax1.yaxis.set_major_formatter(ticker.NullFormatter())
        if i >= 3:
            ax1.set_xlabel(r'Longitude')
            ax1.xaxis.set_major_formatter(ticker.StrMethodFormatter('{x:.0f}'))
        else:
            ax1.xaxis.set_major_formatter(ticker.NullFormatter())
            ax1.set_title(titleList[i])

        t = ax1.annotate(labelList[i],
                         xycoords='axes fraction',
                         textcoords='axes fraction',
                         xy=(.06, .94),
                         xytext=(.06, .94))
        t.set_bbox(dict(facecolor='white', alpha=1, edgecolor='white'))
        ax.append(ax1)

    return ax
예제 #2
0
def plotAx():
    ax = []
    for i in np.arange(0, 4):
        ax1 = fig.add_subplot(2, 2, i + 1)
        plotter.add_bathy(ax1)
        plotter.add_coast(ax1)
        #plotter.layout_surface(ax1,xLim=[-127,-123.5],yLim=[43,47])
        plotter.layout_surface(ax1, xLim=[-129, -123], yLim=[41, 49])

        ax1.yaxis.set_major_locator(ticker.MultipleLocator(1))
        ax1.xaxis.set_major_locator(ticker.MultipleLocator(2))

        if np.mod(i, 2) == 0:
            ax1.set_ylabel(r'Latitude')
        else:
            ax1.yaxis.set_major_formatter(ticker.NullFormatter())
        if i >= 2:
            ax1.set_xlabel(r'Longitude')
        else:
            ax1.xaxis.set_major_formatter(ticker.NullFormatter())
        #t=ax1.text(-128.6,48.5,mat[i]['name'])
        #t.set_bbox(dict(facecolor='w', alpha=1, edgecolor='w'))

        ax.append(ax1)
    return ax
예제 #3
0
def plotAx():
    ax = []
    for i in np.arange(0, 2):
        ax1 = fig.add_subplot(1, 2, i + 1)
        plotter.add_bathy(ax1)
        plotter.add_coast(ax1)
        plotter.layout_surface(ax1, xLim=[-129, -123], yLim=[41, 49])
        if i == 0:
            ax1.set_ylabel(r'Latitude')
        ax1.set_xlabel(r'Longitude')
        if i > 0:
            ax1.yaxis.set_major_locator(plt.NullLocator())
        ax1.set_xticks([-128, -124])
        ax.append(ax1)
    return ax
예제 #4
0
def plotAx():
    ax=[]
    for i in np.arange(0,3):
        ax1=fig.add_subplot(1,3,i+1)
        plotter.add_bathy(ax1)
        plotter.add_coast(ax1)
        #plotter.layout_surface(ax1,xLim=[-127,-123.5],yLim=[43,47])
        plotter.layout_surface(ax1,xLim=[-129,-123],yLim=[41,49])
        if i==0:
            ax1.set_ylabel(r'Latitude')
        ax1.set_xlabel(r'Longitude')
        ax1.set_title(mat[i]['name'])
        if i>0:
            ax1.yaxis.set_major_locator(plt.NullLocator())
        ax.append(ax1)
    return ax
예제 #5
0
def plotAx():
    ax=[]
    for i in np.arange(0,1):
        ax1=fig.add_subplot(1,1,i+1)
        plotter.add_bathy(ax1)
        plotter.add_coast(ax1)
        #plotter.layout_surface(ax1,xLim=[-127,-123.5],yLim=[43,47])
        plotter.layout_surface(ax1,xLim=[-125.5,-123.5],yLim=[43.8,45.6])
        ax1.set_ylabel(r'Latitude')
        ax1.set_xlabel(r'Longitude')

        ax1.xaxis.set_major_locator(ticker.MultipleLocator(base=1))
        ax1.xaxis.set_major_formatter(ticker.StrMethodFormatter('{x:.0f}'))
        ax1.yaxis.set_major_locator(ticker.MultipleLocator(base=.2))
        ax1.yaxis.set_major_formatter(ticker.StrMethodFormatter('{x:.1f}'))
      
        ax.append(ax1)
    return ax
예제 #6
0
def plotAx():
    ax = []
    for i in np.arange(0, 1):
        ax1 = fig.add_subplot(1, 1, i + 1)
        plotter.add_bathy(ax1)
        plotter.add_coast(ax1)
        #plotter.layout_surface(ax1,xLim=[-127,-123.5],yLim=[43,47])
        plotter.layout_surface(ax1, xLim=[-130, -122.2], yLim=[40.65, 50])
        if i == 0:
            ax1.set_ylabel(r'Latitude')
        ax1.set_xlabel(r'Longitude')
        ax1.xaxis.set_major_locator(ticker.MultipleLocator(2))
        ax1.yaxis.set_major_locator(ticker.MultipleLocator(2))
        if i > 0:
            ax1.yaxis.set_major_locator(plt.NullLocator())
        #ax1.spines['top'].set_linewidth(.5)
        #ax1.spines['bottom'].set_linewidth(.5)
        #ax1.spines['left'].set_linewidth(.5)
        #ax1.spines['right'].set_linewidth(.5)
        ax.append(ax1)
    return ax
예제 #7
0
def plotAx():
    ax = []
    for i in np.arange(0, 1):
        ax1 = fig.add_subplot(1, 1, i + 1)
        plotter.add_bathy(ax1)
        plotter.add_coast(ax1)
        plotter.layout_surface(ax1, xLim=[-129, -123], yLim=[41, 49])

        ax1 = plotter.add_bathy(ax1)
        ax1 = plotter.add_coast(ax1)

        ax1.set_ylabel(r'Latitude')
        ax1.set_xlabel(r'Longitude')

        ax1.yaxis.set_major_locator(ticker.MultipleLocator(2))
        ax1.yaxis.set_major_formatter(ticker.StrMethodFormatter('{x:.0f}'))
        ax1.xaxis.set_major_locator(ticker.MultipleLocator(2))
        ax1.xaxis.set_major_formatter(ticker.StrMethodFormatter('{x:.0f}'))

        ax.append(ax1)

    return ax
예제 #8
0
                  struct_as_record=False)

#%%

ax = []
ax.append(plt.subplot2grid((2, 2), (0, 0), rowspan=2))
ax.append(plt.subplot2grid((2, 2), (0, 1), colspan=1))
ax.append(plt.subplot2grid((2, 2), (1, 1), colspan=1))

cm = plt.cm.get_cmap('seismic')

#%% Surface

ax[0] = plotter.add_bathy(ax[0])
ax[0] = plotter.add_coast(ax[0])
ax[0] = plotter.layout_surface(ax[0])

val1 = mat['surface'][1] - mat['surface'][0]
print([np.nanpercentile(val1, .5), np.nanpercentile(val1, 99.5)])
levels1 = [
    tick1 for tick1 in np.arange(-75e3, 75.001e3, 12.5e3)
    if np.abs(tick1) > .001e3
]
cplot = ax[0].contourf(mat['grd'].lon,
                       mat['grd'].lat,
                       val1,
                       levels=levels1,
                       cmap=cm,
                       extend='both')
cplot = ax[0].contourf(mat['grd'].lon,
                       mat['grd'].lat,