Skip to content

Commit e48ee94

Browse files
committed
updated GCI checkes
1 parent d4c8fe0 commit e48ee94

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

mhkit/river/io/d3d.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1073,6 +1073,19 @@ def calculate_grid_convergence_index(
10731073
gci: float
10741074
Grid Convergence Index (GCI).
10751075
"""
1076+
1077+
# Validate inputs
1078+
if not (np.issubdtype(type(refinement_ratio), np.number)):
1079+
raise TypeError("refinement_ratio must be a numeric values")
1080+
if not (np.issubdtype(type(factor_of_safety), np.number)):
1081+
raise TypeError("factor_of_safety must be a numeric values")
1082+
if not (np.issubdtype(type(order), np.number)):
1083+
raise TypeError("order must be a numeric values")
1084+
if not (np.issubdtype(fine_grid.dtype, np.number) and np.issubdtype(coarse_grid.dtype, np.number)):
1085+
raise TypeError("fine_grid and coarse_grid must contain numeric values")
1086+
if fine_grid.shape != coarse_grid.shape:
1087+
raise ValueError("fine_grid and coarse_grid must have the same shape")
1088+
10761089
# Calculate the approximate relative error
10771090
error = np.abs((fine_grid - coarse_grid) / fine_grid)
10781091

0 commit comments

Comments
 (0)