PillarGrid¶
- class petres.grids.PillarGrid[source]¶
Bases:
objectRepresent a structured pillar-based grid with lateral i-j topology.
- Parameters:
pillar_top (numpy.ndarray) – Top endpoints of each pillar with shape
(nj+1, ni+1, 3).pillar_bottom (numpy.ndarray) – Bottom endpoints of each pillar with shape
(nj+1, ni+1, 3).
Notes
Each pillar is interpreted as a straight segment between corresponding top and bottom points. The i-j topology is inferred from array dimensions.
Initialize a pillar grid from pillar endpoint arrays.
- Raises:
ValueError – If endpoint arrays do not satisfy shape requirements validated in
__post_init__().
- __init__(pillar_top, pillar_bottom)[source]¶
Initialize a pillar grid from pillar endpoint arrays.
- Raises:
ValueError – If endpoint arrays do not satisfy shape requirements validated in
__post_init__().
- __post_init__()[source]¶
Validate pillar array dimensionality and consistency.
- Raises:
ValueError – If top and bottom arrays have different shapes, or if their shape is not compatible with
(nj+1, ni+1, 3).
- property niv: int¶
Return the number of pillar vertices in the i direction.
- Returns:
Number of pillar vertices along i.
- Return type:
- property njv: int¶
Return the number of pillar vertices in the j direction.
- Returns:
Number of pillar vertices along j.
- Return type:
- property ni: int¶
Return the number of cells in the i direction.
- Returns:
Number of cells along i.
- Return type:
- property nj: int¶
Return the number of cells in the j direction.
- Returns:
Number of cells along j.
- Return type:
- to_eclipse_coord()[source]¶
Convert pillar endpoints to Eclipse COORD layout.
- Returns:
Array with shape
(nj+1, ni+1, 6)where the last dimension is(x_top, y_top, z_top, x_bottom, y_bottom, z_bottom).- Return type:
- classmethod from_eclipse_coord(coord)[source]¶
Create PillarGrid from Eclipse COORD array.
- Parameters:
coord (numpy.ndarray) – COORD array storing pillar top and bottom points as
(x_top, y_top, z_top, x_bottom, y_bottom, z_bottom)with shape(nj+1, ni+1, 6).- Returns:
New pillar grid initialized from COORD data.
- Return type:
- Raises:
ValueError – If
coordis not a 3D array with trailing dimension length 6.
Examples
>>> coord = np.zeros((3, 4, 6), dtype=float) >>> grid = PillarGrid.from_eclipse_coord(coord) >>> grid.vertex_shape (3, 4)
- classmethod from_rectilinear(*, x, y, top=0.0, base=1.0)[source]¶
Create vertical pillars from rectilinear x and y vertex vectors.
- Parameters:
x (numpy.ndarray) – One-dimensional x-vertex coordinates with shape
(ni+1,).y (numpy.ndarray) – One-dimensional y-vertex coordinates with shape
(nj+1,).top (float) – Constant top value used for all pillar tops.
base (float) – Constant base value used for all pillar bases. Must be larger than
top.
- Returns:
Vertical pillar grid whose top and bottom endpoints are defined by the provided constant z-values.
- Return type:
- Raises:
ValueError – If vertex arrays are invalid or if
base <= top.
Notes
This constructor creates a vertical pillar envelope. It does not define layer geometry or per-corner depth values.
- classmethod from_regular(*, xlim=None, ylim=None, ni=None, nj=None, dx=None, dy=None, top=0.0, base=1.0)[source]¶
Construct a vertical pillar grid from bounding box and resolution.
- Parameters:
xlim (Sequence[float] or None, default None) – Two-value x-limits for grid generation.
ylim (Sequence[float] or None, default None) – Two-value y-limits for grid generation.
ni (int or None, default None) – Number of cells along i when explicit counts are used.
nj (int or None, default None) – Number of cells along j when explicit counts are used.
dx (float or None, default None) – Cell size along x when spacing-based resolution is used.
dy (float or None, default None) – Cell size along y when spacing-based resolution is used.
top (float, default 0.0, 1.0) – Constant pillar end depths.
base (float, default 0.0, 1.0) – Constant pillar end depths.
- Returns:
Grid with vertical pillars spanning the limits.
- Return type:
- Raises:
ValueError – If the provided limit/resolution combination is inconsistent, such as missing required limit values or invalid count/spacing pairs.
Notes
Vertex vectors are resolved by
_resolve_xy_verticesand then passed tofrom_rectilinear().Examples
>>> grid = PillarGrid.from_regular( ... xlim=(0.0, 1000.0), ylim=(0.0, 500.0), ni=10, nj=5 ... ) >>> grid.cell_shape (5, 10)
- show(*, title=None, color='black', line_width=6.0, z_scale=1.0, **kwargs)[source]¶
Render the pillar grid in the 3D PyVista viewer.
- Parameters:
title (str or None, default=None) – Optional figure title.
color (Any, default="black") – Color used for the pillar lines and direction arrows.
line_width (float, default=6.0) – Width used for the rendered pillar lines.
z_scale (float, default 1.0) – Scale factor for the z-axis.
**kwargs (Any) – Forwarded to the viewer’s pillar layer renderer.
- Returns:
Opens an interactive 3D rendering window.
- Return type:
None