Skip to content

Commit 341a9ae

Browse files
committed
[ENH] Making sure that compute_model_at only computes the custom grid
1 parent 4fc3bf1 commit 341a9ae

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

gempy/API/compute_API.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,11 +82,14 @@ def compute_model_at(gempy_model: GeoModel, at: np.ndarray,
8282
Returns:
8383
np.ndarray: The computed geological model at the specified coordinates.
8484
"""
85+
86+
print("WARNING: This function sets a custom grid and computes the model so be wary of side effects.")
8587
set_custom_grid(
8688
grid=gempy_model.grid,
87-
xyz_coord=at
89+
xyz_coord=at,
90+
reset=True
8891
)
89-
92+
9093
sol = compute_model(gempy_model, engine_config, validate_serialization=True)
9194
return sol.raw_arrays.custom
9295

gempy/API/grid_API.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,11 +88,11 @@ def set_topography_from_file(grid: Grid, filepath: str, crop_to_extent: Union[Se
8888
return set_topography_from_subsurface_structured_grid(grid, struct)
8989

9090

91-
def set_custom_grid(grid: Grid, xyz_coord: np.ndarray):
91+
def set_custom_grid(grid: Grid, xyz_coord: np.ndarray, reset: bool = False):
9292
custom_grid = CustomGrid(values=xyz_coord)
9393
grid.custom_grid = custom_grid
9494

95-
set_active_grid(grid, [Grid.GridTypes.CUSTOM])
95+
set_active_grid(grid, grid_type=[Grid.GridTypes.CUSTOM], reset=reset)
9696
return grid.custom_grid
9797

9898

0 commit comments

Comments
 (0)