本文整理汇总了Python中landlab.HexModelGrid.from_dict方法的典型用法代码示例。如果您正苦于以下问题:Python HexModelGrid.from_dict方法的具体用法?Python HexModelGrid.from_dict怎么用?Python HexModelGrid.from_dict使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类landlab.HexModelGrid
的用法示例。
在下文中一共展示了HexModelGrid.from_dict方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_hex_from_dict
# 需要导入模块: from landlab import HexModelGrid [as 别名]
# 或者: from landlab.HexModelGrid import from_dict [as 别名]
def test_hex_from_dict():
params = {
"base_num_rows": 5,
"base_num_cols": 4,
"dx": 2.0,
"xy_of_lower_left": (35, 55),
"axis_name": ("spam", "eggs"),
"axis_units": ("smoot", "parsec"),
"xy_of_reference": (12345, 678910),
}
mg = HexModelGrid.from_dict(params)
# assert things.
true_x_node = np.array(
[
37.0,
39.0,
41.0,
43.0,
36.0,
38.0,
40.0,
42.0,
44.0,
35.0,
37.0,
39.0,
41.0,
43.0,
45.0,
36.0,
38.0,
40.0,
42.0,
44.0,
37.0,
39.0,
41.0,
43.0,
]
)
assert_array_equal(true_x_node, mg.x_of_node)
assert (mg.x_of_node.min(), mg.y_of_node.min()) == (35, 55)
assert mg.axis_units == ("smoot", "parsec")
assert mg.axis_name == ("spam", "eggs")
assert mg.xy_of_reference == (12345, 678910)