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


Python EarthLocation._get_site_registry方法代码示例

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


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

示例1: check_builtin_matches_remote

# 需要导入模块: from astropy.coordinates import EarthLocation [as 别名]
# 或者: from astropy.coordinates.EarthLocation import _get_site_registry [as 别名]
def check_builtin_matches_remote(download_url=True):
    """
    This function checks that the builtin sites registry is consistent with the
    remote registry (or a registry at some other location).

    Note that current this is *not* run by the testing suite (because it
    doesn't start with "test", and is instead meant to be used as a check
    before merging changes in astropy-data)
    """
    builtin_registry = EarthLocation._get_site_registry(force_builtin=True)
    dl_registry = EarthLocation._get_site_registry(force_download=download_url)

    in_dl = {}
    matches = {}
    for name in builtin_registry.names:
        in_dl[name] = name in dl_registry
        if in_dl[name]:
            matches[name] = quantity_allclose(builtin_registry[name], dl_registry[name])
        else:
            matches[name] = False

    if not all(matches.values()):
        # this makes sure we actually see which don't match
        print("In builtin registry but not in download:")
        for name in in_dl:
            if not in_dl[name]:
                print('    ', name)
        print("In both but not the same value:")
        for name in matches:
            if not matches[name] and in_dl[name]:
                print('    ', name, 'builtin:', builtin_registry[name], 'download:', dl_registry[name])
        assert False, "Builtin and download registry aren't consistent - failures printed to stdout"
开发者ID:Cadair,项目名称:astropy,代码行数:34,代码来源:test_sites.py

示例2: test_EarthLocation_state_online

# 需要导入模块: from astropy.coordinates import EarthLocation [as 别名]
# 或者: from astropy.coordinates.EarthLocation import _get_site_registry [as 别名]
def test_EarthLocation_state_online():
    EarthLocation._site_registry = None
    EarthLocation._get_site_registry(force_download=True)
    assert EarthLocation._site_registry is not None

    oldreg = EarthLocation._site_registry
    newreg = EarthLocation._get_site_registry()
    assert oldreg is newreg
    newreg = EarthLocation._get_site_registry(force_download=True)
    assert oldreg is not newreg
开发者ID:Cadair,项目名称:astropy,代码行数:12,代码来源:test_sites.py


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