示例#1
0
文件: srtm.py 项目: bjlittle/cartopy
def main2():
    ax = plt.axes(projection=ccrs.PlateCarree())

    elev, crs, extent = io_srtm.srtm_composite(-6, 50, 4, 3)

    elev = np.ma.masked_less_equal(elev, 0, copy=False)

    ax.imshow(np.ma.log(elev**2),
              extent=extent,
              transform=crs,
              cmap='Greens',
              )

    plt.show()
示例#2
0
def main2():
    ax = plt.axes(projection=ccrs.PlateCarree())

    elev, crs, extent = io_srtm.srtm_composite(-6, 50, 4, 3)

    elev = np.ma.masked_less_equal(elev, 0, copy=False)

    ax.imshow(
        np.ma.log(elev**2),
        extent=extent,
        transform=crs,
        cmap='Greens',
    )

    plt.show()
示例#3
0
def main3():
    ax = plt.axes(projection=ccrs.PlateCarree())

    elev, crs, extent = io_srtm.srtm_composite(-5, 52, 2, 2)

    elev = np.ma.masked_less_equal(elev, 0, copy=False)

    use_mpl_light_source = False

    if use_mpl_light_source:
        from matplotlib.colors import LightSource

        ls = LightSource(
            azdeg=90,
            altdeg=80,
            hsv_min_val=0.6,
            hsv_min_sat=0.9,
            hsv_max_val=0.8,
            hsv_max_sat=1,
        )

        rgb = ls.shade(elev, plt.get_cmap('Greens', 3))
    else:
        import matplotlib.colors as mcolors
        rgb = set_shade(elev,
                        cmap=mcolors.ListedColormap(
                            [plt.get_cmap('Greens', 3)(0.5)]))

    ax.imshow(rgb, extent=extent, transform=crs)

    x = np.linspace(extent[0], extent[1], elev.shape[0])
    y = np.linspace(extent[2], extent[3], elev.shape[1])
    #
    #    ax.contour(x, y, elev, 100,
    #               linestyles='-',
    #               colors='blue',
    #               linewidths=0.3,
    #               alpha=0.4,
    #               transform=crs,
    #               )

    plt.show()
示例#4
0
文件: srtm.py 项目: bjlittle/cartopy
def main3():
    ax = plt.axes(projection=ccrs.PlateCarree())

    elev, crs, extent = io_srtm.srtm_composite(-5, 52, 2, 2)

    elev = np.ma.masked_less_equal(elev, 0, copy=False)

    use_mpl_light_source = False
    
    if use_mpl_light_source:
        from matplotlib.colors import LightSource
    
        ls = LightSource(azdeg=90, altdeg=80,
                         hsv_min_val=0.6, hsv_min_sat=0.9,
                         hsv_max_val=0.8, hsv_max_sat=1,
                         )
    
        rgb = ls.shade(elev, plt.get_cmap('Greens', 3))
    else:
        import matplotlib.colors as mcolors
        rgb = set_shade(elev,
                        cmap=mcolors.ListedColormap([plt.get_cmap('Greens', 3)(0.5)])
                    )


    ax.imshow(rgb,
                extent=extent,
                transform=crs
                )

    x = np.linspace(extent[0], extent[1], elev.shape[0])
    y = np.linspace(extent[2], extent[3], elev.shape[1])
#
#    ax.contour(x, y, elev, 100,
#               linestyles='-',
#               colors='blue',
#               linewidths=0.3,
#               alpha=0.4,
#               transform=crs,
#               )

    plt.show()
示例#5
0
def main():
    ax = plt.axes(projection=ccrs.PlateCarree())

    # Get the 1x1 degree SRTM tile for 12E, 47N
    elev, crs, extent = srtm.srtm_composite(12, 47, 1, 1)

    # Fill the gaps present in the elevation data
    elev_filled = srtm.fill_gaps(elev, 15)

    # Add shading simulating the Sun at 10am (South-East)
    # and with a low angle (15 degrees above horizon)
    shaded = srtm.add_shading(elev_filled, 135.0, 15.0)

    # The plot the result :
    plt.imshow(shaded, extent=extent, transform=crs,
               cmap='Greys', origin='lower')

    plt.title("SRTM Shaded Relief Map")

    gl = ax.gridlines(draw_labels=True)
    gl.xlabels_top = False
    gl.ylabels_left = False

    plt.show()
示例#6
0
def main():
    ax = plt.axes(projection=ccrs.PlateCarree())

    # Get the 1x1 degree SRTM tile for 12E, 47N
    elev, crs, extent = srtm.srtm_composite(12, 47, 1, 1)

    # Fill the gaps present in the elevation data
    elev_filled = srtm.fill_gaps(elev, 15)

    # Add shading simulating the Sun at 10am (South-East)
    # and with a low angle (15 degrees above horizon)
    shaded = srtm.add_shading(elev_filled, 135.0, 15.0)

    # The plot the result :
    plt.imshow(shaded, extent=extent, transform=crs,
               cmap='Greys', origin='lower')

    plt.title("SRTM Shaded Relief Map")

    gl = ax.gridlines(draw_labels=True,)
    gl.xlabels_top = False
    gl.ylabels_left = False

    plt.show()
示例#7
0
ccrs.Geodetic


# In[ ]:

import cartopy.crs as ccrs
from cartopy.io import srtm
import matplotlib.pyplot as plt


#def main():
ax = plt.axes(projection=ccrs.PlateCarree())

# Get the 1x1 degree SRTM tile for 12E, 47N
elev, crs, extent = srtm.srtm_composite(12, 47, 1, 1)

# Fill the gaps present in the elevation data
#elev_filled = srtm.fill_gaps(elev, 15)

# Add shading simulating the Sun at 10am (South-East)
# and with a low angle (15 degrees above horizon)
#shaded = srtm.add_shading(elev_filled, 135.0, 15.0)

# The plot the result :
plt.imshow(elev, extent=extent, transform=crs,
           cmap='Greys', origin='lower')

plt.title("SRTM Shaded Relief Map")

gl = ax.gridlines(draw_labels=True)