Skip to content

Commit 553f637

Browse files
committed
remove rotated gradients from gravity runtest
1 parent 812aa95 commit 553f637

1 file changed

Lines changed: 0 additions & 69 deletions

File tree

tests/run_tests/driver_grav_test.py

Lines changed: 0 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -189,75 +189,6 @@ def test_gravity_run(
189189
assert np.all(nan_ind == inactive_ind)
190190

191191

192-
def test_rotated_gradient(
193-
tmp_path: Path,
194-
max_iterations=1,
195-
pytest=True,
196-
):
197-
workpath = tmp_path / "inversion_test.ui.geoh5"
198-
if pytest:
199-
workpath = tmp_path.parent / "test_gravity_fwr_run0" / "inversion_test.ui.geoh5"
200-
201-
with Workspace(workpath) as geoh5:
202-
gz = geoh5.get_entity("Iteration_0_gz")[0]
203-
mesh = geoh5.get_entity("mesh")[0]
204-
205-
inds = (mesh.centroids[:, 0] > -35) & (mesh.centroids[:, 0] < 35)
206-
norms = np.ones(mesh.n_cells) * 2
207-
norms[inds] = 0
208-
gradient_norms = mesh.add_data({"norms": {"values": norms}})
209-
210-
topography = geoh5.get_entity("topography")[0]
211-
212-
# Turn some values to nan
213-
values = gz.values.copy()
214-
values[0] = np.nan
215-
gz.values = values
216-
217-
# Rotate the gradients
218-
219-
direction, dip = mesh.add_data(
220-
{
221-
"gradient_direction": {"values": 90 * np.ones(mesh.n_cells)},
222-
"gradient_dip": {"values": 45 * np.ones(mesh.n_cells)},
223-
}
224-
)
225-
gradient_rotation = PropertyGroup(
226-
parent=mesh,
227-
name="gradient_rotation",
228-
property_group_type="Dip direction & dip",
229-
properties=[direction, dip],
230-
)
231-
232-
# Run the inverse
233-
active_cells = ActiveCellsOptions(topography_object=topography)
234-
params = GravityInversionOptions(
235-
geoh5=geoh5,
236-
mesh=mesh,
237-
active_cells=active_cells,
238-
data_object=gz.parent,
239-
starting_model=1e-4,
240-
reference_model=0.0,
241-
gradient_rotation=gradient_rotation,
242-
s_norm=0.0,
243-
x_norm=gradient_norms,
244-
y_norm=gradient_norms,
245-
z_norm=gradient_norms,
246-
gradient_type="components",
247-
gz_channel=gz,
248-
gz_uncertainty=2e-3,
249-
lower_bound=0.0,
250-
max_global_iterations=max_iterations,
251-
initial_beta_ratio=1e-2,
252-
percentile=100,
253-
store_sensitivities="ram",
254-
save_sensitivities=True,
255-
)
256-
params.write_ui_json(path=tmp_path / "Inv_run.ui.json")
257-
258-
_ = GravityInversionDriver.start(str(tmp_path / "Inv_run.ui.json"))
259-
260-
261192
if __name__ == "__main__":
262193
# Full run
263194
test_gravity_fwr_run(

0 commit comments

Comments
 (0)