Skip to content

Commit 8425ac4

Browse files
committed
[ENH] Add validation for CenteredGrid attributes
Introduced `numpy_array_short_validator` to ensure proper validation for `centers`, `resolution`, and `radius` attributes in the `CenteredGrid` class. This enhances data integrity and enforces stricter input checks.
1 parent 484e07a commit 8425ac4

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

gempy_engine/core/data/centered_grid.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
from typing import Sequence, Union, Annotated
33

44
import numpy as np
5-
5+
from .encoders.converters import numpy_array_short_validator
66

77
@dataclass
88
class CenteredGrid:
9-
centers: np.ndarray #: This is just used to calculate xyz to interpolate. Tz is independent
10-
resolution: Sequence[float] | np.ndarray
11-
radius: float | Sequence[float] | np.ndarray
9+
centers: Annotated[np.ndarray, numpy_array_short_validator] #: This is just used to calculate xyz to interpolate. Tz is independent
10+
resolution: Annotated[np.ndarray, numpy_array_short_validator]
11+
radius: float | Annotated[np.ndarray, numpy_array_short_validator]
1212

1313
kernel_grid_centers: np.ndarray = field(init=False)
1414
left_voxel_edges: np.ndarray = field(init=False)

0 commit comments

Comments
 (0)