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


Python io.Downloader类代码示例

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


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

示例1: __init__

 def __init__(self,
              url_template=_NE_URL_TEMPLATE,
              target_path_template=None,
              pre_downloaded_path_template='',
              ):
     # adds some NE defaults to the __init__ of a Downloader
     Downloader.__init__(self, url_template,
                         target_path_template,
                         pre_downloaded_path_template)
开发者ID:RachelNorth,项目名称:cartopy,代码行数:9,代码来源:shapereader.py

示例2: __init__

 def __init__(self,
              target_path_template,
              pre_downloaded_path_template='',
              ):
     # adds some SRTM3 defaults to the __init__ of a Downloader
     # namely, the URl is determined on the fly using the
     # ``SRTM3Downloader._SRTM3_LOOKUP_URL`` dictionary
     Downloader.__init__(self, None,
                         target_path_template,
                         pre_downloaded_path_template)
开发者ID:ajdawson,项目名称:cartopy,代码行数:10,代码来源:srtm.py

示例3: __init__

 def __init__(self, target_path_template, pre_downloaded_path_template=""):
     # adds some SRTM defaults to the __init__ of a Downloader
     # namely, the URL is determined on the fly using the
     # ``SRTMDownloader._SRTM_LOOKUP_MASK`` array
     Downloader.__init__(self, None, target_path_template, pre_downloaded_path_template)
     warnings.warn(
         "SRTM requires an account set up and log in to access."
         "use of this class is likely to fail with"
         " HTTP 401 errors."
     )
开发者ID:SciTools,项目名称:cartopy,代码行数:10,代码来源:srtm.py

示例4: natural_earth

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,代码行数:27,代码来源:shapereader.py

示例5: gshhs

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,代码行数:12,代码来源:shapereader.py

示例6: gshhs

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,代码行数:13,代码来源:shapereader.py

示例7: natural_earth

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,代码行数:14,代码来源:shapereader.py

示例8: SRTM3_retrieve

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,代码行数:17,代码来源:srtm.py

示例9: srtm_fname

    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,代码行数:22,代码来源:srtm.py

示例10: srtm_fname

    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,代码行数:22,代码来源:srtm.py

示例11: SRTM3_retrieve

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,代码行数:6,代码来源:srtm.py


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