Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion simpeg_drivers/joint/joint_surveys/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class JointSurveysOptions(BaseJointOptions):
def all_groups_same_physical_property(self):
physical_properties = [k.options["physical_property"] for k in self.groups]
if len(list(set(physical_properties))) > 1:
raise GeoAppsError(
raise ValueError(
"All physical properties must be the same. "
f"Provided SimPEG groups for {physical_properties}."
)
Expand Down
8 changes: 4 additions & 4 deletions simpeg_drivers/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ class ActiveCellsOptions(BaseModel):
@classmethod
def at_least_one(cls, data):
if all(v is None for v in data.values()):
raise GeoAppsError("Must provide either topography or active model.")
raise ValueError("Must provide either topography or active model.")
return data

@model_serializer(mode="wrap")
Expand Down Expand Up @@ -208,7 +208,7 @@ def _component_name(self, component: str) -> str:
@classmethod
def mesh_cannot_be_rotated(cls, value: Octree):
if isinstance(value, Octree) and value.rotation not in [0.0, None]:
raise GeoAppsError(
raise ValueError(
"Rotated meshes are not supported. Please use a mesh with an angle of 0.0."
)
return value
Expand Down Expand Up @@ -491,13 +491,13 @@ class LineSelectionOptions(BaseModel):
@classmethod
def validate_cell_association(cls, value):
if value.association is not DataAssociationEnum.CELL:
raise GeoAppsError("Line identifier must be associated with cells.")
raise ValueError("Line identifier must be associated with cells.")
return value

@model_validator(mode="after")
def line_id_referenced(self):
if self.line_id not in self.line_object.values:
raise GeoAppsError("Line id isn't referenced in the line object.")
raise ValueError("Line id isn't referenced in the line object.")
return self


Expand Down
25 changes: 25 additions & 0 deletions tests/validations_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
# Copyright (c) 2025 Mira Geoscience Ltd. '
# '
# This file is part of simpeg-drivers package. '
# '
# simpeg-drivers is distributed under the terms and conditions of the MIT License '
# (see LICENSE file at the root of this source code package). '
# '
# '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

import pytest
from geoapps_utils.utils.importing import GeoAppsError
from geoh5py import Workspace

from simpeg_drivers.options import CoreOptions


def test_topo_or_active_validation(tmp_path):
with Workspace(tmp_path / "test.geoh5") as workspace:
data = {
"geoh5": workspace,
"inversion_type": "mvi",
}
with pytest.raises(GeoAppsError, match="active_cells: Value error, Must"):
CoreOptions.build(data)