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


Python SpillContainer.get_spill_mask方法代码示例

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


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

示例1: test_get_spill_mask

# 需要导入模块: from gnome.spill_container import SpillContainer [as 别名]
# 或者: from gnome.spill_container.SpillContainer import get_spill_mask [as 别名]
def test_get_spill_mask():
    """
    Simple tests for get_spill_mask
    """

    start_time0 = datetime(2012, 1, 1, 12)
    start_time1 = datetime(2012, 1, 2, 12)
    start_time2 = start_time1 + timedelta(hours=1)
    start_position = (23.0, -78.5, 0.0)
    num_elements = 5
    sc = SpillContainer()
    sp0 = PointLineSource(num_elements, start_position,
                                    start_time0)

    sp1 = PointLineSource(num_elements, start_position,
                                    start_time1,
                                    end_position=(start_position[0]
                                    + 0.2, start_position[1] + 0.2,
                                    0.0), end_release_time=start_time1
                                    + timedelta(hours=3))

    sp2 = PointLineSource(num_elements, start_position,
                                    start_time2)

    sc.spills += [sp0, sp1, sp2]

    # as we move forward in time, the spills will release LEs in an
    # expected way

    sc.prepare_for_model_run(windage_at)
    sc.release_elements(100, start_time0)
    sc.release_elements(100, start_time0 + timedelta(hours=24))
    sc.release_elements(100, start_time1 + timedelta(hours=1))
    sc.release_elements(100, start_time1 + timedelta(hours=3))

    assert all(sc['spill_num'][sc.get_spill_mask(sp2)] == 2)
    assert all(sc['spill_num'][sc.get_spill_mask(sp0)] == 0)
    assert all(sc['spill_num'][sc.get_spill_mask(sp1)] == 1)
开发者ID:JamesMakela,项目名称:GNOME2,代码行数:40,代码来源:test_spill_container.py


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