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


Python crs.Geodetic方法代码示例

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


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

示例1: main

# 需要导入模块: from cartopy import crs [as 别名]
# 或者: from cartopy.crs import Geodetic [as 别名]
def main():
    ax = plt.axes(projection=ccrs.Robinson())

    # make the map global rather than have it zoom in to
    # the extents of any plotted data
    ax.set_global()

    ax.stock_img()
    ax.coastlines()

    # san diego
    sdlat, sdlon = 32.7157, -117.1611
    # brisbane
    brislat, brislon = -27.4698, 153.0251


    # NOTE: longitude before latitude!!
    plt.plot([sdlon, brislon], [sdlat, brislat], color='blue', linewidth=2,  transform=ccrs.Geodetic())



    plt.show() 
开发者ID:linsalrob,项目名称:EdwardsLab,代码行数:24,代码来源:example.py

示例2: setup

# 需要导入模块: from cartopy import crs [as 别名]
# 或者: from cartopy.crs import Geodetic [as 别名]
def setup(self):
        # Image length.
        self.imlen = 256

        # Image.
        self.img = Image.open(
            "LunarLROLrocKaguya_1180mperpix_downsamp.png").convert("L")
        self.imgsize = self.img.size

        # Crater catalogue.
        self.craters = igen.ReadLROCHeadCombinedCraterCSV(
            filelroc="../catalogues/LROCCraters.csv",
            filehead="../catalogues/HeadCraters.csv",
            sortlat=True)

        # Long/lat limits
        self.cdim = [-180., 180., -60., 60.]

        # Coordinate systems.
        self.iglobe = ccrs.Globe(semimajor_axis=1737400,
                                 semiminor_axis=1737400,
                                 ellipse=None)
        self.geoproj = ccrs.Geodetic(globe=self.iglobe)
        self.iproj = ccrs.PlateCarree(globe=self.iglobe) 
开发者ID:silburt,项目名称:DeepMoon,代码行数:26,代码来源:test_input_data_gen.py

示例3: plot_extend

# 需要导入模块: from cartopy import crs [as 别名]
# 或者: from cartopy.crs import Geodetic [as 别名]
def plot_extend(resource, file_extension='png'):
    """
    plots the extend (domain) of the values stored in a netCDF file:

    :parm resource: path to netCDF file
    :param file_extension: file format of the graphic. if file_extension=None a matplotlib figure will be returned

    :return graphic: graphic in specified format
    """
    lats, lons = get_coordinates(resource, unrotate=True)

    # box_top = 45
    # x, y = [-20, -20, 45, 45, -44], [-45, box_top, box_top, -45, -45]

    xy = np.array([[np.min(lons), np.min(lats)],
                   [np.max(lons), np.min(lats)],
                   [np.max(lons), np.max(lats)],
                   [np.min(lons), np.max(lats)]])

    fig = plt.figure(figsize=(20, 10), dpi=600, facecolor='w', edgecolor='k')
    projection = ccrs.Robinson()

    #  ccrs.Orthographic(central_longitude=np.mean(xy[:, 0]),
    #  central_latitude=np.mean(xy[:, 1]),
    #  globe=None)  # Robinson()

    ax = plt.axes(projection=projection)
    ax.stock_img()
    ax.coastlines()
    ax.add_patch(mpatches.Polygon(xy, closed=True, transform=ccrs.PlateCarree(), color='coral', alpha=0.6))
    # ccrs.Geodetic()
    ax.gridlines()
    plt.show()

    if file_extension is None:
        map_graphic = fig
    else:
        map_graphic = fig2plot(fig=fig, file_extension=file_extension)
    plt.close()

    return map_graphic 
开发者ID:bird-house,项目名称:flyingpigeon,代码行数:43,代码来源:plt_ncdata.py

示例4: main

# 需要导入模块: from cartopy import crs [as 别名]
# 或者: from cartopy.crs import Geodetic [as 别名]
def main():

    # This is just useful for formatting returned dict
    # pp = pprint.PrettyPrinter(indent=2)

    # Create instance of Meso object, pass in YOUR token
    m = Meso(token='YOUR TOKEN')

    # Use to lookup stations, could specify counties or whatever here
    # findstationids = m.station_list(state='CO')
    # print(findstationids)

    # Grab most recent temp (F) ob in last 90 min at each of the below stations
    stations = ['kgxy, kccu, kcos, kden, kgjt, kbdu, kpub, klhx, kspd, kdro, ksbs, keeo, kguc, klic, '
                'kstk, kals, ktad']
    latest = m.latest(stid=stations, within='90', vars='air_temp', units='temp|F')

    # create a list to store everything, iterate over the number of objs returned in latest and append
    # lat, long, temp, and stid for use later
    data = []
    [data.append((float(ob['LATITUDE']), float(ob['LONGITUDE']), float(ob['OBSERVATIONS']['air_temp_value_1']['value']),
                  ob['STID'])) for ob in latest['STATION']]
    print(data)

    # Create a MapQuest open aerial instance.
    map_quest_aerial = cimgt.MapQuestOpenAerial()
    # Create a GeoAxes in the tile's projection.
    ax = plt.axes(projection=map_quest_aerial.crs)
    # Limit the extent of the map to Colorado's borders
    ax.set_extent([-102.03, -109.03, 37, 41])
    # Add the MapQuest data at zoom level 8.
    ax.add_image(map_quest_aerial, 8)

    # Plot lat/long pts with below params
    for lat, lon, temp, stid in data:
        plt.plot(lon, lat, marker='o', color='y', markersize=1,
                 alpha=0.7, transform=ccrs.Geodetic())

    # Transforms for the text func we're about to call
    geodetic_transform = ccrs.Geodetic()._as_mpl_transform(ax)
    text_transform = offset_copy(geodetic_transform, units='dots', x=0, y=0)

    # Plot temp and station id for each of the markers
    for lat, lon, temp, stid in data:
        plt.text(lon, lat, stid + '\n' + str(round(temp, 1)) + u' \N{DEGREE SIGN}' + 'F',
                 verticalalignment='center', horizontalalignment='center',
                 transform=text_transform, fontsize=9,
                 bbox=dict(facecolor='wheat', alpha=0.5, boxstyle='round'))
    plt.title('Current Weather Around Colorado')
    plt.show() 
开发者ID:mesowx,项目名称:MesoPy,代码行数:52,代码来源:Map_Plot.py

示例5: plotmap

# 需要导入模块: from cartopy import crs [as 别名]
# 或者: from cartopy.crs import Geodetic [as 别名]
def plotmap(ll, dd, maxdist=1, maxlinewidth=3):
    """
    Plot the map of the dna distances and lat longs
    :param ll: The lon-lats
    :param dd: The distances to use
    :param maxdist: The maximum distance that we will scale to be maxlinewidth
    :return:
    """

    ax = plt.axes(projection=ccrs.Robinson())

    # make the map global rather than have it zoom in to
    # the extents of any plotted data
    ax.set_global()

    ax.stock_img()
    ax.coastlines()

    ## color the lines based on the maximum distance value
    jet = cm = plt.get_cmap('jet')
    cNorm = colors.Normalize(vmin=0, vmax=maxdist)
    scalarMap = cmx.ScalarMappable(norm=cNorm, cmap=jet)

    # Using contourf to provide my colorbar info, then clearing the figure
    Z = [[0, 0], [0, 0]]
    levels = range(0, int(100 * maxdist) + 10, 10)
    CS3 = plt.contourf(Z, levels, cmap=jet)
#    plt.clf()




    # NOTE: longitude before latitude!!
    # plt.plot([sdlon, brislon], [sdlat, brislat], color='blue', linewidth=2,  transform=ccrs.Geodetic())
    samples = ll.keys()

    # plot the circles for each sample site
    for lonlat in ll.values():
        plt.plot(lonlat[0], lonlat[1], '*', markersize=18, transform=ccrs.PlateCarree())

    for idx1 in samples:
        for idx2 in samples:
            if idx1 == idx2:
                continue
            # this should only happen when we do best DNA distances
            if idx2 not in dd[idx1]:
                continue
            linewidth = dd[idx1][idx2]
            linewidth = linewidth/maxdist * maxlinewidth
            colorVal = scalarMap.to_rgba(dd[idx1][idx2])
            plt.plot([ll[idx1][0], ll[idx2][0]], [ll[idx1][1], ll[idx2][1]], color=colorVal, linewidth=linewidth, alpha=0.25, transform=ccrs.Geodetic())

#    plt.colorbar(CS3)

    plt.show() 
开发者ID:linsalrob,项目名称:EdwardsLab,代码行数:57,代码来源:crAssphage_distance.py


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