Files
mkdocs/doc/meshkernelpy/api/meshkernel.utils.md
T
2026-10-10 21:56:35 +08:00

57 lines
1.8 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 辅助函数
模块:`meshkernel.utils`。本页依据本地 MeshKernelPy `8.3.0` 源码生成,包含该模块定义的类、方法、函数和常量。签名及参数默认值以源码为准;原文未提供的说明会明确标记。
[返回 API 总览](modules.md)
## `to_contiguous_numpy_array` {#to-contiguous-numpy-array}
```python
to_contiguous_numpy_array(vec) -> np.ndarray
```
在将输入向量传给 MeshKernel C API 函数前,确保其内存连续, 适用于通过切片操作创建的向量。
**参数**
| 名称 | 类型 | 默认值 | 中文说明 |
| --- | --- | --- | --- |
| `vec` | `np.ndarray` | `必填` | 输入向量。 |
**返回值**
内存连续的向量。
**异常**
- **`TypeError`**:`vec` 不是 NumPy 数组时抛出。
## `plot_edges` {#plot-edges}
```python
plot_edges(node_x, node_y, edge_nodes, ax, *args, **kwargs)
```
在指定坐标轴上绘制网格边。 `args` 和 `kwargs` 将作为 `plot` 方法的参数传入。
**参数**
| 名称 | 类型 | 默认值 | 中文说明 |
| --- | --- | --- | --- |
| `node_x` | `ndarray` | `必填` | 描述节点 x 坐标的一维双精度数组。 |
| `node_y` | `ndarray` | `必填` | 描述节点 y 坐标的一维双精度数组。 |
| `edge_nodes` | `ndarray` | `必填` | 描述每条二维网格边端点节点的一维整数数组。 |
| `ax` | `matplotlib.axes.Axes` | `必填` | 绘制网格边所用的坐标轴对象。 |
| `args` | `未标注` | `不适用` | 可变位置参数。源码未单独提供参数说明。 |
| `kwargs` | `未标注` | `不适用` | 可变关键字参数。源码未单独提供参数说明。 |
## `get_maximum_bounding_box_coordinates` {#get-maximum-bounding-box-coordinates}
```python
get_maximum_bounding_box_coordinates()
```
获取浮点坐标定义的边界框可用的最大坐标范围。