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


Python Basemap.urcrnrx方法代码示例

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


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

示例1: basemap_for_extended_region

# 需要导入模块: from mpl_toolkits.basemap import Basemap [as 别名]
# 或者: from mpl_toolkits.basemap.Basemap import urcrnrx [as 别名]
    def basemap_for_extended_region(self, marginx=10, marginy=10):
        xx, yy = self.get_proj_xy()
        xx1, yy1 = expand_domain(xx, yy, marginx=marginx, marginy=marginy)


        import copy

        proj_params = copy.copy(self.basemap.projparams)

        del proj_params["proj"]
        del proj_params["R"]
        del proj_params["units"]
        del proj_params["o_proj"]

        proj_params.update({
            "llcrnrx": xx1[0, 0],
            "llcrnry": yy1[0, 0],
            "urcrnrx": xx1[-1, -1],
            "urcrnry": yy1[-1, -1],
            "projection": self.basemap.projection
        })

        b1 = Basemap(**proj_params)

        b1.llcrnrx = xx1[0, 0]
        b1.llcrnry = yy1[0, 0]
        b1.urcrnrx = xx1[-1, -1]
        b1.urcrnry = yy1[-1, -1]
        return b1
开发者ID:guziy,项目名称:RPN,代码行数:31,代码来源:basemap_info.py

示例2: curved_image

# 需要导入模块: from mpl_toolkits.basemap import Basemap [as 别名]
# 或者: from mpl_toolkits.basemap.Basemap import urcrnrx [as 别名]
def curved_image(data, phi, theta, radians=True, grid=True, vmin=None, 
                 vmax=None, cmap="jet", cbar=True, extent=None, 
                 cb_title='', proj='ortho', title='', xlabel='Longitude (deg)',
                 ylabel='Latitude (deg)', lat_0=0, lon_0=0, nlon=5, nlat=5):

    # data               : 2D array of size (ntheta, nphi)
    # phi                : 1D array of phi values
    # theta              : 1D array of theta values
    # lon_0              : central longitude (phi direction)
    # lat_0              : central latitude (theta direction)
    # radians            : are phi, theta, lat_0 & lon_0 in radians or degrees
    # grid               : plot latitude/longitude grid lines
    # vmin, vmax         : min, max colorbar values
    # cmap               : matplotlib colormap instance to use
    # cbar               : include a colorbar
    # extent             : (phi_min, phi_max, theta_min, theta_max)
    # cb_title           : title for colorbar
    # nlon               : number of longitude lines to draw
    # nlat               : number of latitude lines to draw
    # proj               : projection to use ('moll', 'tmerc', 'merc', 'omerc'
    #                        'robin', 'ortho', ...
    # title              : give a title to the plot
    # xlabel             : give a label to the x-axis
    # ylabel             : give a label to the y-axis

    # convert everything to degrees
    if (radians):
        theta = theta * 180. / numpy.pi
        phi = phi * 180. / numpy.pi
        lat_0 = lat_0 * 180. / numpy.pi
        lon_0 = lon_0 * 180. / numpy.pi
        if (extent != None):
            extent[0] = extent[0] * 180. / numpy.pi # longitude min
            extent[1] = extent[1] * 180. / numpy.pi # longitude max
            extent[2] = extent[2] * 180. / numpy.pi # latitude min
            extent[3] = extent[3] * 180. / numpy.pi # latitude max

    nphi = len(phi)
    nth  = len(theta)

    # set defaults
    if (vmin == None):
        vmin = numpy.amin(data)
    if (vmax == None):
        vmax = numpy.amax(data)

    # set plot extent
    if (extent == None):
        lonmin = phi[0]
        lonmax = phi[-1]
        latmin = 90. - theta[-1]
        latmax = 90. - theta[0]

    else:
        lonmin = extent[0]
        lonmax = extent[1]
        latmin = extent[2]
        latmax = extent[3]

    fact = 0.0
    ll_lon = lonmin - fact*(lonmax - lonmin) # lon of lower left corner
    ll_lat = latmin - fact*(latmax - latmin) # lat of lower left corner
    ur_lon = lonmax + fact*(lonmax - lonmin) # lon of upper right corner
    ur_lat = latmax + fact*(latmax - latmin) # lat of upper right corner

    # set up main map
    map = Basemap(projection=proj, lon_0=lon_0, lat_0=lat_0)

    # set boundaries of map
    ll_x, temp = map(ll_lon, lat_0)  # lat_0 because it is the widest
    temp, ll_y = map(lon_0, ll_lat)  # lon_0 because it is the widest
    ur_x, temp = map(ur_lon, lat_0)  # lat_0 because it is the widest
    temp, ur_y = map(lon_0, ur_lat)  # lon_0 because it is the widest

    map.llcrnrx = ll_x
    map.llcrnry = ll_y
    map.urcrnrx = ur_x
    map.urcrnry = ur_y

    # set up grid
    lon_tmp = phi
    lat_tmp = 90. - theta
    x, y = map(*numpy.meshgrid(lon_tmp, lat_tmp))

    # STANDARD pcolormesh:
    # if data is data(x,y) then calling sequence is:
    #       pcolormesh(y, x, data, ...)
    # or
    #       pcolormesh(x, y, data.transpose(), ...)
    # data array has dimensions (nth, nphi)
    #
    # MAP.pcolormesh:
    # if data is data(x,y) then calling sequence is:
    #       pcolormesh(x, y, data, ...)
    im = map.pcolormesh(x, y, data, cmap=cmap, vmin=vmin, vmax=vmax)
    #map.drawmapboundary()

    # plotting grid lines
    if (grid):
        dlon = (lonmax-lonmin)/(nlon+1)
#.........这里部分代码省略.........
开发者ID:orvedahl,项目名称:CSS-Code,代码行数:103,代码来源:curved_shell.py


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