本文整理汇总了Python中landlab.field.graph_field.GraphFields.field_values方法的典型用法代码示例。如果您正苦于以下问题:Python GraphFields.field_values方法的具体用法?Python GraphFields.field_values怎么用?Python GraphFields.field_values使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类landlab.field.graph_field.GraphFields
的用法示例。
在下文中一共展示了GraphFields.field_values方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_add_ones
# 需要导入模块: from landlab.field.graph_field import GraphFields [as 别名]
# 或者: from landlab.field.graph_field.GraphFields import field_values [as 别名]
def test_add_ones():
fields = ModelDataFields()
fields.new_field_location('node', 12)
fields.new_field_location('cell', 2)
fields.add_ones('z', at='node')
assert_array_equal(np.ones(12), fields['node']['z'])
assert_array_equal(np.ones(12), fields.field_values('node', 'z'))
fields.add_ones('z', at='cell')
assert_array_equal(np.ones(2), fields['cell']['z'])
assert_array_equal(np.ones(2), fields.field_values('cell', 'z'))
示例2: test_add_ones_return_value
# 需要导入模块: from landlab.field.graph_field import GraphFields [as 别名]
# 或者: from landlab.field.graph_field.GraphFields import field_values [as 别名]
def test_add_ones_return_value():
fields = ModelDataFields()
fields.new_field_location('node', 12)
fields.new_field_location('cell', 2)
rtn_value = fields.add_ones('z', at='node')
assert_array_equal(rtn_value, np.ones(12))
assert_is(rtn_value, fields['node']['z'])
assert_is(rtn_value, fields.field_values('node', 'z'))
rtn_value = fields.add_ones('z', at='cell')
assert_array_equal(rtn_value, np.ones(2))
assert_is(rtn_value, fields['cell']['z'])
assert_is(rtn_value, fields.field_values('cell', 'z'))
示例3: test_add_ones_return_value
# 需要导入模块: from landlab.field.graph_field import GraphFields [as 别名]
# 或者: from landlab.field.graph_field.GraphFields import field_values [as 别名]
def test_add_ones_return_value():
fields = ModelDataFields()
fields.new_field_location("node", 12)
fields.new_field_location("cell", 2)
rtn_value = fields.add_ones("z", at="node")
assert_array_equal(rtn_value, np.ones(12))
assert rtn_value is fields["node"]["z"]
assert rtn_value is fields.field_values("node", "z")
rtn_value = fields.add_ones("z", at="cell")
assert_array_equal(rtn_value, np.ones(2))
assert rtn_value is fields["cell"]["z"]
assert rtn_value is fields.field_values("cell", "z")