diff --git a/simpeg_drivers-assets/uijson/direct_current_2d_forward.ui.json b/simpeg_drivers-assets/uijson/direct_current_2d_forward.ui.json index 68b53525..121b959e 100644 --- a/simpeg_drivers-assets/uijson/direct_current_2d_forward.ui.json +++ b/simpeg_drivers-assets/uijson/direct_current_2d_forward.ui.json @@ -17,13 +17,6 @@ "meshType": "{275ecee9-9c24-4378-bf94-65f3c5fbe163}", "value": "" }, - "z_from_topo": { - "group": "Survey", - "main": true, - "label": "Surface survey", - "tooltip": "Uncheck if borehole data is present", - "value": true - }, "line_object": { "association": "Cell", "dataType": "Referenced", diff --git a/simpeg_drivers-assets/uijson/direct_current_2d_inversion.ui.json b/simpeg_drivers-assets/uijson/direct_current_2d_inversion.ui.json index 54038081..97f6c6fc 100644 --- a/simpeg_drivers-assets/uijson/direct_current_2d_inversion.ui.json +++ b/simpeg_drivers-assets/uijson/direct_current_2d_inversion.ui.json @@ -17,13 +17,6 @@ "meshType": "{275ecee9-9c24-4378-bf94-65f3c5fbe163}", "value": "" }, - "z_from_topo": { - "group": "Data", - "main": true, - "label": "Surface survey", - "tooltip": "Uncheck if borehole data is present", - "value": true - }, "line_object": { "association": "Cell", "dataType": "Referenced", diff --git a/simpeg_drivers-assets/uijson/direct_current_3d_forward.ui.json b/simpeg_drivers-assets/uijson/direct_current_3d_forward.ui.json index db1b3add..bd0bc3a6 100644 --- a/simpeg_drivers-assets/uijson/direct_current_3d_forward.ui.json +++ b/simpeg_drivers-assets/uijson/direct_current_3d_forward.ui.json @@ -17,13 +17,6 @@ "meshType": "{275ecee9-9c24-4378-bf94-65f3c5fbe163}", "value": "" }, - "z_from_topo": { - "group": "Survey", - "main": true, - "label": "Surface survey", - "tooltip": "Uncheck if borehole data is present", - "value": true - }, "potential_channel_bool": true, "mesh": { "group": "Mesh and models", diff --git a/simpeg_drivers-assets/uijson/direct_current_3d_inversion.ui.json b/simpeg_drivers-assets/uijson/direct_current_3d_inversion.ui.json index 714fb530..5ba10bda 100644 --- a/simpeg_drivers-assets/uijson/direct_current_3d_inversion.ui.json +++ b/simpeg_drivers-assets/uijson/direct_current_3d_inversion.ui.json @@ -17,13 +17,6 @@ "meshType": "{275ecee9-9c24-4378-bf94-65f3c5fbe163}", "value": "" }, - "z_from_topo": { - "group": "Data", - "main": true, - "label": "Surface survey", - "tooltip": "Uncheck if borehole data is present", - "value": true - }, "potential_channel": { "association": [ "Cell", diff --git a/simpeg_drivers-assets/uijson/direct_current_batch2d_forward.ui.json b/simpeg_drivers-assets/uijson/direct_current_batch2d_forward.ui.json index b24bcdeb..494eba23 100644 --- a/simpeg_drivers-assets/uijson/direct_current_batch2d_forward.ui.json +++ b/simpeg_drivers-assets/uijson/direct_current_batch2d_forward.ui.json @@ -27,14 +27,6 @@ "value": "", "tooltip": "Selects the data representing the different lines in the survey." }, - "z_from_topo": { - "group": "Data pre-processing", - "label": "Take z from topography", - "tooltip": "Sets survey elevation to topography before any offsets are applied.", - "value": false, - "verbose": 3, - "visible": false - }, "potential_channel_bool": true, "u_cell_size": { "min": 0.0, diff --git a/simpeg_drivers-assets/uijson/direct_current_batch2d_inversion.ui.json b/simpeg_drivers-assets/uijson/direct_current_batch2d_inversion.ui.json index 5a8be970..c095e5be 100644 --- a/simpeg_drivers-assets/uijson/direct_current_batch2d_inversion.ui.json +++ b/simpeg_drivers-assets/uijson/direct_current_batch2d_inversion.ui.json @@ -27,14 +27,6 @@ "value": "", "tooltip": "Selects the data representing the different lines in the survey." }, - "z_from_topo": { - "group": "Data pre-processing", - "label": "Take z from topography", - "tooltip": "Sets survey elevation to topography before any offsets are applied.", - "value": false, - "verbose": 3, - "visible": false - }, "potential_channel": { "association": "Cell", "dataType": "Float", diff --git a/simpeg_drivers-assets/uijson/induced_polarization_2d_forward.ui.json b/simpeg_drivers-assets/uijson/induced_polarization_2d_forward.ui.json index 452cc987..b1bef415 100644 --- a/simpeg_drivers-assets/uijson/induced_polarization_2d_forward.ui.json +++ b/simpeg_drivers-assets/uijson/induced_polarization_2d_forward.ui.json @@ -17,13 +17,6 @@ "meshType": "{275ecee9-9c24-4378-bf94-65f3c5fbe163}", "value": "" }, - "z_from_topo": { - "group": "Survey", - "main": true, - "label": "Surface survey", - "tooltip": "Uncheck if borehole data is present", - "value": true - }, "line_object": { "association": "Cell", "dataType": "Referenced", diff --git a/simpeg_drivers-assets/uijson/induced_polarization_2d_inversion.ui.json b/simpeg_drivers-assets/uijson/induced_polarization_2d_inversion.ui.json index 7732a52c..eb0313f7 100644 --- a/simpeg_drivers-assets/uijson/induced_polarization_2d_inversion.ui.json +++ b/simpeg_drivers-assets/uijson/induced_polarization_2d_inversion.ui.json @@ -17,13 +17,6 @@ "meshType": "{275ecee9-9c24-4378-bf94-65f3c5fbe163}", "value": "" }, - "z_from_topo": { - "group": "Data", - "main": true, - "label": "Surface survey", - "tooltip": "Uncheck if borehole data is present", - "value": true - }, "line_object": { "association": "Cell", "dataType": "Referenced", diff --git a/simpeg_drivers-assets/uijson/induced_polarization_3d_forward.ui.json b/simpeg_drivers-assets/uijson/induced_polarization_3d_forward.ui.json index dfaa0161..edea4436 100644 --- a/simpeg_drivers-assets/uijson/induced_polarization_3d_forward.ui.json +++ b/simpeg_drivers-assets/uijson/induced_polarization_3d_forward.ui.json @@ -17,13 +17,6 @@ "meshType": "{275ecee9-9c24-4378-bf94-65f3c5fbe163}", "value": "" }, - "z_from_topo": { - "group": "Survey", - "main": true, - "label": "Surface survey", - "tooltip": "Uncheck if borehole data is present", - "value": true - }, "receivers_radar_drape": { "association": [ "Cell", diff --git a/simpeg_drivers-assets/uijson/induced_polarization_3d_inversion.ui.json b/simpeg_drivers-assets/uijson/induced_polarization_3d_inversion.ui.json index 683e53a4..1e5a55b1 100644 --- a/simpeg_drivers-assets/uijson/induced_polarization_3d_inversion.ui.json +++ b/simpeg_drivers-assets/uijson/induced_polarization_3d_inversion.ui.json @@ -17,13 +17,6 @@ "meshType": "{275ecee9-9c24-4378-bf94-65f3c5fbe163}", "value": "" }, - "z_from_topo": { - "group": "Data", - "main": true, - "label": "Surface survey", - "tooltip": "Uncheck if borehole data is present", - "value": true - }, "receivers_radar_drape": { "association": [ "Cell", diff --git a/simpeg_drivers-assets/uijson/induced_polarization_batch2d_forward.ui.json b/simpeg_drivers-assets/uijson/induced_polarization_batch2d_forward.ui.json index 2be60dd2..6944322e 100644 --- a/simpeg_drivers-assets/uijson/induced_polarization_batch2d_forward.ui.json +++ b/simpeg_drivers-assets/uijson/induced_polarization_batch2d_forward.ui.json @@ -27,14 +27,6 @@ "value": "", "tooltip": "Selects the data representing the different lines in the survey." }, - "z_from_topo": { - "group": "Data pre-processing", - "label": "Take z from topography", - "tooltip": "Sets survey elevation to topography before any offsets are applied.", - "value": false, - "verbose": 3, - "visible": false - }, "receivers_radar_drape": { "association": [ "Cell", diff --git a/simpeg_drivers-assets/uijson/induced_polarization_batch2d_inversion.ui.json b/simpeg_drivers-assets/uijson/induced_polarization_batch2d_inversion.ui.json index cb0ffbde..94e27c4d 100644 --- a/simpeg_drivers-assets/uijson/induced_polarization_batch2d_inversion.ui.json +++ b/simpeg_drivers-assets/uijson/induced_polarization_batch2d_inversion.ui.json @@ -27,14 +27,6 @@ "value": "", "tooltip": "Selects the data representing the different lines in the survey." }, - "z_from_topo": { - "group": "Data pre-processing", - "label": "Take z from topography", - "tooltip": "Sets survey elevation to topography before any offsets are applied.", - "value": false, - "verbose": 3, - "visible": false - }, "receivers_radar_drape": { "association": [ "Cell", diff --git a/simpeg_drivers-assets/uijson/magnetotellurics_forward.ui.json b/simpeg_drivers-assets/uijson/magnetotellurics_forward.ui.json index 30e67a1a..06ad1317 100644 --- a/simpeg_drivers-assets/uijson/magnetotellurics_forward.ui.json +++ b/simpeg_drivers-assets/uijson/magnetotellurics_forward.ui.json @@ -17,14 +17,6 @@ "meshType": "{b99bd6e5-4fe1-45a5-bd2f-75fc31f91b38}", "value": "" }, - "z_from_topo": { - "group": "Data pre-processing", - "label": "Take z from topography", - "tooltip": "Sets survey elevation to topography before any offsets are applied.", - "value": false, - "verbose": 3, - "visible": false - }, "receivers_radar_drape": { "association": [ "Cell", diff --git a/simpeg_drivers-assets/uijson/magnetotellurics_inversion.ui.json b/simpeg_drivers-assets/uijson/magnetotellurics_inversion.ui.json index f4ee373a..05b124c9 100644 --- a/simpeg_drivers-assets/uijson/magnetotellurics_inversion.ui.json +++ b/simpeg_drivers-assets/uijson/magnetotellurics_inversion.ui.json @@ -17,14 +17,6 @@ "meshType": "{b99bd6e5-4fe1-45a5-bd2f-75fc31f91b38}", "value": "" }, - "z_from_topo": { - "group": "Data pre-processing", - "label": "Take z from topography", - "tooltip": "Sets survey elevation to topography before any offsets are applied.", - "value": false, - "verbose": 3, - "visible": false - }, "receivers_radar_drape": { "association": [ "Cell", diff --git a/simpeg_drivers-assets/uijson/tipper_forward.ui.json b/simpeg_drivers-assets/uijson/tipper_forward.ui.json index 11c7ce9b..4b760f57 100644 --- a/simpeg_drivers-assets/uijson/tipper_forward.ui.json +++ b/simpeg_drivers-assets/uijson/tipper_forward.ui.json @@ -17,14 +17,6 @@ "meshType": "{0b639533-f35b-44d8-92a8-f70ecff3fd26}", "value": "" }, - "z_from_topo": { - "group": "Data pre-processing", - "label": "Take z from topography", - "tooltip": "Sets survey elevation to topography before any offsets are applied.", - "value": false, - "verbose": 3, - "visible": false - }, "receivers_radar_drape": { "association": [ "Cell", diff --git a/simpeg_drivers-assets/uijson/tipper_inversion.ui.json b/simpeg_drivers-assets/uijson/tipper_inversion.ui.json index a0fb380c..81cff4bd 100644 --- a/simpeg_drivers-assets/uijson/tipper_inversion.ui.json +++ b/simpeg_drivers-assets/uijson/tipper_inversion.ui.json @@ -17,14 +17,6 @@ "meshType": "{0b639533-f35b-44d8-92a8-f70ecff3fd26}", "value": "" }, - "z_from_topo": { - "group": "Data pre-processing", - "label": "Take z from topography", - "tooltip": "Sets survey elevation to topography before any offsets are applied.", - "value": false, - "verbose": 3, - "visible": false - }, "receivers_radar_drape": { "association": [ "Cell", diff --git a/simpeg_drivers/components/data.py b/simpeg_drivers/components/data.py index 4047c0af..98b5f293 100644 --- a/simpeg_drivers/components/data.py +++ b/simpeg_drivers/components/data.py @@ -259,13 +259,6 @@ def save_data(self): self.update_params(data_dict, uncert_dict) - def apply_transformations(self, locations: np.ndarray): - """Apply all coordinate transformations to locations""" - if self.params.z_from_topo: - locations = super().set_z_from_topo(locations) - - return locations - def normalize( self, data: dict[str, np.ndarray], absolute=False ) -> dict[str, np.ndarray]: diff --git a/simpeg_drivers/components/factories/entity_factory.py b/simpeg_drivers/components/factories/entity_factory.py index ff6da5ee..dc8c0a6e 100644 --- a/simpeg_drivers/components/factories/entity_factory.py +++ b/simpeg_drivers/components/factories/entity_factory.py @@ -93,12 +93,8 @@ def _build(self, inversion_data: InversionData): kwargs.update({"mask": inversion_data.mask}) entity = self.params.data_object.copy(copy_complement=False, **kwargs) - entity.vertices = inversion_data.apply_transformations(entity.vertices) if getattr(self.params.data_object, "transmitters", None) is not None: - vertices = inversion_data.apply_transformations( - self.params.data_object.transmitters.vertices - ) cells = self.params.data_object.transmitters.cells if getattr(self.params.data_object, "tx_id_property", None) is not None: @@ -115,7 +111,6 @@ def _build(self, inversion_data: InversionData): transmitters = self.params.data_object.transmitters.copy( copy_complement=False, - vertices=vertices, cells=cells, parent=self.params.out_group, copy_children=False, @@ -136,11 +131,6 @@ def _build(self, inversion_data: InversionData): if tx_freq: tx_freq[0].copy(parent=entity.transmitters) - if getattr(entity, "current_electrodes", None) is not None: - entity.current_electrodes.vertices = inversion_data.apply_transformations( - entity.current_electrodes.vertices - ) - return entity @staticmethod diff --git a/simpeg_drivers/components/locations.py b/simpeg_drivers/components/locations.py index e1fbde1c..0739afe3 100644 --- a/simpeg_drivers/components/locations.py +++ b/simpeg_drivers/components/locations.py @@ -167,32 +167,6 @@ def filter(self, obj: dict[str, np.ndarray] | np.ndarray, mask=None): else: return obj[mask] - def set_z_from_topo(self, locs: np.ndarray): - """interpolate locations z data from topography.""" - - if locs is None: - return None - - topo = self.get_locations(self.params.active_cells.topography_object) - if self.params.active_cells.topography is not None: - if isinstance(self.params.active_cells.topography, Entity): - z = self.params.active_cells.topography.values - else: - z = np.ones_like(topo[:, 2]) * self.params.active_cells.topography - - topo[:, 2] = z - - xyz = locs.copy() - topo_interpolator = LinearNDInterpolator(topo[:, :2], topo[:, 2]) - z_topo = topo_interpolator(xyz[:, :2]) - if np.any(np.isnan(z_topo)): - tree = cKDTree(topo[:, :2]) - _, ind = tree.query(xyz[np.isnan(z_topo), :2]) - z_topo[np.isnan(z_topo)] = topo[ind, 2] - xyz[:, 2] = z_topo - - return xyz - @property def params(self): """Associated parameters.""" diff --git a/simpeg_drivers/constants.py b/simpeg_drivers/constants.py index 8f904270..d0fd5551 100644 --- a/simpeg_drivers/constants.py +++ b/simpeg_drivers/constants.py @@ -36,14 +36,6 @@ "value": None, "tooltip": "Select an object containing survey geometry and data for inversion.", }, - "z_from_topo": { - "group": "Data pre-processing", - "label": "Take z from topography", - "tooltip": "Sets survey elevation to topography before any offsets are applied.", - "value": False, - "verbose": 3, - "visible": False, - }, "receivers_offset_z": { "group": "Data pre-processing", "label": "Z static offset", diff --git a/simpeg_drivers/electricals/direct_current/pseudo_three_dimensions/constants.py b/simpeg_drivers/electricals/direct_current/pseudo_three_dimensions/constants.py index a792f232..4fe5a71b 100644 --- a/simpeg_drivers/electricals/direct_current/pseudo_three_dimensions/constants.py +++ b/simpeg_drivers/electricals/direct_current/pseudo_three_dimensions/constants.py @@ -35,7 +35,6 @@ "forward_only": False, "data_object": None, "line_object": None, - "z_from_topo": False, "potential_channel": None, "potential_uncertainty": 1.0, "u_cell_size": 25.0, @@ -108,7 +107,6 @@ "forward_only": True, "data_object": None, "line_object": None, - "z_from_topo": False, "potential_channel_bool": True, "u_cell_size": 25.0, "v_cell_size": 25.0, @@ -152,7 +150,6 @@ "max_global_iterations": 25, "topography_object": UUID("{ab3c2083-6ea8-4d31-9230-7aad3ec09525}"), "topography": UUID("{a603a762-f6cb-4b21-afda-3160e725bf7d}"), - "z_from_topo": True, "receivers_offset_z": 0.0, "cleanup": True, } diff --git a/simpeg_drivers/electricals/direct_current/three_dimensions/constants.py b/simpeg_drivers/electricals/direct_current/three_dimensions/constants.py index c9df2d04..63d5a830 100644 --- a/simpeg_drivers/electricals/direct_current/three_dimensions/constants.py +++ b/simpeg_drivers/electricals/direct_current/three_dimensions/constants.py @@ -34,7 +34,6 @@ "inversion_type": "direct current 3d", "forward_only": False, "data_object": None, - "z_from_topo": True, "potential_channel": None, "potential_uncertainty": 1.0, "mesh": None, @@ -100,7 +99,6 @@ "inversion_type": "direct current 3d", "forward_only": True, "data_object": None, - "z_from_topo": True, "potential_channel_bool": True, "mesh": None, "model_type": "Conductivity (S/m)", @@ -142,6 +140,5 @@ "sens_wts_threshold": None, "topography_object": UUID("{ab3c2083-6ea8-4d31-9230-7aad3ec09525}"), "topography": UUID("{a603a762-f6cb-4b21-afda-3160e725bf7d}"), - "z_from_topo": True, "receivers_offset_z": 0.0, } diff --git a/simpeg_drivers/electricals/direct_current/two_dimensions/constants.py b/simpeg_drivers/electricals/direct_current/two_dimensions/constants.py index 5d2c75f8..aeba8d0e 100644 --- a/simpeg_drivers/electricals/direct_current/two_dimensions/constants.py +++ b/simpeg_drivers/electricals/direct_current/two_dimensions/constants.py @@ -34,7 +34,6 @@ "inversion_type": "direct current 2d", "forward_only": False, "data_object": None, - "z_from_topo": True, "line_object": None, "line_id": 1, "receivers_radar_drape": None, @@ -109,7 +108,6 @@ "inversion_type": "direct current 2d", "forward_only": True, "data_object": None, - "z_from_topo": True, "line_object": None, "line_id": 1, "receivers_radar_drape": None, @@ -158,6 +156,5 @@ "max_global_iterations": 25, "topography_object": UUID("{ab3c2083-6ea8-4d31-9230-7aad3ec09525}"), "topography": UUID("{a603a762-f6cb-4b21-afda-3160e725bf7d}"), - "z_from_topo": True, "receivers_offset_z": 0.0, } diff --git a/simpeg_drivers/electricals/driver.py b/simpeg_drivers/electricals/driver.py index 9058c604..aa02f4f7 100644 --- a/simpeg_drivers/electricals/driver.py +++ b/simpeg_drivers/electricals/driver.py @@ -31,7 +31,7 @@ from simpeg_drivers.driver import InversionDriver from simpeg_drivers.electricals.params import LineSelectionOptions from simpeg_drivers.line_sweep.driver import LineSweepDriver -from simpeg_drivers.params import BaseForwardOptions, BaseInversionOptions, BaseParams +from simpeg_drivers.params import BaseForwardOptions, BaseInversionOptions from simpeg_drivers.utils.surveys import extract_dcip_survey from simpeg_drivers.utils.utils import get_drape_model diff --git a/simpeg_drivers/electricals/induced_polarization/pseudo_three_dimensions/constants.py b/simpeg_drivers/electricals/induced_polarization/pseudo_three_dimensions/constants.py index 4629b11d..366861d9 100644 --- a/simpeg_drivers/electricals/induced_polarization/pseudo_three_dimensions/constants.py +++ b/simpeg_drivers/electricals/induced_polarization/pseudo_three_dimensions/constants.py @@ -35,7 +35,6 @@ "forward_only": False, "data_object": None, "line_object": None, - "z_from_topo": False, "receivers_radar_drape": None, "receivers_offset_z": 0.0, "gps_receivers_offset": None, @@ -112,7 +111,6 @@ "forward_only": True, "data_object": None, "line_object": None, - "z_from_topo": False, "receivers_radar_drape": None, "receivers_offset_z": 0.0, "gps_receivers_offset": None, @@ -160,7 +158,6 @@ "max_global_iterations": 25, "topography_object": UUID("{ab3c2083-6ea8-4d31-9230-7aad3ec09525}"), "topography": UUID("{a603a762-f6cb-4b21-afda-3160e725bf7d}"), - "z_from_topo": True, "receivers_offset_z": 0.0, "cleanup": True, } diff --git a/simpeg_drivers/electricals/induced_polarization/three_dimensions/constants.py b/simpeg_drivers/electricals/induced_polarization/three_dimensions/constants.py index 063853b9..4ff1952e 100644 --- a/simpeg_drivers/electricals/induced_polarization/three_dimensions/constants.py +++ b/simpeg_drivers/electricals/induced_polarization/three_dimensions/constants.py @@ -33,7 +33,6 @@ "inversion_type": "induced polarization 3d", "forward_only": False, "data_object": None, - "z_from_topo": True, "receivers_radar_drape": None, "receivers_offset_z": None, "gps_receivers_offset": None, @@ -104,7 +103,6 @@ "inversion_type": "induced polarization 3d", "forward_only": True, "data_object": None, - "z_from_topo": True, "receivers_radar_drape": None, "receivers_offset_z": None, "gps_receivers_offset": None, @@ -147,6 +145,5 @@ "max_global_iterations": 25, "topography_object": UUID("{ab3c2083-6ea8-4d31-9230-7aad3ec09525}"), "topography": UUID("{a603a762-f6cb-4b21-afda-3160e725bf7d}"), - "z_from_topo": True, "receivers_offset_z": 0.0, } diff --git a/simpeg_drivers/electricals/induced_polarization/two_dimensions/constants.py b/simpeg_drivers/electricals/induced_polarization/two_dimensions/constants.py index 6157a9e3..c08800c2 100644 --- a/simpeg_drivers/electricals/induced_polarization/two_dimensions/constants.py +++ b/simpeg_drivers/electricals/induced_polarization/two_dimensions/constants.py @@ -34,7 +34,6 @@ "inversion_type": "induced polarization 2d", "forward_only": False, "data_object": None, - "z_from_topo": True, "line_object": None, "line_id": 1, "receivers_radar_drape": None, @@ -110,7 +109,6 @@ "inversion_type": "induced polarization 2d", "forward_only": True, "data_object": None, - "z_from_topo": True, "line_object": None, "line_id": 1, "receivers_radar_drape": None, @@ -159,6 +157,5 @@ "max_global_iterations": 25, "topography_object": UUID("{ab3c2083-6ea8-4d31-9230-7aad3ec09525}"), "topography": UUID("{a603a762-f6cb-4b21-afda-3160e725bf7d}"), - "z_from_topo": True, "receivers_offset_z": 0.0, } diff --git a/simpeg_drivers/natural_sources/magnetotellurics/constants.py b/simpeg_drivers/natural_sources/magnetotellurics/constants.py index dcec848c..94919194 100644 --- a/simpeg_drivers/natural_sources/magnetotellurics/constants.py +++ b/simpeg_drivers/natural_sources/magnetotellurics/constants.py @@ -36,7 +36,6 @@ "inversion_type": "magnetotellurics", "forward_only": False, "data_object": None, - "z_from_topo": False, "receivers_radar_drape": None, "receivers_offset_z": None, "gps_receivers_offset": None, @@ -119,7 +118,6 @@ "inversion_type": "magnetotellurics", "forward_only": True, "data_object": None, - "z_from_topo": False, "receivers_radar_drape": None, "receivers_offset_z": None, "gps_receivers_offset": None, diff --git a/simpeg_drivers/natural_sources/tipper/constants.py b/simpeg_drivers/natural_sources/tipper/constants.py index ddfd6c24..e521143d 100644 --- a/simpeg_drivers/natural_sources/tipper/constants.py +++ b/simpeg_drivers/natural_sources/tipper/constants.py @@ -30,7 +30,6 @@ "inversion_type": "tipper", "forward_only": False, "data_object": None, - "z_from_topo": False, "receivers_radar_drape": None, "receivers_offset_z": None, "gps_receivers_offset": None, @@ -105,7 +104,6 @@ "inversion_type": "tipper", "forward_only": True, "data_object": None, - "z_from_topo": False, "receivers_radar_drape": None, "receivers_offset_z": None, "gps_receivers_offset": None, diff --git a/simpeg_drivers/params.py b/simpeg_drivers/params.py index 72b3f0af..01d74697 100644 --- a/simpeg_drivers/params.py +++ b/simpeg_drivers/params.py @@ -12,20 +12,21 @@ from __future__ import annotations import multiprocessing +from logging import getLogger from pathlib import Path from typing import ClassVar, TypeAlias import numpy as np from geoapps_utils.driver.data import BaseData -from geoapps_utils.driver.params import BaseParams from geoh5py.data import BooleanData, FloatData, NumericData from geoh5py.groups import PropertyGroup, SimPEGGroup, UIJsonGroup from geoh5py.objects import DrapeModel, Octree, Points from geoh5py.shared.utils import fetch_active_workspace -from geoh5py.ui_json import InputFile -from pydantic import BaseModel, ConfigDict, field_validator, model_validator +from pydantic import BaseModel, ConfigDict, Field, field_validator, model_validator +logger = getLogger(__name__) + InversionDataDict: TypeAlias = ( dict[str, np.ndarray | None] | dict[str, dict[float, np.ndarray | None]] ) @@ -67,8 +68,6 @@ class CoreOptions(BaseData): :param physical_property: Physical property of the model. :param data_object: Data object containing survey geometry and data channels. - :param z_from_topo: If True, the z values of the data object are set to the - topography surface. :param mesh: Mesh object containing models (starting, reference, active, etc..). :param starting_model: Starting model used to start inversion or for simulating data in the forward operation. @@ -91,7 +90,7 @@ class CoreOptions(BaseData): inversion_type: str physical_property: str data_object: Points - z_from_topo: bool = False + z_from_topo: bool = Field(default=False, deprecated=True) mesh: Octree | DrapeModel | None starting_model: float | FloatData active_cells: ActiveCellsOptions @@ -103,6 +102,16 @@ class CoreOptions(BaseData): out_group: SimPEGGroup | UIJsonGroup | None = None generate_sweep: bool = False + @field_validator("z_from_topo", mode="before") + @classmethod + def deprecated(cls, v, info): + logger.warning( + "Field %s is deprecated. Since version 0.3.0, " + "any data location adjustments must be done in pre-processing.", + info.field_name, + ) + return v + @field_validator("n_cpu", mode="before") @classmethod def maximize_cpu_if_none(cls, value): @@ -121,7 +130,7 @@ def mesh_cannot_be_rotated(cls, value: Octree): @model_validator(mode="before") @classmethod - def out_group_if_none(cls, data) -> SimPEGGroup: + def out_group_if_none(cls, data): group = data.get("out_group", None) if isinstance(group, SimPEGGroup): diff --git a/simpeg_drivers/potential_fields/gravity/constants.py b/simpeg_drivers/potential_fields/gravity/constants.py index 9d2d08e0..b1144829 100644 --- a/simpeg_drivers/potential_fields/gravity/constants.py +++ b/simpeg_drivers/potential_fields/gravity/constants.py @@ -117,7 +117,6 @@ "inversion_type": "gravity", "forward_only": True, "data_object": None, - "z_from_topo": False, "receivers_radar_drape": None, "receivers_offset_z": None, "gps_receivers_offset": None, @@ -180,7 +179,6 @@ "max_global_iterations": 25, "topography_object": UUID("{ab3c2083-6ea8-4d31-9230-7aad3ec09525}"), "topography": UUID("{a603a762-f6cb-4b21-afda-3160e725bf7d}"), - "z_from_topo": True, "receivers_offset_z": 60.0, "fix_aspect_ratio": True, "colorbar": False, diff --git a/simpeg_drivers/potential_fields/magnetic_scalar/constants.py b/simpeg_drivers/potential_fields/magnetic_scalar/constants.py index f9cc88d3..63422432 100644 --- a/simpeg_drivers/potential_fields/magnetic_scalar/constants.py +++ b/simpeg_drivers/potential_fields/magnetic_scalar/constants.py @@ -176,7 +176,6 @@ "max_global_iterations": 25, "topography_object": UUID("{ab3c2083-6ea8-4d31-9230-7aad3ec09525}"), "topography": UUID("{a603a762-f6cb-4b21-afda-3160e725bf7d}"), - "z_from_topo": True, "receivers_offset_z": 60.0, "fix_aspect_ratio": True, "colorbar": False, diff --git a/simpeg_drivers/potential_fields/magnetic_vector/constants.py b/simpeg_drivers/potential_fields/magnetic_vector/constants.py index bae72653..3990dfc8 100644 --- a/simpeg_drivers/potential_fields/magnetic_vector/constants.py +++ b/simpeg_drivers/potential_fields/magnetic_vector/constants.py @@ -189,7 +189,6 @@ "max_global_iterations": 25, "topography_object": UUID("{ab3c2083-6ea8-4d31-9230-7aad3ec09525}"), "topography": UUID("{a603a762-f6cb-4b21-afda-3160e725bf7d}"), - "z_from_topo": True, "receivers_offset_z": 60.0, "fix_aspect_ratio": True, "colorbar": False, diff --git a/tests/data_test.py b/tests/data_test.py index ae21bd22..4592ff84 100644 --- a/tests/data_test.py +++ b/tests/data_test.py @@ -126,7 +126,6 @@ def test_survey_data(tmp_path: Path): mesh=mesh, starting_model=0.0, tile_spatial=2, - z_from_topo=True, resolution=0.0, ) @@ -149,8 +148,8 @@ def test_survey_data(tmp_path: Path): np.testing.assert_array_equal( verts[driver.sorting[1], :2], local_survey_b.receiver_locations[:, :2] ) - assert all(local_survey_a.receiver_locations[:, 2] == 100.0) - assert all(local_survey_b.receiver_locations[:, 2] == 100.0) + assert all(local_survey_a.receiver_locations[:, 2] == 0.0) + assert all(local_survey_b.receiver_locations[:, 2] == 0.0) # test observed data sorting = np.hstack(driver.sorting) diff --git a/tests/driver_test.py b/tests/driver_test.py index 85fa7cb3..2d2cf579 100644 --- a/tests/driver_test.py +++ b/tests/driver_test.py @@ -46,7 +46,6 @@ def test_smallness_terms(tmp_path: Path): s_norm=0.0, gradient_type="components", gz_channel_bool=True, - z_from_topo=False, gz_channel=gz, gz_uncertainty=2e-3, lower_bound=0.0, diff --git a/tests/locations_test.py b/tests/locations_test.py index 4a5cc5dd..60d981fb 100644 --- a/tests/locations_test.py +++ b/tests/locations_test.py @@ -98,16 +98,3 @@ def test_filter(tmp_path: Path): test_data = {"key": test_data} filtered_data = locations.filter(test_data) assert np.all(filtered_data["key"] == [2, 3, 4]) - - -def test_z_from_topo(tmp_path: Path): - params = get_mvi_params(tmp_path) - geoh5 = params.geoh5 - locations = InversionLocations(geoh5, params) - locs = locations.set_z_from_topo(np.array([[0.0, 0.0, 0.0]])) - assert np.isclose(locs[0, 2], 49.91677) - - params.active_cells.topography = 320.0 - locations = InversionLocations(geoh5, params) - locs = locations.set_z_from_topo(np.array([[315674, 6070832, 0]])) - assert locs[0, 2] == 320.0 diff --git a/tests/run_tests/driver_airborne_tem_test.py b/tests/run_tests/driver_airborne_tem_test.py index fb130728..8c5d79d9 100644 --- a/tests/run_tests/driver_airborne_tem_test.py +++ b/tests/run_tests/driver_airborne_tem_test.py @@ -55,7 +55,6 @@ def test_bad_waveform(tmp_path: Path): geoh5=geoh5, mesh=model.parent, active_cells=ActiveCellsOptions(topography_object=topography), - z_from_topo=False, data_object=survey, starting_model=model, x_channel_bool=True, @@ -95,7 +94,6 @@ def test_airborne_tem_fwr_run( geoh5=geoh5, mesh=model.parent, active_cells=ActiveCellsOptions(topography_object=topography), - z_from_topo=False, data_object=survey, starting_model=model, x_channel_bool=True, @@ -177,7 +175,6 @@ def test_airborne_tem_run(tmp_path: Path, max_iterations=1, pytest=True): z_norm=2.0, alpha_s=1e-4, gradient_type="total", - z_from_topo=False, lower_bound=2e-6, upper_bound=1e2, max_global_iterations=max_iterations, diff --git a/tests/run_tests/driver_dc_2d_test.py b/tests/run_tests/driver_dc_2d_test.py index 687cc093..b5311060 100644 --- a/tests/run_tests/driver_dc_2d_test.py +++ b/tests/run_tests/driver_dc_2d_test.py @@ -77,7 +77,6 @@ def test_dc_2d_fwr_run( ), starting_model=model, active_cells=ActiveCellsOptions(topography_object=topography), - z_from_topo=False, ) fwr_driver = DC2DForwardDriver(params) @@ -120,7 +119,6 @@ def test_dc_2d_run(tmp_path: Path, max_iterations=1, pytest=True): z_norm=1.0, gradient_type="components", potential_channel_bool=True, - z_from_topo=True, max_global_iterations=max_iterations, initial_beta=None, initial_beta_ratio=1e0, diff --git a/tests/run_tests/driver_dc_b2d_test.py b/tests/run_tests/driver_dc_b2d_test.py index 52b838bb..75458b34 100644 --- a/tests/run_tests/driver_dc_b2d_test.py +++ b/tests/run_tests/driver_dc_b2d_test.py @@ -71,7 +71,6 @@ def test_dc_p3d_fwr_run( vertical_padding=1000.0, ), active_cells=ActiveCellsOptions(topography_object=topography), - z_from_topo=False, data_object=survey, starting_model=model, line_selection=LineSelectionOptions( @@ -123,7 +122,6 @@ def test_dc_p3d_run( x_norm=1.0, z_norm=1.0, gradient_type="components", - z_from_topo=False, max_global_iterations=max_iterations, initial_beta=None, initial_beta_ratio=10.0, diff --git a/tests/run_tests/driver_dc_test.py b/tests/run_tests/driver_dc_test.py index 2840adec..e3be2cc2 100644 --- a/tests/run_tests/driver_dc_test.py +++ b/tests/run_tests/driver_dc_test.py @@ -71,7 +71,6 @@ def test_dc_3d_fwr_run( geoh5=geoh5, mesh=model.parent, active_cells=active_cells, - z_from_topo=False, data_object=survey, starting_model=model, resolution=None, @@ -109,7 +108,6 @@ def test_dc_3d_run( y_norm=1.0, z_norm=1.0, gradient_type="components", - z_from_topo=False, potential_channel=potential, potential_uncertainty=1e-3, max_global_iterations=max_iterations, @@ -164,7 +162,6 @@ def test_dc_single_line_fwr_run( geoh5=geoh5, mesh=model.parent, active_cells=active_cells, - z_from_topo=False, data_object=survey, starting_model=model, resolution=None, diff --git a/tests/run_tests/driver_fem_test.py b/tests/run_tests/driver_fem_test.py index d3144d2c..5cd6758c 100644 --- a/tests/run_tests/driver_fem_test.py +++ b/tests/run_tests/driver_fem_test.py @@ -61,7 +61,6 @@ def test_fem_fwr_run( geoh5=geoh5, mesh=model.parent, active_cells=ActiveCellsOptions(topography_object=topography), - z_from_topo=False, data_object=survey, starting_model=model, z_real_channel_bool=True, @@ -141,7 +140,6 @@ def test_fem_run(tmp_path: Path, max_iterations=1, pytest=True): y_norm=0.0, z_norm=0.0, gradient_type="components", - z_from_topo=False, upper_bound=0.75, max_global_iterations=max_iterations, initial_beta_ratio=1e1, diff --git a/tests/run_tests/driver_grav_test.py b/tests/run_tests/driver_grav_test.py index 6d4dbf57..32f0674d 100644 --- a/tests/run_tests/driver_grav_test.py +++ b/tests/run_tests/driver_grav_test.py @@ -56,7 +56,6 @@ def test_gravity_fwr_run( mesh=model.parent, active_cells=active_cells, topography_object=topography, - z_from_topo=False, data_object=survey, starting_model=model, gz_channel_bool=True, @@ -113,7 +112,6 @@ def test_gravity_run( z_norm=gradient_norms, gradient_type="components", gz_channel_bool=True, - z_from_topo=False, gz_channel=gz, gz_uncertainty=2e-3, lower_bound=0.0, diff --git a/tests/run_tests/driver_ground_tem_test.py b/tests/run_tests/driver_ground_tem_test.py index e90d57e1..f5cd2600 100644 --- a/tests/run_tests/driver_ground_tem_test.py +++ b/tests/run_tests/driver_ground_tem_test.py @@ -63,7 +63,6 @@ def test_tiling_ground_tem( geoh5=geoh5, mesh=model.parent, active_cells=ActiveCellsOptions(topography_object=topography), - z_from_topo=False, data_object=survey, starting_model=model, x_channel_bool=True, @@ -111,7 +110,6 @@ def test_ground_tem_fwr_run( geoh5=geoh5, mesh=model.parent, active_cells=ActiveCellsOptions(topography_object=topography), - z_from_topo=False, data_object=survey, starting_model=model, x_channel_bool=True, @@ -204,7 +202,6 @@ def test_ground_tem_run(tmp_path: Path, max_iterations=1, pytest=True): z_norm=2.0, alpha_s=0e-1, gradient_type="total", - z_from_topo=False, lower_bound=2e-6, upper_bound=1e2, max_global_iterations=max_iterations, diff --git a/tests/run_tests/driver_ip_2d_test.py b/tests/run_tests/driver_ip_2d_test.py index 80a43f49..0aed0373 100644 --- a/tests/run_tests/driver_ip_2d_test.py +++ b/tests/run_tests/driver_ip_2d_test.py @@ -58,7 +58,6 @@ def test_ip_2d_fwr_run( data_object=survey, mesh=model.parent, active_cells=ActiveCellsOptions(topography_object=topography), - z_from_topo=True, starting_model=model, conductivity_model=1e-2, line_selection=LineSelectionOptions( @@ -104,7 +103,6 @@ def test_ip_2d_run( x_norm=0.0, z_norm=0.0, gradient_type="components", - z_from_topo=True, max_global_iterations=max_iterations, initial_beta=None, initial_beta_ratio=1e0, diff --git a/tests/run_tests/driver_ip_b2d_test.py b/tests/run_tests/driver_ip_b2d_test.py index 6e26c0f1..9533f3f1 100644 --- a/tests/run_tests/driver_ip_b2d_test.py +++ b/tests/run_tests/driver_ip_b2d_test.py @@ -73,7 +73,6 @@ def test_ip_p3d_fwr_run( active_cells=ActiveCellsOptions( topography_object=topography, ), - z_from_topo=True, data_object=survey, conductivity_model=1e-2, starting_model=model, @@ -130,7 +129,6 @@ def test_ip_p3d_run( length_scale_z=1.0, gradient_type="components", chargeability_channel_bool=True, - z_from_topo=True, max_global_iterations=max_iterations, initial_beta=None, initial_beta_ratio=1e0, diff --git a/tests/run_tests/driver_ip_test.py b/tests/run_tests/driver_ip_test.py index e965e9ee..5c67bae2 100644 --- a/tests/run_tests/driver_ip_test.py +++ b/tests/run_tests/driver_ip_test.py @@ -55,7 +55,6 @@ def test_ip_3d_fwr_run( geoh5=geoh5, mesh=model.parent, active_cells=ActiveCellsOptions(topography_object=topography), - z_from_topo=True, data_object=survey, starting_model=model, conductivity_model=1e-2, @@ -94,7 +93,6 @@ def test_ip_3d_run( y_norm=0.0, z_norm=0.0, gradient_type="components", - z_from_topo=False, chargeability_channel=potential, chargeability_uncertainty=2e-4, max_global_iterations=max_iterations, diff --git a/tests/run_tests/driver_joint_cross_gradient_test.py b/tests/run_tests/driver_joint_cross_gradient_test.py index 6a99e3ad..71ccf196 100644 --- a/tests/run_tests/driver_joint_cross_gradient_test.py +++ b/tests/run_tests/driver_joint_cross_gradient_test.py @@ -71,7 +71,6 @@ def test_joint_cross_gradient_fwr_run( geoh5=geoh5, mesh=model.parent, active_cells=active_cells, - z_from_topo=False, data_object=survey, starting_model=model, ) @@ -96,7 +95,6 @@ def test_joint_cross_gradient_fwr_run( inducing_field_strength=inducing_field[0], inducing_field_inclination=inducing_field[1], inducing_field_declination=inducing_field[2], - z_from_topo=False, data_object=survey, starting_model=model, ) diff --git a/tests/run_tests/driver_joint_surveys_test.py b/tests/run_tests/driver_joint_surveys_test.py index ba26aa11..80ba84a1 100644 --- a/tests/run_tests/driver_joint_surveys_test.py +++ b/tests/run_tests/driver_joint_surveys_test.py @@ -51,7 +51,6 @@ def test_joint_surveys_fwr_run( geoh5=geoh5, mesh=model.parent, active_cells=active_cells, - z_from_topo=False, data_object=survey, starting_model=model, ) @@ -75,7 +74,6 @@ def test_joint_surveys_fwr_run( geoh5=geoh5, mesh=model.parent, active_cells=active_cells, - z_from_topo=False, data_object=survey, starting_model=model, ) diff --git a/tests/run_tests/driver_mag_test.py b/tests/run_tests/driver_mag_test.py index 5427c52c..42ece601 100644 --- a/tests/run_tests/driver_mag_test.py +++ b/tests/run_tests/driver_mag_test.py @@ -60,7 +60,6 @@ def test_susceptibility_fwr_run( inducing_field_strength=inducing_field[0], inducing_field_inclination=inducing_field[1], inducing_field_declination=inducing_field[2], - z_from_topo=False, data_object=survey, starting_model=model, ) @@ -111,7 +110,6 @@ def test_susceptibility_run( initial_beta_ratio=1e1, gradient_type="components", lower_bound=0.0, - z_from_topo=False, tmi_channel=tmi, tmi_uncertainty=1.0, max_global_iterations=max_iterations, diff --git a/tests/run_tests/driver_mt_test.py b/tests/run_tests/driver_mt_test.py index 2626c4e9..008aac41 100644 --- a/tests/run_tests/driver_mt_test.py +++ b/tests/run_tests/driver_mt_test.py @@ -60,7 +60,6 @@ def test_magnetotellurics_fwr_run( geoh5=geoh5, mesh=model.parent, active_cells=ActiveCellsOptions(topography_object=topography), - z_from_topo=False, data_object=survey, starting_model=model, background_conductivity=1e-2, @@ -158,7 +157,6 @@ def test_magnetotellurics_run(tmp_path: Path, max_iterations=1, pytest=True): y_norm=1.0, z_norm=1.0, gradient_type="components", - z_from_topo=False, coolingRate=1, lower_bound=0.75, model_type="Resistivity (Ohm-m)", diff --git a/tests/run_tests/driver_mvi_test.py b/tests/run_tests/driver_mvi_test.py index 9bb3d646..4e70336a 100644 --- a/tests/run_tests/driver_mvi_test.py +++ b/tests/run_tests/driver_mvi_test.py @@ -68,7 +68,6 @@ def test_magnetic_vector_fwr_run( inducing_field_strength=inducing_field[0], inducing_field_inclination=inducing_field[1], inducing_field_declination=inducing_field[2], - z_from_topo=False, data_object=survey, starting_model_object=model.parent, starting_model=model, @@ -117,7 +116,6 @@ def test_magnetic_vector_run( z_norm=1.0, gradient_type="components", tmi_channel_bool=True, - z_from_topo=False, tmi_channel=tmi, tmi_uncertainty=4.0, max_global_iterations=max_iterations, diff --git a/tests/run_tests/driver_tile_estimator_test.py b/tests/run_tests/driver_tile_estimator_test.py index 5b4d10a3..c59466da 100644 --- a/tests/run_tests/driver_tile_estimator_test.py +++ b/tests/run_tests/driver_tile_estimator_test.py @@ -52,7 +52,6 @@ def test_tile_estimator_run( inducing_field_strength=inducing_field[0], inducing_field_inclination=inducing_field[1], inducing_field_declination=inducing_field[2], - z_from_topo=False, data_object=survey, tmi_channel=tmi_channel, starting_model=model, diff --git a/tests/run_tests/driver_tipper_test.py b/tests/run_tests/driver_tipper_test.py index ef96df87..eea6f237 100644 --- a/tests/run_tests/driver_tipper_test.py +++ b/tests/run_tests/driver_tipper_test.py @@ -59,7 +59,6 @@ def test_tipper_fwr_run( geoh5=geoh5, mesh=model.parent, active_cells=ActiveCellsOptions(topography_object=topography), - z_from_topo=False, data_object=survey, starting_model=model, model_type="Resistivity (Ohm-m)", @@ -147,7 +146,6 @@ def test_tipper_run(tmp_path: Path, max_iterations=1, pytest=True): alpha_s=1.0, gradient_type="components", model_type="Resistivity (Ohm-m)", - z_from_topo=False, lower_bound=0.75, max_global_iterations=max_iterations, initial_beta_ratio=1e3, diff --git a/tests/run_tests/sensitivity_cutoff_test.py b/tests/run_tests/sensitivity_cutoff_test.py index f94ac8ca..bd78d701 100644 --- a/tests/run_tests/sensitivity_cutoff_test.py +++ b/tests/run_tests/sensitivity_cutoff_test.py @@ -55,7 +55,6 @@ def setup_inversion_results( s_norm=0.0, gradient_type="components", gz_channel_bool=True, - z_from_topo=False, gz_channel=gz, gz_uncertainty=2e-3, lower_bound=0.0,