resqpy 4.8.0__py3-none-any.whl → 4.8.2__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.8.0" # Set at build time
31
+ __version__ = "4.8.2" # Set at build time
32
32
  log = logging.getLogger(__name__)
33
33
  log.info(f"Imported resqpy version {__version__}")
@@ -726,7 +726,7 @@ def triangulated_polygons(p, v, centres = None):
726
726
  return points, triangles
727
727
 
728
728
 
729
- def reorient(points, rough = True, max_dip = None, use_linalg = False):
729
+ def reorient(points, rough = True, max_dip = None, use_linalg = True, sample = 500):
730
730
  """Returns a reoriented copy of a set of points, such that z axis is approximate normal to average plane of points.
731
731
 
732
732
  arguments:
@@ -735,7 +735,8 @@ def reorient(points, rough = True, max_dip = None, use_linalg = False):
735
735
  if False, that reduces to around 2.5 degrees of the optimum; iugnored if use_linalg is True
736
736
  max_dip (float, optional): if present, the reorientation of perspective off vertical is
737
737
  limited to this angle in degrees
738
- use_linalg (bool, default False): if True, the numpy linear algebra svd function is used and rough is ignored
738
+ use_linalg (bool, default True): if True, the numpy linear algebra svd function is used and rough is ignored
739
+ sample (int, default 500): downsample points to this number for the purposes of determining normal vector
739
740
 
740
741
  returns:
741
742
  numpy float array of the same shape as points, numpy xyz vector, numpy 3x3 matrix;
@@ -748,7 +749,9 @@ def reorient(points, rough = True, max_dip = None, use_linalg = False):
748
749
  implicit xy & z units for points are assumed to be the same;
749
750
  the function may typically be called prior to the Delauney triangulation, which uses an xy projection to
750
751
  determine the triangulation;
751
- the numpy linear algebra option seems to be memory intensive, not recommended
752
+ the numpy linear algebra option seems to be memory intensive, not recommended;
753
+ downsampling will occur (for normal vector determination) when the number of points exceeds double that
754
+ given in the sample argument; set sample to None to use all points for normal vector determination
752
755
  """
753
756
 
754
757
  def best_angles(points, mid_x, mid_y, steps, d_theta):
@@ -780,8 +783,14 @@ def reorient(points, rough = True, max_dip = None, use_linalg = False):
780
783
 
781
784
  assert points.ndim >= 2 and points.shape[-1] == 3
782
785
 
786
+ if sample is not None and len(points) > 2 * sample:
787
+ step = len(points) // sample
788
+ p = points[::step, :]
789
+ else:
790
+ p = points
791
+
783
792
  if use_linalg:
784
- normal_vector = linalg_normal_vector(points)
793
+ normal_vector = linalg_normal_vector(p)
785
794
  incl = vec.inclination(normal_vector)
786
795
  if incl == 0.0:
787
796
  rotation_m = vec.no_rotation_matrix()
@@ -790,14 +799,14 @@ def reorient(points, rough = True, max_dip = None, use_linalg = False):
790
799
  rotation_m = vec.tilt_3d_matrix(azi, incl)
791
800
  else:
792
801
  # coarse iteration trying a few different angles
793
- best_x_rotation, best_y_rotation = best_angles(points, 0.0, 0.0, 7, 30.0)
802
+ best_x_rotation, best_y_rotation = best_angles(p, 0.0, 0.0, 7, 30.0)
794
803
 
795
804
  # finer iteration searching around the best coarse rotation
796
- best_x_rotation, best_y_rotation = best_angles(points, best_x_rotation, best_y_rotation, 5, 10.0)
805
+ best_x_rotation, best_y_rotation = best_angles(p, best_x_rotation, best_y_rotation, 5, 10.0)
797
806
 
798
807
  if not rough:
799
808
  # finer iteration searching around the best coarse rotation
800
- best_x_rotation, best_y_rotation = best_angles(points, best_x_rotation, best_y_rotation, 7, 2.5)
809
+ best_x_rotation, best_y_rotation = best_angles(p, best_x_rotation, best_y_rotation, 7, 2.5)
801
810
 
802
811
  rotation_m = vec.rotation_3d_matrix((best_x_rotation, 0.0, best_y_rotation))
803
812
 
@@ -809,7 +818,7 @@ def reorient(points, rough = True, max_dip = None, use_linalg = False):
809
818
  if incl > max_dip:
810
819
  azi = vec.azimuth(v)
811
820
  rotation_m = vec.tilt_3d_matrix(azi, max_dip) # TODO: check whether any reverse direction errors here
812
- normal_vector = vec.rotate_vector(rotation_m.T, np.array((0.0, 0.0, 1.0)))
821
+ normal_vector = vec.rotate_vector(rotation_m.T, np.array((0.0, 0.0, 1.0)))
813
822
 
814
823
  p = points.copy()
815
824
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: resqpy
3
- Version: 4.8.0
3
+ Version: 4.8.2
4
4
  Summary: Python API for working with RESQML models
5
5
  Home-page: https://github.com/bp/resqpy
6
6
  License: MIT
@@ -1,4 +1,4 @@
1
- resqpy/__init__.py,sha256=KWQYIVMDZ2NyJw04SLXwao7UTdaSKVeUndtfWPQbh1A,555
1
+ resqpy/__init__.py,sha256=Zh3CSU4YDhZyyZNCbVFR7kXCGBKp7uGvRzZlXBy8xFk,555
2
2
  resqpy/crs.py,sha256=iq0lO3aXzttmJBfuhUjS9IHlv8OV1wuByhFk0b4fvmI,24782
3
3
  resqpy/derived_model/__init__.py,sha256=NFvMSOKI3cxmH7lAbddV43JjoUj-r2G7ExEfOqinD1I,1982
4
4
  resqpy/derived_model/_add_edges_per_column_property_array.py,sha256=cpW3gwp6MSYIrtvFmCjoJXcyUsgGuCDbgmwlJCJebUs,6410
@@ -95,7 +95,7 @@ resqpy/olio/simple_lines.py,sha256=qaR11W5UPgRmtMeFQ-pXg0jOvkJZ_XPzSUpAXqeYtlc,1
95
95
  resqpy/olio/time.py,sha256=LtoSIf1A6wunHSpDgKsSGEr0rbcSQyy35TgJvY37PrI,760
96
96
  resqpy/olio/trademark.py,sha256=p_EWvUUnfalOA0RC94fSWMDgdGY9-FdZuGtAjg3wNcY,822
97
97
  resqpy/olio/transmission.py,sha256=ojMRvzMOulb-S3FHnkR3ouIBTXA4knI0drDOt_WACso,61869
98
- resqpy/olio/triangulation.py,sha256=VrZB2pgLc9M_EhMorNR16L5bqEUWjae4q0EuuXQEJ6o,44288
98
+ resqpy/olio/triangulation.py,sha256=i5jB342ub_7j6H4ft4q2iPTrnQa94hJ3jDHmdTzheFw,44768
99
99
  resqpy/olio/uuid.py,sha256=JRMi-RZNeGm8tGNloIwTATzNtdj29lBQDV9OILboPRI,7324
100
100
  resqpy/olio/vdb.py,sha256=lQYuK1kr1Wnucq2EoKgT6lrR7vloCemnCKZktzBcLUc,45231
101
101
  resqpy/olio/vector_utilities.py,sha256=Oe5NGOnV_wNExlcevBnLdP30XbvTM-4YnLmbgM4bDDk,46253
@@ -192,7 +192,7 @@ resqpy/well/_wellbore_marker_frame.py,sha256=xvYH2_2Ie3a18LReFymbUrZboOx7Rhv5DOD
192
192
  resqpy/well/blocked_well_frame.py,sha256=Lg7TgynfPv9WkklXTLt9VN6uBXWUqX1LI-Xmv_FBqYk,22555
193
193
  resqpy/well/well_object_funcs.py,sha256=LdktgZ1X-ABQ2R-DArRxGK_Pf2OjrMr-bvH3dbXBFas,24743
194
194
  resqpy/well/well_utils.py,sha256=zwpYjT85nXAwWBhYB1Pygu2SgouZ-44k6hEOnpoMfBI,5969
195
- resqpy-4.8.0.dist-info/LICENSE,sha256=2duHPIkKQyESMdQ4hKjL8CYEsYRHXaYxt0YQkzsUYE4,1059
196
- resqpy-4.8.0.dist-info/METADATA,sha256=K-vW8HebhULcpIDM4b3pfn8JECgp3172zLS_OcDZlgU,4156
197
- resqpy-4.8.0.dist-info/WHEEL,sha256=7Z8_27uaHI_UZAc4Uox4PpBhQ9Y5_modZXWMxtUi4NU,88
198
- resqpy-4.8.0.dist-info/RECORD,,
195
+ resqpy-4.8.2.dist-info/LICENSE,sha256=2duHPIkKQyESMdQ4hKjL8CYEsYRHXaYxt0YQkzsUYE4,1059
196
+ resqpy-4.8.2.dist-info/METADATA,sha256=trapyc6jZxugi5SP-dSkBA_4n5L4gj-G4fIx4dJAmXk,4156
197
+ resqpy-4.8.2.dist-info/WHEEL,sha256=7Z8_27uaHI_UZAc4Uox4PpBhQ9Y5_modZXWMxtUi4NU,88
198
+ resqpy-4.8.2.dist-info/RECORD,,
File without changes