Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 45393c3

Browse files
dccowansantisoler
andauthored
Add shift to discrete topography for NSEM (simpeg#1683)
Add new `shift_to_discrete_topography` function that shifts locations relative to discrete surface topography. Add also a new `get_discrete_topography` function that generates discrete topography locations out of a mesh and its active cells. We measure electric fields at the Earth's surface when performing MT surveys. Like DC/IP, the original measurement locations of the electric fields can end up in air cells when we define discrete surface topography. These functions allow the user to shift locations relative to discrete topography on Tensor and Tree meshes. For Airborne NSEM, they also allow the user to preserve the original flight heights. Deprecate the following functions: `gettopoCC`, `drapeTopotoLoc`, and `closestPointsGrid`. --------- Co-authored-by: Santiago Soler <[email protected]>
1 parent 1845349 commit 45393c3

11 files changed

Lines changed: 623 additions & 168 deletions

File tree

.ci/environment_test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ dependencies:
66
- scipy>=1.12
77
- pymatsolver>=0.3
88
- matplotlib-base
9-
- discretize>=0.11
9+
- discretize>=0.12
1010
- geoana>=0.7
1111
- libdlf
1212
- typing_extensions

environment.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ dependencies:
88
- scipy>=1.12
99
- pymatsolver>=0.3
1010
- matplotlib-base
11-
- discretize>=0.11
11+
- discretize>=0.12
1212
- geoana>=0.7
1313
- libdlf
1414
- typing_extensions

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ dependencies = [
1919
"scipy>=1.12",
2020
"pymatsolver>=0.3",
2121
"matplotlib",
22-
"discretize>=0.11",
22+
"discretize>=0.12",
2323
"geoana>=0.7",
2424
"libdlf",
2525
"typing_extensions; python_version<'3.13'",

simpeg/electromagnetics/static/resistivity/survey.py

Lines changed: 39 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
import numpy as np
2+
import warnings
23

34
from ....utils.code_utils import validate_string
45

56
from ....survey import BaseSurvey
6-
from ..utils import drapeTopotoLoc
7+
from ....utils import shift_to_discrete_topography
78
from . import receivers as Rx
89
from . import sources as Src
910
from ..utils import static_utils
1011

1112

1213
class Survey(BaseSurvey):
13-
"""DC/IP survey class
14+
"""DC/IP survey class.
1415
1516
Parameters
1617
----------
@@ -37,7 +38,7 @@ def __init__(
3738

3839
@property
3940
def survey_geometry(self):
40-
"""Survey geometry
41+
"""Survey geometry.
4142
4243
Returns
4344
-------
@@ -76,7 +77,7 @@ def __repr__(self):
7677
@property
7778
def locations_a(self):
7879
"""
79-
Locations of the positive (+) current electrodes in the survey
80+
Locations of the positive (+) current electrodes in the survey.
8081
8182
Returns
8283
-------
@@ -90,7 +91,7 @@ def locations_a(self):
9091
@property
9192
def locations_b(self):
9293
"""
93-
Locations of the negative (-) current electrodes in the survey
94+
Locations of the negative (-) current electrodes in the survey.
9495
9596
Returns
9697
-------
@@ -104,7 +105,7 @@ def locations_b(self):
104105
@property
105106
def locations_m(self):
106107
"""
107-
Locations of the positive (+) potential electrodes in the survey
108+
Locations of the positive (+) potential electrodes in the survey.
108109
109110
Returns
110111
-------
@@ -118,7 +119,7 @@ def locations_m(self):
118119
@property
119120
def locations_n(self):
120121
"""
121-
Locations of the negative (-) potential electrodes in the survey
122+
Locations of the negative (-) potential electrodes in the survey.
122123
123124
Returns
124125
-------
@@ -132,7 +133,7 @@ def locations_n(self):
132133
@property
133134
def unique_electrode_locations(self):
134135
"""
135-
Unique locations of the A, B, M, N electrodes
136+
Unique locations of the A, B, M, N electrodes.
136137
137138
Returns
138139
-------
@@ -169,7 +170,7 @@ def set_geometric_factor(
169170
space_type="halfspace",
170171
):
171172
"""
172-
Set and return the geometric factor for all data
173+
Set and return the geometric factor for all data.
173174
174175
Parameters
175176
----------
@@ -239,9 +240,11 @@ def drape_electrodes_on_topography(
239240
self,
240241
mesh,
241242
active_cells,
242-
option="top",
243+
topo_cell_cutoff="top",
243244
topography=None,
244245
force=False,
246+
shift_horizontal=True,
247+
option=None,
245248
):
246249
"""Shift electrode locations to discrete surface topography.
247250
@@ -251,13 +254,31 @@ def drape_electrodes_on_topography(
251254
The mesh on which the discretized fields are computed
252255
active_cells : numpy.ndarray of int or bool
253256
Active topography cells
254-
option :{"top", "center"}
257+
topo_cell_cutoff : {"top", "center"}
255258
Define topography at tops of cells or cell centers.
256259
topography : (n, dim) numpy.ndarray, default = ``None``
257260
Surface topography
258261
force : bool, default = ``False``
259-
If ``True`` force electrodes to surface even if borehole
262+
If ``True`` force electrodes to surface even if borehole.
263+
shift_horizontal : bool
264+
When True, locations are shifted horizontally to lie vertically over cell
265+
centers. When False, the original horizontal locations are preserved.
266+
option : {"top", "center"}
267+
Define topography at tops of cells or cell centers.
268+
269+
.. deprecated:: 0.25.0
270+
271+
Argument ``option`` is deprecated in favor of ``topo_cell_cutoff``
272+
and will be removed in SimPEG v0.27.0.
273+
260274
"""
275+
if option is not None:
276+
msg = (
277+
"Argument ``option`` is deprecated in favor of ``topo_cell_cutoff`` "
278+
"and will be removed in SimPEG v0.27.0."
279+
)
280+
warnings.warn(msg, FutureWarning, stacklevel=2)
281+
topo_cell_cutoff = option
261282

262283
if self.survey_geometry == "surface":
263284
loc_a = self.locations_a[:, :2]
@@ -271,8 +292,12 @@ def drape_electrodes_on_topography(
271292
inv_b, inv = inv[: len(loc_b)], inv[len(loc_b) :]
272293
inv_m, inv_n = inv[: len(loc_m)], inv[len(loc_m) :]
273294

274-
electrodes_shifted = drapeTopotoLoc(
275-
mesh, unique_electrodes, active_cells=active_cells, option=option
295+
electrodes_shifted = shift_to_discrete_topography(
296+
mesh,
297+
unique_electrodes,
298+
active_cells=active_cells,
299+
topo_cell_cutoff=topo_cell_cutoff,
300+
shift_horizontal=shift_horizontal,
276301
)
277302
a_shifted = electrodes_shifted[inv_a]
278303
b_shifted = electrodes_shifted[inv_b]

0 commit comments

Comments
 (0)