resqpy 4.5.0__py3-none-any.whl → 4.6.3__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
resqpy/__init__.py CHANGED
@@ -28,6 +28,6 @@
28
28
 
29
29
  import logging
30
30
 
31
- __version__ = "4.5.0" # Set at build time
31
+ __version__ = "4.6.3" # Set at build time
32
32
  log = logging.getLogger(__name__)
33
33
  log.info(f"Imported resqpy version {__version__}")
@@ -60,12 +60,14 @@ def cell_geometry_is_defined(grid, cell_kji0 = None, cell_geometry_is_defined_ro
60
60
  object = grid,
61
61
  array_attribute = 'array_cell_geometry_is_defined',
62
62
  dtype = 'bool')
63
- if grid.geometry_defined_for_all_cells_cached is None and cache_array and hasattr(
64
- grid, 'array_cell_geometry_is_defined'):
65
- grid.geometry_defined_for_all_cells_cached = (np.count_nonzero(
66
- grid.array_cell_geometry_is_defined) == grid.array_cell_geometry_is_defined.size)
63
+ if (grid.geometry_defined_for_all_cells_cached is None and (cache_array or cell_kji0 is None) and
64
+ hasattr(grid, 'array_cell_geometry_is_defined')):
65
+ grid.geometry_defined_for_all_cells_cached = \
66
+ (np.count_nonzero(grid.array_cell_geometry_is_defined) == grid.array_cell_geometry_is_defined.size)
67
67
  if grid.geometry_defined_for_all_cells_cached:
68
68
  delattr(grid, 'array_cell_geometry_is_defined')
69
+ if cell_kji0 is None:
70
+ return grid.geometry_defined_for_all_cells_cached
69
71
  return result
70
72
 
71
73
 
@@ -291,7 +293,7 @@ def set_geometry_is_defined(grid,
291
293
 
292
294
  assert not np.all(nan_mask), 'grid does not have any geometry defined'
293
295
 
294
- points[:] = np.where(np.repeat(np.expand_dims(nan_mask, axis = nan_mask.ndim), 3, axis = -1), np.NaN, points)
296
+ points[np.where(np.repeat(np.expand_dims(nan_mask, axis = nan_mask.ndim), 3, axis = -1))] = np.NaN
295
297
 
296
298
  surround_z = grid.xyz_box(lazy = False)[1 if grid.z_inc_down() else 0, 2]
297
299
 
@@ -307,11 +309,12 @@ def set_geometry_is_defined(grid,
307
309
 
308
310
  grid.geometry_defined_for_all_cells_cached = False
309
311
 
310
- primary_nan_mask = \
311
- nan_mask.reshape((grid.nk_plus_k_gaps + 1, -1))[:, :primary_count].reshape(
312
- (grid.nk_plus_k_gaps + 1, grid.nj + 1, grid.ni + 1))
312
+ primary_nan_mask = nan_mask.reshape((grid.nk_plus_k_gaps + 1, -1))[:, :primary_count].reshape(
313
+ (grid.nk_plus_k_gaps + 1, grid.nj + 1, grid.ni + 1))
314
+
313
315
  column_nan_mask = np.logical_or(np.logical_or(primary_nan_mask[:, :-1, :-1], primary_nan_mask[:, :-1, 1:]),
314
316
  np.logical_or(primary_nan_mask[:, 1:, :-1], primary_nan_mask[:, 1:, 1:]))
317
+
315
318
  if grid.k_gaps:
316
319
  grid.array_cell_geometry_is_defined = np.logical_not(
317
320
  np.logical_or(column_nan_mask[grid.k_raw_index_array], column_nan_mask[grid.k_raw_index_array + 1]))
@@ -333,6 +336,7 @@ def set_geometry_is_defined(grid,
333
336
  partial_pillar_mask = np.logical_and(pillar_defined_mask, np.any(nan_mask, axis = 0).flatten())
334
337
  if np.any(partial_pillar_mask):
335
338
  points.reshape((grid.nk_plus_k_gaps + 1, -1, 3))[:, partial_pillar_mask, :] = np.NaN
339
+ grid.geometry_defined_for_all_pillars_cached = False
336
340
  cells_update_needed = True
337
341
  elif complete_partial_pillars:
338
342
  partial_pillar_mask = np.logical_and(pillar_defined_mask, np.any(nan_mask, axis = 0).flatten())
@@ -356,7 +360,9 @@ def set_geometry_is_defined(grid,
356
360
  (grid.nj + 1, grid.ni + 1)))
357
361
  column_nan_mask = np.logical_or(np.logical_or(top_nan_mask[:-1, :-1], top_nan_mask[:-1, 1:]),
358
362
  np.logical_or(top_nan_mask[1:, :-1], top_nan_mask[1:, 1:]))
359
- grid.array_cell_geometry_is_defined = np.repeat(np.expand_dims(column_nan_mask, 0), grid.nk, axis = 0)
363
+ grid.array_cell_geometry_is_defined = np.repeat(np.logical_not(np.expand_dims(column_nan_mask, 0)),
364
+ grid.nk,
365
+ axis = 0)
360
366
  grid.geometry_defined_for_all_cells_cached = np.all(grid.array_cell_geometry_is_defined)
361
367
  if grid.geometry_defined_for_all_cells_cached:
362
368
  del grid.array_cell_geometry_is_defined
@@ -1,49 +1,70 @@
1
1
  """Classes for RESQML objects related to surfaces."""
2
2
 
3
3
  __all__ = [
4
- 'GridSkin', 'generate_untorn_surface_for_layer_interface', 'generate_torn_surface_for_layer_interface',
5
- 'generate_torn_surface_for_x_section', 'generate_untorn_surface_for_x_section', 'point_is_within_cell',
6
- 'create_column_face_mesh_and_surface', 'find_intersections_of_trajectory_with_surface',
7
- 'find_intersections_of_trajectory_with_layer_interface', 'find_first_intersection_of_trajectory_with_surface',
8
- 'find_first_intersection_of_trajectory_with_layer_interface',
9
- 'find_first_intersection_of_trajectory_with_cell_surface',
10
- 'find_intersection_of_trajectory_interval_with_column_face', 'trajectory_grid_overlap',
11
- 'populate_blocked_well_from_trajectory', 'generate_surface_for_blocked_well_cells',
12
- 'find_faces_to_represent_surface_staffa', 'find_faces_to_represent_surface_regular',
13
- 'find_faces_to_represent_surface_regular_optimised', 'find_faces_to_represent_surface', 'bisector_from_faces',
14
- 'column_bisector_from_faces', 'shadow_from_faces', 'get_boundary', 'where_true', 'first_true', 'intersect_numba'
4
+ "GridSkin",
5
+ "generate_untorn_surface_for_layer_interface",
6
+ "generate_torn_surface_for_layer_interface",
7
+ "generate_torn_surface_for_x_section",
8
+ "generate_untorn_surface_for_x_section",
9
+ "point_is_within_cell",
10
+ "create_column_face_mesh_and_surface",
11
+ "find_intersections_of_trajectory_with_surface",
12
+ "find_intersections_of_trajectory_with_layer_interface",
13
+ "find_first_intersection_of_trajectory_with_surface",
14
+ "find_first_intersection_of_trajectory_with_layer_interface",
15
+ "find_first_intersection_of_trajectory_with_cell_surface",
16
+ "find_intersection_of_trajectory_interval_with_column_face",
17
+ "trajectory_grid_overlap",
18
+ "populate_blocked_well_from_trajectory",
19
+ "generate_surface_for_blocked_well_cells",
20
+ "find_faces_to_represent_surface_staffa",
21
+ "find_faces_to_represent_surface_regular",
22
+ "find_faces_to_represent_surface_regular_optimised",
23
+ "find_faces_to_represent_surface",
24
+ "bisector_from_faces",
25
+ "column_bisector_from_faces",
26
+ "shadow_from_faces",
27
+ "get_boundary",
28
+ "_where_true",
29
+ "_first_true",
30
+ "intersect_numba",
15
31
  ]
16
32
 
17
33
  from ._grid_skin import GridSkin
18
- from ._grid_surface import \
19
- generate_untorn_surface_for_layer_interface, \
20
- generate_torn_surface_for_layer_interface, \
21
- generate_torn_surface_for_x_section, \
22
- generate_untorn_surface_for_x_section, \
23
- point_is_within_cell, \
24
- create_column_face_mesh_and_surface
25
- from ._trajectory_intersects import \
26
- find_intersections_of_trajectory_with_surface, \
27
- find_intersections_of_trajectory_with_layer_interface, \
28
- find_first_intersection_of_trajectory_with_surface, \
29
- find_first_intersection_of_trajectory_with_layer_interface, \
30
- find_first_intersection_of_trajectory_with_cell_surface, \
31
- find_intersection_of_trajectory_interval_with_column_face, \
32
- trajectory_grid_overlap
33
- from ._blocked_well_populate import \
34
- populate_blocked_well_from_trajectory, \
35
- generate_surface_for_blocked_well_cells
36
- from ._find_faces import \
37
- find_faces_to_represent_surface_staffa, \
38
- find_faces_to_represent_surface_regular, \
39
- find_faces_to_represent_surface_regular_optimised, \
40
- find_faces_to_represent_surface, \
41
- bisector_from_faces, \
42
- column_bisector_from_faces, \
43
- shadow_from_faces, \
44
- get_boundary, \
45
- where_true, first_true, \
46
- intersect_numba
34
+ from ._grid_surface import (
35
+ generate_untorn_surface_for_layer_interface,
36
+ generate_torn_surface_for_layer_interface,
37
+ generate_torn_surface_for_x_section,
38
+ generate_untorn_surface_for_x_section,
39
+ point_is_within_cell,
40
+ create_column_face_mesh_and_surface,
41
+ )
42
+ from ._trajectory_intersects import (
43
+ find_intersections_of_trajectory_with_surface,
44
+ find_intersections_of_trajectory_with_layer_interface,
45
+ find_first_intersection_of_trajectory_with_surface,
46
+ find_first_intersection_of_trajectory_with_layer_interface,
47
+ find_first_intersection_of_trajectory_with_cell_surface,
48
+ find_intersection_of_trajectory_interval_with_column_face,
49
+ trajectory_grid_overlap,
50
+ )
51
+ from ._blocked_well_populate import (
52
+ populate_blocked_well_from_trajectory,
53
+ generate_surface_for_blocked_well_cells,
54
+ )
55
+ from ._find_faces import (
56
+ find_faces_to_represent_surface_staffa,
57
+ find_faces_to_represent_surface_regular,
58
+ find_faces_to_represent_surface_regular_optimised,
59
+ find_faces_to_represent_surface,
60
+ bisector_from_faces,
61
+ column_bisector_from_faces,
62
+ shadow_from_faces,
63
+ get_boundary,
64
+ _where_true,
65
+ _first_true,
66
+ intersect_numba,
67
+ )
47
68
 
48
69
  # Set "module" attribute of all public objects to this path.
49
70
  for _name in __all__: