当前位置: 首页>>代码示例>>Python>>正文


Python Basemap.pcolormesh方法代码示例

本文整理汇总了Python中mpl_toolkits.basemap.Basemap.pcolormesh方法的典型用法代码示例。如果您正苦于以下问题:Python Basemap.pcolormesh方法的具体用法?Python Basemap.pcolormesh怎么用?Python Basemap.pcolormesh使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在mpl_toolkits.basemap.Basemap的用法示例。


在下文中一共展示了Basemap.pcolormesh方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: do_subplot

# 需要导入模块: from mpl_toolkits.basemap import Basemap [as 别名]
# 或者: from mpl_toolkits.basemap.Basemap import pcolormesh [as 别名]
    def do_subplot(field, title, lons, lats, plot_num, pole, diff=False): 
        """
        Make an individual subplot. 
        """

        if pole == 'north':
            projection = 'nplaea'
            boundinglat = 50
        else:
            projection = 'splaea'
            boundinglat = -50

        m_base = Basemap(projection=projection, boundinglat=boundinglat,
                         lon_0=0) 
        x, y = m_base(lons, lats)
        ax = fig.add_subplot(plot_num)

        max = get_max_within_area(field, lats, boundinglat, pole)
        if diff:
            cmap = plt.get_cmap('RdBu_r')
            min = -max
        else:
            cmap = plt.get_cmap()
            min = 0

        # Set the land points to be gray. 
        cmap.set_bad('0.65')
        m_base.pcolormesh(x, y, field, vmax=max, vmin=min, cmap=cmap)

        m_base.colorbar()
        m_base.drawparallels(np.arange(-80.,81.,20.))
        m_base.drawmeridians(np.arange(-180.,181.,20.))
        if title:
            plt.title(title)
开发者ID:nicjhan,项目名称:climatescripts,代码行数:36,代码来源:cice_plot_ice.py

示例2: diagnose_mean

# 需要导入模块: from mpl_toolkits.basemap import Basemap [as 别名]
# 或者: from mpl_toolkits.basemap.Basemap import pcolormesh [as 别名]
def diagnose_mean():
    path = "/home/huziy/skynet1_rech3/cordex/for_Samira/Africa_0.44deg_ERA40-Int1.5_E21981-2010/dailyAfrica_0.44deg_ERA40-Int1.5_E21981-2010TRAF.nc"

    ds = nc.Dataset(path)
    traf = ds.variables["TRAF"][:,0,:,:]

    traf_m = np.mean(traf, axis = 0) * 24 *60 * 60 * 365 #transform to mm/day
    lon = ds.variables["longitude"][:]
    lat = ds.variables["latitude"][:]


    lon[lon > 180] -= 360


    levels = [0,0.1,1,5,10,25, 50,100, 200, 300, 600, 1000,1500,2000,2500,3000,5000]
    cMap = get_cmap("jet", len(levels) - 1 )
    bn = BoundaryNorm(levels, cMap.N)

    ll_lon, ur_lon = np.min(lon), np.max(lon)

    ll_lat, ur_lat = np.min(lat), np.max(lat)
    traf_min = 0.1
    traf_m = np.ma.masked_where(traf_m < traf_min, traf_m)

    import matplotlib.pyplot as plt
    b = Basemap(projection="merc",llcrnrlon=ll_lon, llcrnrlat=ll_lat, urcrnrlon=ur_lon, urcrnrlat=ur_lat)
    x,y = b(lon, lat)
    plt.figure()
    b.pcolormesh(x, y, traf_m, norm = bn, cmap = cMap)
    cb = plt.colorbar()
    cb.ax.set_title("mm/year")
    b.drawcoastlines()
    plt.show()
开发者ID:guziy,项目名称:RPN,代码行数:35,代码来源:generic_rpn_to_nc_converter.py

示例3: plot_global

# 需要导入模块: from mpl_toolkits.basemap import Basemap [as 别名]
# 或者: from mpl_toolkits.basemap.Basemap import pcolormesh [as 别名]
def plot_global(cfsr_file):

	data = Dataset(cfsr_file,'r')
	lats=data.variables['lat'][:]
	lons=data.variables['lon'][:]

	array = np.squeeze(data.variables['irwin_cdr'][:,:,:])

	latn=data.geospatial_lat_min
	latx=data.geospatial_lat_max
	lonn=data.geospatial_lon_min
	lonx=data.geospatial_lon_max
	data.close()

	lons2d, lats2d=np.meshgrid(lons,lats)

	m=Basemap(projection='merc',
					llcrnrlat=latn,
					urcrnrlat=latx,
					llcrnrlon=lonn,
					urcrnrlon=lonx,
					resolution='l')

	m.drawcoastlines()
	m.pcolormesh(lons2d, lats2d, array, latlon=True, cmap='gray')
	plt.show()
开发者ID:rvalenzuelar,项目名称:goes_vis,代码行数:28,代码来源:image_goes.py

示例4: plot_basins

# 需要导入模块: from mpl_toolkits.basemap import Basemap [as 别名]
# 或者: from mpl_toolkits.basemap.Basemap import pcolormesh [as 别名]
    def plot_basins(self):
        basin_values = -np.ones((self.nx, self.ny))
        for basin in self.basins:

            # @type basin Basin
            #if int(basin.name.split('_')[1]) not in [0,4,1,11,15,20,22,25]: continue

            for theCell in basin.cells:
                # @type theCell Cell
                i, j = theCell.coords()

                theValue = basin.id if theCell.next is not None else -2
                basin_values[i,j] = theValue

        basin_values = np.ma.masked_where(basin_values == -1, basin_values)
        lons, lats = self.longitudes, self.latitudes
        lons = lons.copy()
        lons[lons <= 180] += 360
        lon_min = np.min(lons)
        lon_max = np.max(lons)
        lat_min = np.min(lats)
        lat_max = np.max(lats)

        basemap = Basemap(llcrnrlon = lon_min, llcrnrlat = lat_min,
                          urcrnrlon = lon_max, urcrnrlat = lat_max,
                          resolution = 'i'
                        )
        lons, lats = basemap(lons, lats)
        colormap = plt.cm.get_cmap(name = 'prism', lut = len(self.basins))
        colormap.set_under(color = 'k')

        basemap.pcolormesh(lons, lats, basin_values, cmap = colormap, vmin = 0)

        basemap.drawcoastlines()
        plt.show()
开发者ID:guziy,项目名称:PlotWatrouteData,代码行数:37,代码来源:cell_manager.py

示例5: basemapPGAPlot

# 需要导入模块: from mpl_toolkits.basemap import Basemap [as 别名]
# 或者: from mpl_toolkits.basemap.Basemap import pcolormesh [as 别名]
def basemapPGAPlot(lons, lats, pga):
        
    lonmesh, latmesh = np.meshgrid(lons, lats)
    pga = np.array(pga)
    pga = pga.reshape((len(lons), len(lats)))
    
    
    plt.close()
    m = Basemap(projection='cyl', llcrnrlat=lats.min(), urcrnrlat=lats.max(), llcrnrlon=lons.min(), urcrnrlon=lons.max(), resolution='i')
    m.drawcoastlines()
    
    #m.drawmapboundary(fill_color='PaleTurquoise')
    #m.fillcontinents(color='lemonchiffon',lake_color='PaleTurquoise', zorder=0)
    m.drawmapboundary()#fill_color='lightgray')
    #m.fillcontinents(color='darkgray',lake_color='lightgray', zorder=0)
    m.drawcountries()
    
    m.drawparallels(np.arange(round(lats.min()),round(lats.max()),2), labels=[1,0,0,0])
    m.drawmeridians(np.arange(round(lons.min()),round(lons.max()),2), labels=[0,0,0,1])
    
    #m.contourf(lonmesh, latmesh, pga)
    #m.plot(simx[::], simy[::], 'm.')
    m.pcolormesh(lonmesh, latmesh, pga, vmin = 0, vmax = 20, cmap="jet")
    cb = m.colorbar()
    cb.set_label("Peak Ground Acceleration (% g)")
    m.show()
开发者ID:johnmaxwilson,项目名称:GMPE-x-ETAS,代码行数:28,代码来源:Shakemap_reader.py

示例6: doPlot2

# 需要导入模块: from mpl_toolkits.basemap import Basemap [as 别名]
# 或者: from mpl_toolkits.basemap.Basemap import pcolormesh [as 别名]
def doPlot2(lon,lat,aeroOptDep,title,figName,beginLatFig=-60,endLatFig=20,beginLonFig=-96,endLonFig=-13,\
beginLatReg=0,endLatReg=0,beginLonReg=0,endLonReg=0):

	m=Basemap(projection='cyl',resolution='l',llcrnrlat=beginLatFig,\
urcrnrlat=endLatFig,llcrnrlon=beginLonFig,urcrnrlon=endLonFig)
	#lon,lat=m(lon,lat)

	print figName
	parallels = np.arange(beginLatFig,endLatFig,(endLatFig-beginLatFig)/8.)
	m.drawparallels(parallels,labels=[1,0,0,1])
	meridians = np.arange(beginLonFig,endLonFig,(endLonFig-beginLonFig)/4.)
	m.drawmeridians(meridians,labels=[1,0,0,1])
        m.drawcountries(linewidth=0.5)
        m.drawcoastlines(linewidth=0.5)
        m.pcolormesh(lon,lat,aeroOptDep,vmin=0.,vmax=1)
	if beginLatReg==0 and endLatReg==0 and beginLonReg==0 and\
endLonReg==0:
		pass

	else:	
	       	drawScreen(beginLatReg,endLatReg,beginLonReg,endLonReg,m)
		#print beginLatReg,endLatReg,beginLonReg,endLonReg
        cb=m.colorbar()
        plt.title(title)
        plt.savefig(figName+'.png',format='png',dpi=150)
        plt.clf()
开发者ID:jdiasn,项目名称:aotPy,代码行数:28,代码来源:aotLib.py

示例7: plot_on_earth

# 需要导入模块: from mpl_toolkits.basemap import Basemap [as 别名]
# 或者: from mpl_toolkits.basemap.Basemap import pcolormesh [as 别名]
def plot_on_earth(lons, lats, data, vmin=-4, vmax=12, cbar_loc='left', cbar_ticks=None):
    #import ipdb; ipdb.set_trace()
    #if ax == None:
	#ax = plt.gca()
    plot_lons, plot_data = extend_data(lons, lats, data)

    lons, lats = np.meshgrid(plot_lons, lats)

    m = Basemap(projection='cyl', resolution='c', llcrnrlat=-90, urcrnrlat=90, llcrnrlon=-180, urcrnrlon=180)
    x, y = m(lons, lats)

    m.pcolormesh(x, y, plot_data, vmin=vmin, vmax=vmax)
    #m.pcolormesh(x, y, plot_data)

    m.drawcoastlines()
    if cbar_loc == 'left':
	p_labels = [0, 1, 0, 0]
    else:
	p_labels = [1, 0, 0, 0]

    m.drawparallels(np.arange(-90.,90.1,45.), labels=p_labels, fontsize=10)
    m.drawmeridians(np.arange(-180.,180.,60.), labels=[0, 0, 0, 1], fontsize=10)

    #import ipdb; ipdb.set_trace()
    if cbar_ticks == None:
	cbar = m.colorbar(location=cbar_loc, pad='7%')
    else:
	cbar = m.colorbar(location=cbar_loc, pad='7%', ticks=cbar_ticks)

    if cbar_loc == 'left':
	cbar.ax.xaxis.get_offset_text().set_position((10,0))
开发者ID:markmuetz,项目名称:geogg134_project,代码行数:33,代码来源:plotting.py

示例8: plot_cell_feature

# 需要导入模块: from mpl_toolkits.basemap import Basemap [as 别名]
# 或者: from mpl_toolkits.basemap.Basemap import pcolormesh [as 别名]
def plot_cell_feature (data, cell_id_column, cell_lat_column, cell_long_column, richness_column, title=None, second_feature_data=None, second_feature_column=None):
    lats = np.asarray(np.unique(data[cell_lat_column]))
    lons = np.asarray(np.unique(data[cell_long_column]))
    lons, lats = np.meshgrid(lons,lats)
    
    richness = np.array(data[richness_column])
    richness.shape = (len(np.unique(lats)), len(np.unique(lons)))
    richness_mask = ma.masked_where(np.isnan(richness),richness)
    
    if second_feature_column:
        second_feature = np.array(second_feature_data[second_feature_column])
        second_feature.shape = (len(np.unique(lats)), len(np.unique(lons)))
        second_feature_data_mask = ma.masked_where(np.isnan(second_feature),second_feature)
        
    fig = plt.figure()
    m = Basemap(projection='merc',llcrnrlat=23.5,urcrnrlat=57, llcrnrlon=-140,urcrnrlon=-50,lat_ts=20,resolution='l')
    m.drawcoastlines(linewidth = 1.25)
    if np.nanmin(richness) < 20:
        vmin=0
    else:
        vmin=round(np.nanmin(richness)-20, -1)
    im1 = m.pcolormesh(lons,lats,richness_mask,shading='flat',cmap=plt.cm.Blues,latlon=True, vmin=vmin)
    if second_feature_column:
        im2 = m.pcolormesh(lons,lats,second_feature_data_mask,shading='flat',cmap=plt.cm.RdYlBu,latlon=True)
    cb = m.colorbar(im1,"bottom", size="5%", pad="2%")
    plt.title(title)
开发者ID:weecology,项目名称:diversity-conservation,代码行数:28,代码来源:abundance_mapping.py

示例9: plot

# 需要导入模块: from mpl_toolkits.basemap import Basemap [as 别名]
# 或者: from mpl_toolkits.basemap.Basemap import pcolormesh [as 别名]
def plot(array,typep=None,clevel=None):

	fig,ax = plt.subplots()

	lats=array['lats']
	lons=array['lons']

	latm,lonm = np.meshgrid(lats,lons)
	latn = np.min(lats)
	latx = np.max(lats)
	lonn = np.min(lons)
	lonx = np.max(lons)

	m = Basemap(projection='merc',
	            llcrnrlat=latn,
	            urcrnrlat=latx,
	            llcrnrlon=lonn,
	            urcrnrlon=lonx,
	            resolution='l',
				ax=ax)

	if typep == 'pcolor':
		m.pcolormesh(lonm.T,latm.T,array['data'],latlon=True)
	elif typep == 'contourf':
		X,Y=m(lonm.T, latm.T)
		m.contourf(X,Y,array['data'],clevel)

	m.drawparallels(lats[1::10],labels=[1,0,0,0])
	m.drawmeridians(lons[1::20],labels=[0,0,0,1])
	m.drawcoastlines()

	plt.show(block=False)
开发者ID:rvalenzuelar,项目名称:pythonx,代码行数:34,代码来源:download_opendap_cfsr.py

示例10: _raster_on_earth

# 需要导入模块: from mpl_toolkits.basemap import Basemap [as 别名]
# 或者: from mpl_toolkits.basemap.Basemap import pcolormesh [as 别名]
def _raster_on_earth(lons, lats, data, vmin=None, vmax=None, loc=None, colorbar=True, labels=True):
    if not loc:
        m = Basemap(projection='cyl', resolution='c',
                    llcrnrlat=-90, urcrnrlat=90, llcrnrlon=-180, urcrnrlon=180)
    else:
        m = Basemap(projection='cyl', resolution='c', **loc)

    if data is not None:
        plot_lons, plot_data = _extend_data(lons, lats, data)
        lons, lats = np.meshgrid(plot_lons, lats)
        x, y = m(lons, lats)
        if vmin:
            m.pcolormesh(x, y, plot_data, vmin=vmin, vmax=vmax)
        else:
            m.pcolormesh(x, y, plot_data)

    m.drawcoastlines()

    if labels:
        p_labels = [0, 1, 0, 0]
        m.drawparallels(np.arange(-90., 90.1, 45.), labels=p_labels, fontsize=10)
        m.drawmeridians(np.arange(-180., 180., 60.), labels=[0, 0, 0, 1], fontsize=10)

    if colorbar and data is not None:
        m.colorbar(location='right', pad='7%')
    return m
开发者ID:markmuetz,项目名称:stormtracks,代码行数:28,代码来源:figure_plotting.py

示例11: map_imager_track

# 需要导入模块: from mpl_toolkits.basemap import Basemap [as 别名]
# 或者: from mpl_toolkits.basemap.Basemap import pcolormesh [as 别名]
def map_imager_track(imager_lonlat, track_lonlat):
    """
    Plot *imager_lonlat* and *track_lonlat* on global map and return the figure.
    
    """
    from mpl_toolkits.basemap import Basemap
    
    fig = figure()
    ax = fig.add_subplot(111)
    m = Basemap(projection='cyl', llcrnrlon=-180, llcrnrlat=-90,
                urcrnrlon=180, urcrnrlat=90, resolution='l', ax=ax)
    
    m.drawcoastlines(linewidth=.5, color='grey')
    
    # Don't draw each pixel, or the machine will choke!
    npixels = imager_lonlat[0].size
    from math import sqrt
    step = int(round(sqrt(npixels / 1e5))) # Will give a total of about 1e5 pixels
    _slice_2d = (slice(None, None, step),) * 2
    m.pcolormesh(imager_lonlat[0][_slice_2d], imager_lonlat[1][_slice_2d],
                 imager_lonlat[1][_slice_2d], alpha=.5)
    m.plot(track_lonlat[0], track_lonlat[1], 'o', markersize=1, alpha=.1,
           label='track')
    
    return fig
开发者ID:adybbroe,项目名称:atrain_match,代码行数:27,代码来源:along_track_plotting.py

示例12: snr

# 需要导入模块: from mpl_toolkits.basemap import Basemap [as 别名]
# 或者: from mpl_toolkits.basemap.Basemap import pcolormesh [as 别名]
def snr(cflx, pco2):
	#~ plt.figure(figsize=(10, 10))
	curr_map = Basemap(projection='cyl', llcrnrlon=ll_lon, llcrnrlat=ll_lat, urcrnrlon=ur_lon, urcrnrlat=ur_lat, resolution='i', area_thresh=100.)
	x, y = curr_map(lon, lat)
	vmin=0
	vmax=10
	V = np.arange(0, 10)
	
	plt.subplot(211)
	im = curr_map.pcolormesh(x, y, snr_func(cflx) , vmin=vmin, vmax=vmax, cmap=cmap)
	plt.axis('tight')
	plt.colorbar()
	curr_map.drawcoastlines()
	curr_map.fillcontinents(color='grey',lake_color='aqua')	
	#~ plt.title('Cflux SNR')
	
	plt.subplot(212)
	im = curr_map.pcolormesh(x, y, snr_func(pco2), vmin=vmin, vmax=vmax, cmap=cmap)
	plt.axis('tight')
	plt.colorbar()
	curr_map.drawcoastlines()
	curr_map.fillcontinents(color='grey',lake_color='aqua')	
	#~ plt.title('Dpco2 SNR')	
	
	plt.savefig(FIGDIR + 'snrs.png')
	plt.close('all')
开发者ID:nicholaschris,项目名称:masters_thesis,代码行数:28,代码来源:data-analysis.py

示例13: run

# 需要导入模块: from mpl_toolkits.basemap import Basemap [as 别名]
# 或者: from mpl_toolkits.basemap.Basemap import pcolormesh [as 别名]
def run(FILE_NAME):
    
    with h5py.File(FILE_NAME, mode='r') as f:

        name = '/Grid/IRprecipitation'
        data = f[name][:]
        units = f[name].attrs['units']
        _FillValue = f[name].attrs['_FillValue']
        data[data == _FillValue] = np.nan
        data = np.ma.masked_where(np.isnan(data), data)

        
        # Get the geolocation data
        latitude = f['/Grid/lat'][:]
        longitude = f['/Grid/lon'][:]

        
    m = Basemap(projection='cyl', resolution='l',
                llcrnrlat=-90, urcrnrlat=90,
                llcrnrlon=-180, urcrnrlon=180)
    m.drawcoastlines(linewidth=0.5)
    m.drawparallels(np.arange(-90, 91, 45))
    m.drawmeridians(np.arange(-180, 180, 45), labels=[True,False,False,True])
    m.pcolormesh(longitude, latitude, data.T, latlon=True)
    cb = m.colorbar()    
    cb.set_label(units)

    basename = os.path.basename(FILE_NAME)
    plt.title('{0}\n{1}'.format(basename, name))
    fig = plt.gcf()
    # plt.show()
    pngfile = "{0}.py.png".format(basename)
    fig.savefig(pngfile)
开发者ID:hdfeos,项目名称:zoo_python,代码行数:35,代码来源:3B-HHR-E.MS.MRG.3IMERG.20160107-S000000-E002959.0000.V03E.HDF5.py

示例14: plot

# 需要导入模块: from mpl_toolkits.basemap import Basemap [as 别名]
# 或者: from mpl_toolkits.basemap.Basemap import pcolormesh [as 别名]
 def plot(self,key='Re'):
     """
     Create a plot of a variable over the ORACLES study area. 
     
     Parameters
     ----------
     key : string
     See names for available datasets to plot.
     
     clf : boolean
     If True, clear off pre-existing figure. If False, plot over pre-existing figure.
     
     Modification history
     --------------------
     Written: Michael Diamond, 08/16/2016, Seattle, WA
     Modified: Michael Diamond, 08/21/2016, Seattle, WA
        -Added ORACLES routine flight plan, Walvis Bay (orange), and Ascension Island
     Modified: Michael Diamond, 09/02/2016, Swakopmund, Namibia
         -Updated flihgt track
     """
     plt.clf()
     size = 16
     font = 'Arial'
     m = Basemap(llcrnrlon=self.lon.min(),llcrnrlat=self.lat.min(),urcrnrlon=self.lon.max(),\
     urcrnrlat=self.lat.max(),projection='merc',resolution='i')
     m.drawparallels(np.arange(-180,180,5),labels=[1,0,0,0],fontsize=size,fontname=font)
     m.drawmeridians(np.arange(0,360,5),labels=[1,1,0,1],fontsize=size,fontname=font)
     m.drawmapboundary(linewidth=1.5)        
     m.drawcoastlines()
     m.drawcountries()
     if key == 'Pbot' or key == 'Ptop' or key == 'Nd' or key == 'DZ': 
         m.drawmapboundary(fill_color='steelblue')
         m.fillcontinents(color='floralwhite',lake_color='steelblue',zorder=0)
     else: m.fillcontinents('k',zorder=0)
     if key == 'Nd':
         m.pcolormesh(self.lon,self.lat,self.ds['%s' % key],cmap=self.colors['%s' % key],\
         latlon=True,norm = LogNorm(vmin=self.v['%s' % key][0],vmax=self.v['%s' % key][1]))
     elif key == 'Zbf' or key == 'Ztf':
         levels = [0,250,500,750,1000,1250,1500,1750,2000,2500,3000,3500,4000,5000,6000,7000,8000,9000,10000]
         m.contourf(self.lon,self.lat,self.ds['%s' % key],levels=levels,\
         cmap=self.colors['%s' % key],latlon=True,extend='max')
     elif key == 'DZ':
         levels = [0,500,1000,1500,2000,2500,3000,3500,4000,4500,5000,5500,6000,6500,7000]
         m.contourf(self.lon,self.lat,self.ds['%s' % key],levels=levels,\
         cmap=self.colors['%s' % key],latlon=True,extend='max')
     else:
         m.pcolormesh(self.lon,self.lat,self.ds['%s' % key],cmap=self.colors['%s' % key],\
         latlon=True,vmin=self.v['%s' % key][0],vmax=self.v['%s' % key][1])
     cbar = m.colorbar()
     cbar.ax.tick_params(labelsize=size-2) 
     cbar.set_label('[%s]' % self.units['%s' % key],fontsize=size,fontname=font)
     if key == 'Pbot' or key == 'Ptop': cbar.ax.invert_yaxis() 
     m.scatter(14.5247,-22.9390,s=250,c='orange',marker='D',latlon=True)
     m.scatter(-14.3559,-7.9467,s=375,c='c',marker='*',latlon=True)
     m.scatter(-5.7089,-15.9650,s=375,c='chartreuse',marker='*',latlon=True)
     m.plot([14.5247,13,0],[-22.9390,-23,-10],c='w',linewidth=5,linestyle='dashed',latlon=True)
     m.plot([14.5247,13,0],[-22.9390,-23,-10],c='k',linewidth=3,linestyle='dashed',latlon=True)
     plt.title('%s from MSG SEVIRI on %s/%s/%s at %s UTC' % \
     (self.names['%s' % key],self.month,self.day,self.year,self.time),fontsize=size+4,fontname=font)
     plt.show()
开发者ID:michael-s-diamond,项目名称:Chrysopelea,代码行数:62,代码来源:sevipy.py

示例15: plot_drainage_areas

# 需要导入模块: from mpl_toolkits.basemap import Basemap [as 别名]
# 或者: from mpl_toolkits.basemap.Basemap import pcolormesh [as 别名]
def plot_drainage_areas(path = "data/hydrosheds/test_using_splitting_amno.nc"):
    ds = Dataset(path)
    #basemap = polar_stereographic.basemap
    basemap =  Basemap()
    lons = ds.variables["lon"][:]
    lats = ds.variables["lat"][:]
    channel_slope = ds.variables["slope"][:]

    lons[lons < 0] += 360

    x, y = basemap(lons, lats)




    acc_area = ds.variables["accumulation_area"][:]
    acc_area = np.log(acc_area)
    acc_area = np.ma.masked_where(channel_slope < 0, acc_area)

    basemap.pcolormesh(x, y, acc_area)
    basemap.drawcoastlines()
    plt.colorbar()
    plt.xlim(x.min(), x.max())
    plt.ylim(y.min(), y.max())
    plt.show()
开发者ID:guziy,项目名称:PlotWatrouteData,代码行数:27,代码来源:plot_2d_field.py


注:本文中的mpl_toolkits.basemap.Basemap.pcolormesh方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。