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


Python GraphFields.at_all_over_the_place['const']方法代码示例

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


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

示例1: test_scalar_field

# 需要导入模块: from landlab.field.graph_field import GraphFields [as 别名]
# 或者: from landlab.field.graph_field.GraphFields import at_all_over_the_place['const'] [as 别名]
def test_scalar_field():
    """Test adding a generic scalar field."""
    fields = ModelDataFields()
    fields.new_field_location('all_over_the_place', 1)

    assert_dict_equal(dict(), fields.at_all_over_the_place)
    assert_raises(AttributeError, lambda: fields.at_cell)

    fields.at_all_over_the_place['const'] = 1.
    assert_array_equal(np.array(1.), fields.at_all_over_the_place['const'])
    
    val = np.array(2.)
    fields.at_all_over_the_place['const'] = val
    assert_is(val, fields.at_all_over_the_place['const'])
开发者ID:Carralex,项目名称:landlab,代码行数:16,代码来源:test_graph_fields.py

示例2: test_scalar_field

# 需要导入模块: from landlab.field.graph_field import GraphFields [as 别名]
# 或者: from landlab.field.graph_field.GraphFields import at_all_over_the_place['const'] [as 别名]
def test_scalar_field():
    """Test adding a generic scalar field."""
    fields = ModelDataFields()
    fields.new_field_location('all_over_the_place', 1)

    assert dict() == fields.at_all_over_the_place
    with pytest.raises(AttributeError):
        fields.at_cell

    fields.at_all_over_the_place['const'] = 1.
    assert_array_equal(np.array(1.), fields.at_all_over_the_place['const'])
    
    val = np.array(2.)
    fields.at_all_over_the_place['const'] = val
    assert val is fields.at_all_over_the_place['const']
开发者ID:Glader011235,项目名称:Landlab,代码行数:17,代码来源:test_graph_fields.py


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