Esempio n. 1
0
def plot_coast_line(grd, proj=None):
    '''
    plot_coast_line(grd, {proj})

    plot the coastline from the object grid. 
    proj=map (optional) is a Basemap object for
    projection.
    ''' 


    a = plt.gca()

    coast = get_coast_line(grd)
    c = np.array(coast)

    if proj is None:
        col = collections.LineCollection(c)
    else:
        cp = np.zeros(c.shape)
        for i in range(c.shape[0]):
            cp[i,:,0], cp[i,:,1] = proj(c[i,:,0], c[i,:,1])

        col = collections.LineCollection(cp)

 
    a.add_collection(col, autolim=True)
    col.set_color('k')
Esempio n. 2
0
def plot_coast_line(grd, proj=None):
    '''
    plot_coast_line(grd, {proj})

    plot the coastline from the object grid. 
    proj=map (optional) is a Basemap object for
    projection.
    '''

    a = plt.gca()

    coast = get_coast_line(grd)
    c = np.array(coast)

    if proj is None:
        col = collections.LineCollection(c)
    else:
        cp = np.zeros(c.shape)
        for i in range(c.shape[0]):
            cp[i, :, 0], cp[i, :, 1] = proj(c[i, :, 0], c[i, :, 1])

        col = collections.LineCollection(cp)

    a.add_collection(col, autolim=True)
    col.set_color('k')
Esempio n. 3
0

lon = grd.hgrid.lon_rho
lat = grd.hgrid.lat_rho
h = grd.vgrid.h
mask = grd.hgrid.mask_rho
idx = np.where(mask == 0)
h[idx] = 0


fig = plt.figure(figsize=(10, 5))
ax = fig.gca(projection='3d', azim=-50, elev=70)
pal = cm.spectral
pal.set_over('#666666', 1.0)
vc = np.arange(-80,-5+0.1,0.1)
pal_norm = colors.BoundaryNorm(vc,ncolors=256, clip = False)
surf = ax.plot_surface(lon, lat, -h, rstride=1, cstride=1, cmap=pal, norm=pal_norm, linewidth=0, antialiased=False)
fig.colorbar(surf, shrink=0.9, aspect=40)

coast = pyroms_toolbox.get_coast_line(grd)
coast = np.array(coast)
coast = collections.LineCollection(coast)
line_collection_2d_to_3d(coast, zs=-1, zdir='z')
coast.set_color('k')
ax.add_collection3d(coast, zs=-1, zdir='z')

outfile='YELLOW_bathy_3D.png'
plt.savefig(outfile, dpi=300, facecolor='w', edgecolor='w', \
                 orientation='portrait')

Esempio n. 4
0

lon = grd.hgrid.lon_rho
lat = grd.hgrid.lat_rho
h = grd.vgrid.h
mask = grd.hgrid.mask_rho
idx = np.where(mask == 0)
h[idx] = 0


fig = plt.figure(figsize=(10, 5))
ax = fig.gca(projection='3d', azim=-50, elev=70)
pal = cm.Spectral
pal.set_over('#666666', 1.0)
vc = np.arange(-80,-5+0.1,0.1)
pal_norm = colors.BoundaryNorm(vc,ncolors=256, clip = False)
surf = ax.plot_surface(lon, lat, -h, rstride=1, cstride=1, cmap=pal, norm=pal_norm, linewidth=0, antialiased=False)
fig.colorbar(surf, shrink=0.9, aspect=40)

coast = pyroms_toolbox.get_coast_line(grd)
coast = np.array(coast)
coast = collections.LineCollection(coast)
line_collection_2d_to_3d(coast, zs=-1, zdir='z')
coast.set_color('k')
ax.add_collection3d(coast, zs=-1, zdir='z')

outfile='YELLOW_bathy_3D.png'
plt.savefig(outfile, dpi=300, facecolor='w', edgecolor='w', \
                 orientation='portrait')