@@ -177,15 +177,17 @@ def compute_dc_projections(locations, cells, simulation):
177177
178178def create_mesh_by_line_id (
179179 workspace : Workspace ,
180- line_ids : IntegerData ,
180+ survey : PotentialElectrode ,
181+ line_ids : np .ndarray ,
181182 drape_options : DrapeModelOptions ,
182183 ** object_kwargs ,
183184) -> DrapeModel :
184185 """
185186 Create a drape mesh for the dc resistivity survey lines.
186187
187188 :param workspace: Workspace to create the drape mesh in.
188- :param line_ids: IntegerData object containing the line IDs for each vertex.
189+ :param survey: PotentialElectrode survey object.
190+ :param line_ids: Array containing the line IDs for each vertex.
189191 :param drape_options: DrapeModelOptions containing the parameters for the drape mesh
190192 :param object_kwargs: Additional keyword arguments to pass to the DrapeModelMerger.create_object method.
191193
@@ -194,10 +196,10 @@ def create_mesh_by_line_id(
194196 drape_models = []
195197 temp_work = Workspace ()
196198
197- relief = get_max_line_relief (line_ids , drape_options .v_cell_size )
199+ relief = get_max_line_relief (survey , line_ids , drape_options .v_cell_size )
198200
199- for line_id in np .unique (line_ids . values ):
200- poles = get_poles_by_line_id (line_ids , line_id )
201+ for line_id in np .unique (line_ids ):
202+ poles = get_poles_by_line_id (survey , line_ids , line_id )
201203 poles = np .unique (poles , axis = 0 )
202204 poles = normalize_vertically (poles , relief )
203205
@@ -220,34 +222,47 @@ def create_mesh_by_line_id(
220222 return entity
221223
222224
223- def get_max_line_relief (line_ids : IntegerData , z_cell_size : float ) -> float :
225+ def get_max_line_relief (
226+ survey : PotentialElectrode , line_ids : np .ndarray , z_cell_size : float
227+ ) -> float :
224228 """
225229 Get the maximum relief across all survey lines, rounded to the nearest cell thickness.
226230
227- :param line_ids: IntegerData object containing the line IDs for each vertex.
231+ :param survey: PotentialElectrode survey object.
232+ :param line_ids: Array containing the line IDs for each vertex.
228233 :param z_cell_size: Cell size in the vertical direction for the drape mesh.
229234 """
230235 max_relief = 0
231- for line_id in np .unique (line_ids . values ):
232- poles = get_poles_by_line_id (line_ids , line_id )
236+ for line_id in np .unique (line_ids ):
237+ poles = get_poles_by_line_id (survey , line_ids , line_id )
233238 max_relief = np .maximum (poles [:, 2 ].max () - poles [:, 2 ].min (), max_relief )
234239
235240 return (max_relief // z_cell_size + 2 ) * z_cell_size
236241
237242
238- def get_poles_by_line_id (line_ids : IntegerData , uid : int ) -> np .ndarray :
239- """Get the vertices associated with a given line ID."""
240- mn_mask = line_ids .values == uid
243+ def get_poles_by_line_id (
244+ survey : PotentialElectrode , line_ids : np .ndarray , uid : int
245+ ) -> np .ndarray :
246+ """
247+ Get the vertices associated with a given line ID.
248+
249+ :param survey: PotentialElectrode survey object.
250+ :param line_ids: Array containing the line IDs for each vertex.
251+ :param uid: Unique ID for the survey line.
252+
253+ :return: Array containing the receiver and transmitter pole locations associated with a given line ID.
254+ """
255+ mn_mask = line_ids == uid
241256
242- unique_tx = np .unique (line_ids . parent .ab_cell_id .values [mn_mask ])
257+ unique_tx = np .unique (survey .ab_cell_id .values [mn_mask ])
243258
244- ab_mask = np .isin (line_ids . parent .complement .ab_cell_id .values , unique_tx )
259+ ab_mask = np .isin (survey .complement .ab_cell_id .values , unique_tx )
245260
246261 return np .vstack (
247262 [
248- line_ids . parent . vertices [line_ids . parent .cells [mn_mask ].flatten ()],
249- line_ids . parent .current_electrodes .vertices [
250- line_ids . parent .current_electrodes .cells [ab_mask ].flatten ()
263+ survey . vertices [survey .cells [mn_mask ].flatten ()],
264+ survey .current_electrodes .vertices [
265+ survey .current_electrodes .cells [ab_mask ].flatten ()
251266 ],
252267 ]
253268 )
0 commit comments