test_Region_cls.py 文件源码

python
阅读 21 收藏 0 点赞 0 评论 0

项目:regionmask 作者: mathause 项目源码 文件源码
def test_polygon_input():

    # polygon closes open paths
    outl1 = ((0, 0), (0, 1), (1, 1.), (1, 0), (0, 0))
    outl2 = ((1, 1), (1, 2), (2, 2.), (2, 1), (1, 1))
    nan = np.ones(shape=(1, 2)) * np.nan
    outl = np.vstack((outl1, nan, outl2))

    outl_poly = MultiPolygon([Polygon(outl1), Polygon(outl2)])

    r = Region_cls(1, 'Unit Square', 'USq', outl_poly)

    assert np.allclose(r.coords, outl, equal_nan=True)
    assert r.polygon == outl_poly
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号