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


Python Downloader.from_config方法代码示例

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


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

示例1: natural_earth

# 需要导入模块: from cartopy.io import Downloader [as 别名]
# 或者: from cartopy.io.Downloader import from_config [as 别名]
def natural_earth(resolution="110m", category="physical", name="coastline"):
    """
    Returns the path to the requested natural earth shapefile,
    downloading and unziping if necessary.

    To identify valid components for this function, either browse
    NaturalEarthData.com, or if you know what you are looking for, go to
    https://github.com/nvkelso/natural-earth-vector/tree/master/zips to
    see the actual files which will be downloaded.

    .. note::

        Some of the Natural Earth shapefiles have special features which are
        described in the name. For example, the 110m resolution
        "admin_0_countries" data also has a sibling shapefile called
        "admin_0_countries_lakes" which excludes lakes in the country
        outlines. For details of what is available refer to the Natural Earth
        website, and look at the "download" link target to identify
        appropriate names.

    """
    # get hold of the Downloader (typically a NEShpDownloader instance)
    # which we can then simply call its path method to get the appropriate
    # shapefile (it will download if necessary)
    ne_downloader = Downloader.from_config(("shapefiles", "natural_earth", resolution, category, name))
    format_dict = {"config": config, "category": category, "name": name, "resolution": resolution}
    return ne_downloader.path(format_dict)
开发者ID:scottyhq,项目名称:cartopy,代码行数:29,代码来源:shapereader.py

示例2: __init__

# 需要导入模块: from cartopy.io import Downloader [as 别名]
# 或者: from cartopy.io.Downloader import from_config [as 别名]
    def __init__(self, downloader=None, max_nx=3, max_ny=3):
        """
        Parameters
        ==========
        downloader : :class:`cartopy.io.Downloader` instance or None
            The downloader to use for the SRTM3 dataset. If None, the
            downloader will be taken using
            :class:`cartopy.io.Downloader.from_config` with ('SRTM', 'SRTM3')
            as the target.
        max_nx : int
            The maximum number of x tiles to be combined when producing a
            wider composite for this RasterSource.
        max_ny : int
            The maximum number of y tiles to be combined when producing a
            taller composite for this RasterSource.

        """
        #: The CRS of the underlying SRTM3 data.
        self.crs = ccrs.PlateCarree()

        #: The cartopy Downloader which can handle SRTM3 data. Normally, this
        #: will be a :class:`SRTM3Downloader` instance.
        self.downloader = downloader

        if self.downloader is None:
            self.downloader = Downloader.from_config(('SRTM', 'SRTM3'))

        #: A tuple of (max_x_tiles, max_y_tiles).
        self._max_tiles = (max_nx, max_ny)
开发者ID:ajdawson,项目名称:cartopy,代码行数:31,代码来源:srtm.py

示例3: gshhs

# 需要导入模块: from cartopy.io import Downloader [as 别名]
# 或者: from cartopy.io.Downloader import from_config [as 别名]
def gshhs(scale="c", level=1):
    """
    Returns the path to the requested GSHHS shapefile,
    downloading and unziping if necessary.

    """
    # Get hold of the Downloader (typically a GSHHSShpDownloader instance)
    # and call its path method to get the appropriate shapefile (it will
    # download it if necessary).
    gshhs_downloader = Downloader.from_config(("shapefiles", "gshhs", scale, level))
    format_dict = {"config": config, "scale": scale, "level": level}
    return gshhs_downloader.path(format_dict)
开发者ID:scottyhq,项目名称:cartopy,代码行数:14,代码来源:shapereader.py

示例4: gshhs

# 需要导入模块: from cartopy.io import Downloader [as 别名]
# 或者: from cartopy.io.Downloader import from_config [as 别名]
def gshhs(scale='c', level=1):
    """
    Returns the path to the requested GSHHS shapefile,
    downloading and unziping if necessary.

    """
    # Get hold of the Downloader (typically a GSHHSShpDownloader instance)
    # and call its path method to get the appropriate shapefile (it will
    # download it if necessary).
    gshhs_downloader = Downloader.from_config(('shapefiles', 'gshhs',
                                               scale, level))
    format_dict = {'config': config, 'scale': scale, 'level': level}
    return gshhs_downloader.path(format_dict)
开发者ID:RachelNorth,项目名称:cartopy,代码行数:15,代码来源:shapereader.py

示例5: natural_earth

# 需要导入模块: from cartopy.io import Downloader [as 别名]
# 或者: from cartopy.io.Downloader import from_config [as 别名]
def natural_earth(resolution='110m', category='physical', name='coastline'):
    """
    Returns the path to the requested natural earth shapefile,
    downloading and unziping if necessary.

    """
    # get hold of the Downloader (typically a NEShpDownloader instance)
    # which we can then simply call its path method to get the appropriate
    # shapefile (it will download if necessary)
    ne_downloader = Downloader.from_config(('shapefiles', 'natural_earth',
                                            resolution, category, name))
    format_dict = {'config': config, 'category': category,
                   'name': name, 'resolution': resolution}
    return ne_downloader.path(format_dict)
开发者ID:RachelNorth,项目名称:cartopy,代码行数:16,代码来源:shapereader.py

示例6: SRTM3_retrieve

# 需要导入模块: from cartopy.io import Downloader [as 别名]
# 或者: from cartopy.io.Downloader import from_config [as 别名]
def SRTM3_retrieve(lon, lat):
    """
    Return the path of a .hgt file for the given SRTM location.

    If no such .hgt file exists (because it is over the ocean)
    None will be returned.

    """
    x = '%s%03d' % ('E' if lon > 0 else 'W', abs(int(lon)))
    y = '%s%02d' % ('N' if lat > 0 else 'S', abs(int(lat)))

    srtm_downloader = Downloader.from_config(('SRTM', 'SRTM3'))
    params = {'config': config, 'x': x, 'y': y}
    if srtm_downloader.url(params) is None:
        return None
    else:
        return srtm_downloader.path({'config': config, 'x': x, 'y': y})
开发者ID:expertanalytics,项目名称:cartopy,代码行数:19,代码来源:srtm.py

示例7: __init__

# 需要导入模块: from cartopy.io import Downloader [as 别名]
# 或者: from cartopy.io.Downloader import from_config [as 别名]
    def __init__(self, resolution, downloader, max_nx, max_ny):
        """
        Parameters
        ==========
        resolution : int
            The resolution of SRTM to download, in arc-seconds. Data is
            available at resolutions of 3 and 1 arc-seconds.
        downloader : :class:`cartopy.io.Downloader` instance or None
            The downloader to use for the SRTM dataset. If None, the
            downloader will be taken using
            :class:`cartopy.io.Downloader.from_config` with ('SRTM',
            'SRTM{resolution}') as the target.
        max_nx : int
            The maximum number of x tiles to be combined when producing a
            wider composite for this RasterSource.
        max_ny : int
            The maximum number of y tiles to be combined when producing a
            taller composite for this RasterSource.

        """
        if resolution == 3:
            self._shape = (1201, 1201)
        elif resolution == 1:
            self._shape = (3601, 3601)
        else:
            raise ValueError(
                'Resolution is an unexpected value ({}).'.format(resolution))
        self._resolution = resolution

        #: The CRS of the underlying SRTM data.
        self.crs = ccrs.PlateCarree()

        #: The Cartopy Downloader which can handle SRTM data. Normally, this
        #: will be a :class:`SRTMDownloader` instance.
        self.downloader = downloader

        if self.downloader is None:
            self.downloader = Downloader.from_config(
                ('SRTM', 'SRTM' + str(resolution)))

        #: A tuple of (max_x_tiles, max_y_tiles).
        self._max_tiles = (max_nx, max_ny)
开发者ID:corinnebosley,项目名称:cartopy,代码行数:44,代码来源:srtm.py

示例8: srtm_fname

# 需要导入模块: from cartopy.io import Downloader [as 别名]
# 或者: from cartopy.io.Downloader import from_config [as 别名]
    def srtm_fname(self, lon, lat):
        """
        Return the filename for the given lon/lat SRTM tile (downloading if
        necessary), or None if no such tile exists (i.e. the tile would be
        entirely over water, or out of latitude range).

        """
        if int(lon) != lon or int(lat) != lat:
            raise ValueError('Integer longitude/latitude values required.')

        x = '%s%03d' % ('E' if lon >= 0 else 'W', abs(int(lon)))
        y = '%s%02d' % ('N' if lat >= 0 else 'S', abs(int(lat)))

        srtm_downloader = Downloader.from_config(('SRTM', 'SRTM3'))
        params = {'config': config, 'x': x, 'y': y}

        # If the URL doesn't exist then we are over sea/north/south of the
        # limits of the SRTM data and we return None.
        if srtm_downloader.url(params) is None:
            return None
        else:
            return self.downloader.path(params)
开发者ID:ajdawson,项目名称:cartopy,代码行数:24,代码来源:srtm.py

示例9: srtm_fname

# 需要导入模块: from cartopy.io import Downloader [as 别名]
# 或者: from cartopy.io.Downloader import from_config [as 别名]
    def srtm_fname(self, lon, lat):
        """
        Return the filename for the given lon/lat SRTM tile (downloading if
        necessary), or None if no such tile exists (i.e. the tile would be
        entirely over water, or out of latitude range).

        """
        if int(lon) != lon or int(lat) != lat:
            raise ValueError("Integer longitude/latitude values required.")

        x = "%s%03d" % ("E" if lon >= 0 else "W", abs(int(lon)))
        y = "%s%02d" % ("N" if lat >= 0 else "S", abs(int(lat)))

        srtm_downloader = Downloader.from_config(("SRTM", "SRTM" + str(self._resolution)))
        params = {"config": config, "resolution": self._resolution, "x": x, "y": y}

        # If the URL doesn't exist then we are over sea/north/south of the
        # limits of the SRTM data and we return None.
        if srtm_downloader.url(params) is None:
            return None
        else:
            return self.downloader.path(params)
开发者ID:SciTools,项目名称:cartopy,代码行数:24,代码来源:srtm.py

示例10: SRTM3_retrieve

# 需要导入模块: from cartopy.io import Downloader [as 别名]
# 或者: from cartopy.io.Downloader import from_config [as 别名]
def SRTM3_retrieve(lon, lat):
    x = '%s%03d' % ('E' if lon > 0 else 'W', abs(int(lon)))
    y = '%s%02d' % ('N' if lat > 0 else 'S', abs(int(lat)))

    srtm_downloader = Downloader.from_config(('SRTM', 'SRTM3'))
    return srtm_downloader.path({'config': config, 'x': x, 'y': y})
开发者ID:rockdoc,项目名称:cartopy,代码行数:8,代码来源:srtm.py


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