xtgeo 4.8.0__cp313-cp313-win_amd64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of xtgeo might be problematic. Click here for more details.

Files changed (117) hide show
  1. cxtgeo.py +582 -0
  2. cxtgeoPYTHON_wrap.c +20938 -0
  3. xtgeo/__init__.py +246 -0
  4. xtgeo/_cxtgeo.cp313-win_amd64.pyd +0 -0
  5. xtgeo/_internal.cp313-win_amd64.pyd +0 -0
  6. xtgeo/common/__init__.py +19 -0
  7. xtgeo/common/_angles.py +29 -0
  8. xtgeo/common/_xyz_enum.py +50 -0
  9. xtgeo/common/calc.py +396 -0
  10. xtgeo/common/constants.py +30 -0
  11. xtgeo/common/exceptions.py +42 -0
  12. xtgeo/common/log.py +93 -0
  13. xtgeo/common/sys.py +166 -0
  14. xtgeo/common/types.py +18 -0
  15. xtgeo/common/version.py +21 -0
  16. xtgeo/common/xtgeo_dialog.py +604 -0
  17. xtgeo/cube/__init__.py +9 -0
  18. xtgeo/cube/_cube_export.py +214 -0
  19. xtgeo/cube/_cube_import.py +532 -0
  20. xtgeo/cube/_cube_roxapi.py +180 -0
  21. xtgeo/cube/_cube_utils.py +287 -0
  22. xtgeo/cube/_cube_window_attributes.py +340 -0
  23. xtgeo/cube/cube1.py +1023 -0
  24. xtgeo/grid3d/__init__.py +15 -0
  25. xtgeo/grid3d/_ecl_grid.py +774 -0
  26. xtgeo/grid3d/_ecl_inte_head.py +148 -0
  27. xtgeo/grid3d/_ecl_logi_head.py +71 -0
  28. xtgeo/grid3d/_ecl_output_file.py +81 -0
  29. xtgeo/grid3d/_egrid.py +1004 -0
  30. xtgeo/grid3d/_find_gridprop_in_eclrun.py +625 -0
  31. xtgeo/grid3d/_grdecl_format.py +266 -0
  32. xtgeo/grid3d/_grdecl_grid.py +388 -0
  33. xtgeo/grid3d/_grid3d.py +29 -0
  34. xtgeo/grid3d/_grid3d_fence.py +181 -0
  35. xtgeo/grid3d/_grid3d_utils.py +228 -0
  36. xtgeo/grid3d/_grid_boundary.py +76 -0
  37. xtgeo/grid3d/_grid_etc1.py +1566 -0
  38. xtgeo/grid3d/_grid_export.py +221 -0
  39. xtgeo/grid3d/_grid_hybrid.py +66 -0
  40. xtgeo/grid3d/_grid_import.py +79 -0
  41. xtgeo/grid3d/_grid_import_ecl.py +101 -0
  42. xtgeo/grid3d/_grid_import_roff.py +135 -0
  43. xtgeo/grid3d/_grid_import_xtgcpgeom.py +375 -0
  44. xtgeo/grid3d/_grid_refine.py +125 -0
  45. xtgeo/grid3d/_grid_roxapi.py +292 -0
  46. xtgeo/grid3d/_grid_wellzone.py +165 -0
  47. xtgeo/grid3d/_gridprop_export.py +178 -0
  48. xtgeo/grid3d/_gridprop_import_eclrun.py +164 -0
  49. xtgeo/grid3d/_gridprop_import_grdecl.py +130 -0
  50. xtgeo/grid3d/_gridprop_import_roff.py +52 -0
  51. xtgeo/grid3d/_gridprop_import_xtgcpprop.py +168 -0
  52. xtgeo/grid3d/_gridprop_lowlevel.py +171 -0
  53. xtgeo/grid3d/_gridprop_op1.py +174 -0
  54. xtgeo/grid3d/_gridprop_roxapi.py +239 -0
  55. xtgeo/grid3d/_gridprop_value_init.py +140 -0
  56. xtgeo/grid3d/_gridprops_import_eclrun.py +344 -0
  57. xtgeo/grid3d/_gridprops_import_roff.py +83 -0
  58. xtgeo/grid3d/_roff_grid.py +469 -0
  59. xtgeo/grid3d/_roff_parameter.py +303 -0
  60. xtgeo/grid3d/grid.py +2537 -0
  61. xtgeo/grid3d/grid_properties.py +699 -0
  62. xtgeo/grid3d/grid_property.py +1341 -0
  63. xtgeo/grid3d/types.py +15 -0
  64. xtgeo/io/__init__.py +1 -0
  65. xtgeo/io/_file.py +592 -0
  66. xtgeo/metadata/__init__.py +17 -0
  67. xtgeo/metadata/metadata.py +431 -0
  68. xtgeo/roxutils/__init__.py +7 -0
  69. xtgeo/roxutils/_roxar_loader.py +54 -0
  70. xtgeo/roxutils/_roxutils_etc.py +122 -0
  71. xtgeo/roxutils/roxutils.py +207 -0
  72. xtgeo/surface/__init__.py +18 -0
  73. xtgeo/surface/_regsurf_boundary.py +26 -0
  74. xtgeo/surface/_regsurf_cube.py +210 -0
  75. xtgeo/surface/_regsurf_cube_window.py +391 -0
  76. xtgeo/surface/_regsurf_cube_window_v2.py +297 -0
  77. xtgeo/surface/_regsurf_cube_window_v3.py +360 -0
  78. xtgeo/surface/_regsurf_export.py +388 -0
  79. xtgeo/surface/_regsurf_grid3d.py +271 -0
  80. xtgeo/surface/_regsurf_gridding.py +347 -0
  81. xtgeo/surface/_regsurf_ijxyz_parser.py +278 -0
  82. xtgeo/surface/_regsurf_import.py +347 -0
  83. xtgeo/surface/_regsurf_lowlevel.py +122 -0
  84. xtgeo/surface/_regsurf_oper.py +631 -0
  85. xtgeo/surface/_regsurf_roxapi.py +241 -0
  86. xtgeo/surface/_regsurf_utils.py +81 -0
  87. xtgeo/surface/_surfs_import.py +43 -0
  88. xtgeo/surface/_zmap_parser.py +138 -0
  89. xtgeo/surface/regular_surface.py +2967 -0
  90. xtgeo/surface/surfaces.py +276 -0
  91. xtgeo/well/__init__.py +24 -0
  92. xtgeo/well/_blockedwell_roxapi.py +221 -0
  93. xtgeo/well/_blockedwells_roxapi.py +68 -0
  94. xtgeo/well/_well_aux.py +30 -0
  95. xtgeo/well/_well_io.py +327 -0
  96. xtgeo/well/_well_oper.py +574 -0
  97. xtgeo/well/_well_roxapi.py +304 -0
  98. xtgeo/well/_wellmarkers.py +486 -0
  99. xtgeo/well/_wells_utils.py +158 -0
  100. xtgeo/well/blocked_well.py +216 -0
  101. xtgeo/well/blocked_wells.py +122 -0
  102. xtgeo/well/well1.py +1514 -0
  103. xtgeo/well/wells.py +211 -0
  104. xtgeo/xyz/__init__.py +6 -0
  105. xtgeo/xyz/_polygons_oper.py +272 -0
  106. xtgeo/xyz/_xyz.py +741 -0
  107. xtgeo/xyz/_xyz_data.py +646 -0
  108. xtgeo/xyz/_xyz_io.py +490 -0
  109. xtgeo/xyz/_xyz_lowlevel.py +42 -0
  110. xtgeo/xyz/_xyz_oper.py +613 -0
  111. xtgeo/xyz/_xyz_roxapi.py +766 -0
  112. xtgeo/xyz/points.py +681 -0
  113. xtgeo/xyz/polygons.py +811 -0
  114. xtgeo-4.8.0.dist-info/METADATA +145 -0
  115. xtgeo-4.8.0.dist-info/RECORD +117 -0
  116. xtgeo-4.8.0.dist-info/WHEEL +5 -0
  117. xtgeo-4.8.0.dist-info/licenses/LICENSE.md +165 -0
xtgeo/xyz/_xyz.py ADDED
@@ -0,0 +1,741 @@
1
+ """XTGeo XYZ module (abstract base class)"""
2
+
3
+ from __future__ import annotations
4
+
5
+ from abc import ABC, abstractmethod
6
+ from typing import TYPE_CHECKING, TypeVar
7
+ from warnings import warn
8
+
9
+ import numpy as np
10
+
11
+ from xtgeo.common._xyz_enum import _AttrName, _XYZType
12
+ from xtgeo.common.log import null_logger
13
+ from xtgeo.common.xtgeo_dialog import XTGDescription, XTGeoDialog
14
+
15
+ from . import _xyz_oper
16
+
17
+ if TYPE_CHECKING:
18
+ import pandas as pd
19
+
20
+
21
+ xtg = XTGeoDialog()
22
+ logger = null_logger(__name__)
23
+
24
+ Polygons = TypeVar("Polygons")
25
+
26
+
27
+ class XYZ(ABC):
28
+ """Abstract base class for XYZ objects, i.e. Points and Polygons in XTGeo.
29
+
30
+ The XYZ base class has common methods and properties for Points and Polygons. The
31
+ underlying data storage is a Pandas dataframe with minimal 3 (Points) or 4
32
+ (Polygons) columns, where the two first represent X and Y coordinates.
33
+
34
+ The third column is a number, which may represent the depth, thickness, or other
35
+ property. For Polygons, there is a 4'th column which is an integer representing
36
+ poly-line ID, which is handled in the Polygons class. Similarly, Points and Polygons
37
+ can have additional columns called `attributes`.
38
+
39
+ Note:
40
+ You cannot use the XYZ class directly. Use the :class:`Points` or
41
+ :class:`Polygons` classes!
42
+ """
43
+
44
+ def __init__(
45
+ self,
46
+ xyztype: _XYZType,
47
+ xname: str = _AttrName.XNAME.value,
48
+ yname: str = _AttrName.YNAME.value,
49
+ zname: str = _AttrName.ZNAME.value,
50
+ ):
51
+ """Concrete initialisation for base class _XYZ."""
52
+ self._xyztype = xyztype
53
+ self._xname = xname
54
+ self._yname = yname
55
+ self._zname = zname
56
+
57
+ @property
58
+ def xyztype(self):
59
+ """Read only, returns the type of XYZ data (POINTS, POLYGONS, ...)"""
60
+ return self._xyztype
61
+
62
+ @property
63
+ def xname(self):
64
+ """Returns or set the name of the X column."""
65
+ return self._xname
66
+
67
+ @xname.setter
68
+ def xname(self, newname):
69
+ self._df_column_rename(newname, self._xname)
70
+ self._xname = newname
71
+
72
+ @property
73
+ def yname(self):
74
+ """Returns or set the name of the Y column."""
75
+ return self._yname
76
+
77
+ @yname.setter
78
+ def yname(self, newname):
79
+ self._df_column_rename(newname, self._yname)
80
+ self._yname = newname
81
+
82
+ @property
83
+ def zname(self):
84
+ """Returns or set the name of the Z column."""
85
+ return self._zname
86
+
87
+ @zname.setter
88
+ def zname(self, newname):
89
+ self._df_column_rename(newname, self._zname)
90
+ self._zname = newname
91
+
92
+ @property
93
+ @abstractmethod
94
+ def dataframe(self) -> pd.DataFrame:
95
+ """Return or set the Pandas dataframe object."""
96
+ ...
97
+
98
+ @property
99
+ def nrow(self):
100
+ """Returns the Pandas dataframe object number of rows."""
101
+ if self.get_dataframe(copy=False) is None:
102
+ return 0
103
+ return len(self.get_dataframe(copy=False).index)
104
+
105
+ def _dataframe_consistency_check(self):
106
+ dataframe = self.get_dataframe(copy=False)
107
+ if self.xname not in dataframe:
108
+ raise ValueError(
109
+ f"xname={self.xname} is not a column of dataframe {dataframe.columns}"
110
+ )
111
+ if self.yname not in dataframe:
112
+ raise ValueError(
113
+ f"yname={self.yname} is not a column of dataframe {dataframe.columns}"
114
+ )
115
+ if self.zname not in dataframe:
116
+ raise ValueError(
117
+ f"zname={self.zname} is not a column of dataframe {dataframe.columns}"
118
+ )
119
+ if self._xyztype == _XYZType.POLYGONS.value and self.pname not in dataframe:
120
+ raise ValueError(
121
+ f"pname={self.pname} is not a column of dataframe {dataframe.columns}"
122
+ )
123
+ for attr in self._attrs:
124
+ if attr not in dataframe:
125
+ raise ValueError(
126
+ f"Attribute {attr} is not a column of dataframe {dataframe.columns}"
127
+ )
128
+
129
+ def _df_column_rename(self, newname, oldname):
130
+ if isinstance(newname, str):
131
+ if oldname and self.get_dataframe(copy=False) is not None:
132
+ dataframe = self.get_dataframe()
133
+ dataframe.rename(columns={oldname: newname}, inplace=True)
134
+ self.set_dataframe(dataframe)
135
+ else:
136
+ raise ValueError(f"Wrong type of input to {newname}; must be string")
137
+
138
+ def _check_name_and_replace(self, oldname, newname):
139
+ """Replace name of a column, doing some checks."""
140
+ if not isinstance(newname, str):
141
+ raise ValueError(
142
+ f"Wrong type of input; must be string, was {type(newname)}"
143
+ )
144
+
145
+ if oldname not in self.get_dataframe(copy=False).columns:
146
+ raise ValueError(
147
+ f"The column {oldname} does not exist as a column name, must be "
148
+ f"one of: f{self.get_dataframe(copy=False).columns}. Likely a bug!"
149
+ )
150
+ # check that newname not already there; will be ambigious
151
+ if newname in self.get_dataframe(copy=False).columns:
152
+ raise ValueError(
153
+ f"The column {newname} does already exist as a column name:"
154
+ f"f{self.get_dataframe(copy=False).columns}. The new name "
155
+ "must be unique!"
156
+ )
157
+
158
+ # replace column name
159
+ df = self.get_dataframe(copy=True)
160
+ df.rename(columns={oldname: newname}, inplace=True)
161
+ self.set_dataframe(df)
162
+
163
+ @abstractmethod
164
+ def copy(self):
165
+ """Returns a deep copy of an instance"""
166
+ ...
167
+
168
+ def describe(self, flush=True):
169
+ """Describe an instance by printing to stdout"""
170
+
171
+ dsc = XTGDescription()
172
+ dsc.title(f"Description of {self.__class__.__name__} instance")
173
+ dsc.txt("Object ID", id(self))
174
+ dsc.txt("xname, yname, zname", self._xname, self._yname, self._zname)
175
+
176
+ if flush:
177
+ dsc.flush()
178
+ return None
179
+
180
+ return dsc.astext()
181
+
182
+ @abstractmethod
183
+ def get_dataframe(self, copy=True) -> pd.DataFrame:
184
+ """Return the Pandas dataframe object."""
185
+ ...
186
+
187
+ @abstractmethod
188
+ def set_dataframe(self, dataframe: pd.DataFrame) -> None:
189
+ """Set the Pandas dataframe object."""
190
+ ...
191
+
192
+ def protected_columns(self):
193
+ """
194
+ Returns:
195
+ Columns not deleted by :meth:`delete_columns`, for
196
+ instance the coordinate columns.
197
+ """
198
+ return [self.xname, self.yname, self.zname]
199
+
200
+ def geometry_columns(self):
201
+ """
202
+ Returns:
203
+ Columns can be deleted silently by :meth:`delete_columns`
204
+ """
205
+ return [self.hname, self.dhname, self.tname, self.dtname]
206
+
207
+ def delete_columns(self, clist, strict=False):
208
+ """Delete one or more columns by name.
209
+
210
+ Note that the columns returned by :meth:`protected_columns(self)` (for
211
+ instance, the coordinate columns) will not be deleted.
212
+
213
+ Args:
214
+ self (obj): Points or Polygons
215
+ clist (list): Name of columns
216
+ strict (bool): I False, will not trigger exception if a column is not
217
+ found. Otherways a ValueError will be raised.
218
+
219
+ Raises:
220
+ ValueError: If strict is True and columnname not present
221
+
222
+ Example::
223
+ mypoly.delete_columns(["WELL_ID", mypoly.hname, mypoly.dhname])
224
+
225
+ .. versionadded:: 2.1
226
+ """
227
+ for cname in clist:
228
+ if cname in self.protected_columns():
229
+ xtg.warnuser(
230
+ f"The column {cname} is protected and will not be deleted."
231
+ )
232
+ continue
233
+
234
+ if cname in self.geometry_columns():
235
+ if strict:
236
+ raise ValueError(f"The column {cname} is not present.")
237
+ logger.info(
238
+ "The column %s is a geometry and will not be deleted.", cname
239
+ )
240
+ continue
241
+
242
+ dataframe = self.get_dataframe()
243
+ if cname not in dataframe:
244
+ if strict:
245
+ raise ValueError(f"The column {cname} is not present.")
246
+ logger.info("Trying to delete %s, but it is not present.", cname)
247
+ else:
248
+ dataframe.drop(cname, axis=1, inplace=True)
249
+ self.set_dataframe(dataframe)
250
+
251
+ def get_nwells(self, well_name_column: str = "WellName"):
252
+ """Get number of unique wells in the instance.
253
+
254
+ Args:
255
+ well_name_column: Name of column with well names
256
+
257
+ Returns:
258
+ Number of unique wells, 0 if no well or column not present.
259
+ """
260
+ if well_name_column not in self.get_dataframe(copy=False).columns:
261
+ return 0
262
+ return len(self.get_dataframe(copy=False)[well_name_column].unique())
263
+
264
+ def get_boundary(self):
265
+ """Get the square XYZ window (boundaries) of the instance.
266
+
267
+ Returns:
268
+ (xmin, xmax, ymin, ymax, zmin, zmax)
269
+
270
+ See also:
271
+ The class method :func:`Polygons.boundary_from_points()`
272
+
273
+ """
274
+ xmin = np.nanmin(self.get_dataframe(copy=False)[self.xname].values)
275
+ xmax = np.nanmax(self.get_dataframe(copy=False)[self.xname].values)
276
+ ymin = np.nanmin(self.get_dataframe(copy=False)[self.yname].values)
277
+ ymax = np.nanmax(self.get_dataframe(copy=False)[self.yname].values)
278
+ zmin = np.nanmin(self.get_dataframe(copy=False)[self.zname].values)
279
+ zmax = np.nanmax(self.get_dataframe(copy=False)[self.zname].values)
280
+
281
+ return (xmin, xmax, ymin, ymax, zmin, zmax)
282
+
283
+ def mark_in_polygons(
284
+ self,
285
+ poly: Polygons | list[Polygons], # noqa: F821
286
+ name: str = "pstatus",
287
+ inside_value: int = 1,
288
+ outside_value: int = 0,
289
+ ):
290
+ """Add a column that assign values if points are inside or outside polygons.
291
+
292
+ This is a generic function that adds a column in the points dataframe with
293
+ a flag for values being inside or outside polygons in a Polygons instance.
294
+
295
+ Args:
296
+ poly: One single xtgeo Polgons instance, or a list of Polygons instances.
297
+ name: Name of column that flags inside or outside status
298
+ inside_value: Flag value for being inside polygons
299
+ outside_value: Flag value for being outside polygons
300
+
301
+ ..versionadded:: 3.2
302
+ """
303
+ _xyz_oper.mark_in_polygons_mpl(self, poly, name, inside_value, outside_value)
304
+
305
+ def operation_polygons(
306
+ self,
307
+ poly: Polygons | list[Polygons], # noqa: F821
308
+ value: float,
309
+ opname: str = "add",
310
+ inside: bool = True,
311
+ version: int = 1,
312
+ ):
313
+ """A generic function for operations restricted to inside or outside polygon(s).
314
+
315
+ The operations are performed on the Z values, while the 'inside' or 'outside'
316
+ of polygons are purely based on X and Y values (typically X is East and Y in
317
+ North coordinates).
318
+
319
+ The operations are XYZ generic i.e. done on the points that defines the
320
+ Polygon or the point in Points, depending on the calling instance.
321
+
322
+ Possible ``opname`` strings:
323
+
324
+ * ``add``: add the value
325
+ * ``sub``: substract the value
326
+ * ``mul``: multiply the value
327
+ * ``div``: divide the value
328
+ * ``set``: replace current values with value
329
+ * ``eli``: eliminate; here value is not applied
330
+
331
+ Args:
332
+ poly: A single Polygons instance or a list of Polygons instances.
333
+ The list option is only allowed when version = 2
334
+ value: Value to add, subtract etc
335
+ opname: Name of operation... 'add', 'sub', etc
336
+ inside: If True do operation inside polygons; else outside. Note
337
+ that boundary is treated as 'inside'
338
+ version: The algorithm version, see notes below. Although version 1
339
+ is default, version 2 is recommended as it is much faster and works
340
+ intuitively when have multiple polygons and/or using the
341
+ `is_inside=False` (i.e. outside)
342
+
343
+ Note:
344
+ ``version=1``: This function works only intuitively when using one single
345
+ polygon in the ``poly`` instance. When having several polygons the
346
+ operation is done sequentially per polygon which may
347
+ lead to surprising results. For instance, using "add inside"
348
+ into two overlapping polygons, the addition will be doubled in the
349
+ overlapping part. Similarly, using e.g. "eli, outside" will completely
350
+ remove all points of two non-overlapping polygons are given as input.
351
+
352
+ ``version=2``: This is a new and recommended implementation. It works
353
+ much faster and intuitively for both inside and outside, overlapping and
354
+ multiple polygons within a Polygons instance.
355
+
356
+ .. versionchanged:: 3.2 Add ``version`` option which defaults to 1.
357
+ Also allow that ``poly`` option can be a list of Polygons
358
+ when version is 2.
359
+
360
+ """
361
+ if version == 2:
362
+ _xyz_oper.operation_polygons_v2(
363
+ self, poly, value, opname=opname, inside=inside
364
+ )
365
+ else:
366
+ _xyz_oper.operation_polygons_v1(
367
+ self, poly, value, opname=opname, inside=inside
368
+ )
369
+ if version == 0:
370
+ # using version 0 INTERNALLY to mark that "add_inside" etc has been
371
+ # applied, and now raise a generic deprecation warning:
372
+ itxt = "inside" if inside else "outside"
373
+ warn(
374
+ f"You are using the method '{opname}_{itxt}()'; this will "
375
+ "be deprecated in future versions. Consider using "
376
+ f"'{opname}_{itxt}_polygons()' instead which is both faster "
377
+ "and works intuitively when several and/or overlapping polygons",
378
+ DeprecationWarning,
379
+ )
380
+
381
+ def add_inside(self, poly, value):
382
+ """Add a value (scalar) to points inside polygons (old behaviour).
383
+
384
+ Args:
385
+ poly: A xtgeo Polygons instance
386
+ value: Value to add to Z values inside polygons.
387
+
388
+ See notes under :meth:`operation_polygons()` and consider instead
389
+ :meth:`add_inside polygons()`.
390
+ """
391
+ self.operation_polygons(poly, value, opname="add", inside=True, version=0)
392
+
393
+ def add_inside_polygons(
394
+ self,
395
+ poly: Polygons | list[Polygons],
396
+ value: float, # noqa: F821
397
+ ):
398
+ """Add a value (scalar) to points inside polygons (new behaviour).
399
+
400
+ This is an improved implementation than :meth:`add_inside()`, and is now the
401
+ recommended method, as it is both faster and works similar for all single
402
+ and overlapping sub-polygons within one or more Polygons instances.
403
+
404
+ Args:
405
+ poly: A xtgeo Polygons instance, or a list of xtgeo Polygons instances
406
+ value: Value to add to Z values inside polygons.
407
+
408
+ .. versionadded:: 3.2
409
+ """
410
+ self.operation_polygons(poly, value, opname="add", inside=True, version=2)
411
+
412
+ def add_outside(self, poly, value):
413
+ """Add a value (scalar) to points outside polygons (old behaviour).
414
+
415
+ Args:
416
+ poly: A xtgeo Polygons instance
417
+ value: Value to add to Z values outside polygons.
418
+
419
+ See notes under :meth:`operation_polygons()` and consider instead
420
+ :meth:`add_outside polygons()`.
421
+ """
422
+ self.operation_polygons(poly, value, opname="add", inside=False, version=0)
423
+
424
+ def add_outside_polygons(
425
+ self,
426
+ poly: Polygons | list[Polygons],
427
+ value: float, # noqa: F821
428
+ ):
429
+ """Add a value (scalar) to points outside polygons (new behaviour).
430
+
431
+ This is an improved implementation than :meth:`add_outside()`, and is now the
432
+ recommended method, as it is both faster and works similar for all single
433
+ and overlapping sub-polygons within one or more Polygons instances.
434
+
435
+ Args:
436
+ poly: A xtgeo Polygons instance, or a list of xtgeo Polygons instances
437
+ value: Value to add to Z values outside polygons.
438
+
439
+ .. versionadded:: 3.2
440
+ """
441
+ self.operation_polygons(poly, value, opname="add", inside=False, version=2)
442
+
443
+ def sub_inside(self, poly, value):
444
+ """Subtract a value (scalar) to points inside polygons.
445
+
446
+ Args:
447
+ poly: A xtgeo Polygons instance
448
+ value: Value to subtract to Z values inside polygons.
449
+
450
+ See notes under :meth:`operation_polygons()` and consider instead
451
+ :meth:`sub_inside polygons()`.
452
+ """
453
+ self.operation_polygons(poly, value, opname="sub", inside=True, version=1)
454
+
455
+ def sub_inside_polygons(
456
+ self,
457
+ poly: Polygons | list[Polygons],
458
+ value: float, # noqa: F821
459
+ ):
460
+ """Subtract a value (scalar) for points inside polygons (new behaviour).
461
+
462
+ This is an improved implementation than :meth:`sub_inside()`, and is now the
463
+ recommended method, as it is both faster and works similar for all single
464
+ and overlapping sub-polygons within one or more Polygons instances.
465
+
466
+ Args:
467
+ poly: A xtgeo Polygons instance, or a list of xtgeo Polygons instances
468
+ value: Value to subtract to Z values inside polygons.
469
+
470
+ .. versionadded:: 3.2
471
+ """
472
+ self.operation_polygons(poly, value, opname="sub", inside=True, version=2)
473
+
474
+ def sub_outside(self, poly, value):
475
+ """Subtract a value (scalar) to points outside polygons.
476
+
477
+ Args:
478
+ poly: A xtgeo Polygons instance
479
+ value: Value to subtract to Z values outside polygons.
480
+
481
+ See notes under :meth:`operation_polygons()` and consider instead
482
+ :meth:`sub_outside polygons()`.
483
+ """
484
+ self.operation_polygons(poly, value, opname="sub", inside=False, version=0)
485
+
486
+ def sub_outside_polygons(
487
+ self,
488
+ poly: Polygons | list[Polygons],
489
+ value: float, # noqa: F821
490
+ ):
491
+ """Subtract a value (scalar) for points outside polygons (new behaviour).
492
+
493
+ This is an improved implementation than :meth:`sub_outside()`, and is now the
494
+ recommended method, as it is both faster and works similar for all single
495
+ and overlapping sub-polygons within one or more Polygons instances.
496
+
497
+ Args:
498
+ poly: A xtgeo Polygons instance, or a list of xtgeo Polygons instances
499
+ value: Value to subtract to Z values outside polygons.
500
+
501
+ .. versionadded:: 3.2
502
+ """
503
+ self.operation_polygons(poly, value, opname="sub", inside=False, version=2)
504
+
505
+ def mul_inside(self, poly, value):
506
+ """Multiply a value (scalar) to points inside polygons.
507
+
508
+ Args:
509
+ poly: A xtgeo Polygons instance
510
+ value: Value to multiply to Z values inside polygons.
511
+
512
+ See notes under :meth:`operation_polygons()` and consider instead
513
+ :meth:`mul_inside polygons()`.
514
+ """
515
+ self.operation_polygons(poly, value, opname="mul", inside=True, version=0)
516
+
517
+ def mul_inside_polygons(
518
+ self,
519
+ poly: Polygons | list[Polygons],
520
+ value: float, # noqa: F821
521
+ ):
522
+ """Multiply a value (scalar) for points inside polygons (new behaviour).
523
+
524
+ This is an improved implementation than :meth:`mul_inside()`, and is now the
525
+ recommended method, as it is both faster and works similar for all single
526
+ and overlapping sub-polygons within one or more Polygons instances.
527
+
528
+ Args:
529
+ poly: A xtgeo Polygons instance, or a list of xtgeo Polygons instances
530
+ value: Value to multiply to Z values inside polygons.
531
+
532
+ .. versionadded:: 3.2
533
+ """
534
+ self.operation_polygons(poly, value, opname="mul", inside=True, version=2)
535
+
536
+ def mul_outside(self, poly, value):
537
+ """Multiply a value (scalar) to points outside polygons.
538
+
539
+ Args:
540
+ poly: A xtgeo Polygons instance
541
+ value: Value to multiply to Z values outside polygons.
542
+
543
+ See notes under :meth:`operation_polygons()` and consider instead
544
+ :meth:`mul_outside polygons()`.
545
+ """
546
+ self.operation_polygons(poly, value, opname="mul", inside=False, version=0)
547
+
548
+ def mul_outside_polygons(
549
+ self,
550
+ poly: Polygons | list[Polygons],
551
+ value: float, # noqa: F821
552
+ ):
553
+ """Multiply a value (scalar) for points outside polygons (new behaviour).
554
+
555
+ This is an improved implementation than :meth:`mul_outside()`, and is now the
556
+ recommended method, as it is both faster and works similar for all single
557
+ and overlapping sub-polygons within one or more Polygons instances.
558
+
559
+ Args:
560
+ poly: A xtgeo Polygons instance, or a list of xtgeo Polygons instances
561
+ value: Value to multiply to Z values outside polygons.
562
+
563
+ .. versionadded:: 3.2
564
+ """
565
+ self.operation_polygons(poly, value, opname="mul", inside=False, version=2)
566
+
567
+ def div_inside(self, poly, value):
568
+ """Divide a value (scalar) to points inside polygons.
569
+
570
+ Args:
571
+ poly: A xtgeo Polygons instance
572
+ value: Value to divide Z values inside polygons.
573
+
574
+ See notes under :meth:`operation_polygons()` and consider instead
575
+ :meth:`div_inside polygons()`.
576
+ """
577
+ self.operation_polygons(poly, value, opname="div", inside=True, version=0)
578
+
579
+ def div_inside_polygons(
580
+ self,
581
+ poly: Polygons | list[Polygons],
582
+ value: float, # noqa: F821
583
+ ):
584
+ """Divide a value (scalar) for points inside polygons (new behaviour).
585
+
586
+ This is an improved implementation than :meth:`div_inside()`, and is now the
587
+ recommended method, as it is both faster and works similar for all single
588
+ and overlapping sub-polygons within one or more Polygons instances.
589
+
590
+ Args:
591
+ poly: A xtgeo Polygons instance, or a list of xtgeo Polygons instances
592
+ value: Value to divide to Z values inside polygons.
593
+
594
+ .. versionadded:: 3.2
595
+ """
596
+ self.operation_polygons(poly, value, opname="div", inside=True, version=2)
597
+
598
+ def div_outside(self, poly, value):
599
+ """Divide a value (scalar) outside polygons (value 0.0 will give result 0).
600
+
601
+ Args:
602
+ poly: A xtgeo Polygons instance
603
+ value: Value to divide Z values outside polygons.
604
+
605
+ See notes under :meth:`operation_polygons()` and consider instead
606
+ :meth:`div_outside polygons()`.
607
+ """
608
+ self.operation_polygons(poly, value, opname="div", inside=False, version=0)
609
+
610
+ def div_outside_polygons(
611
+ self,
612
+ poly: Polygons | list[Polygons],
613
+ value: float, # noqa: F821
614
+ ):
615
+ """Divide a value (scalar) for points outside polygons (new behaviour).
616
+
617
+ Note if input value is 0.0 (division on zero), the result will be 0.0.
618
+
619
+ This is an improved implementation than :meth:`div_outside()`, and is now the
620
+ recommended method, as it is both faster and works similar for all single
621
+ and overlapping sub-polygons within one or more Polygons instances.
622
+
623
+ Args:
624
+ poly: A xtgeo Polygons instance, or a list of xtgeo Polygons instances
625
+ value: Value to divide to Z values outside polygons.
626
+
627
+ .. versionadded:: 3.2
628
+ """
629
+ self.operation_polygons(poly, value, opname="div", inside=False, version=2)
630
+
631
+ def set_inside(self, poly, value):
632
+ """Set a value (scalar) to points inside polygons.
633
+
634
+ Args:
635
+ poly: A xtgeo Polygons instance
636
+ value: Value to set Z values inside polygons.
637
+
638
+ See notes under :meth:`operation_polygons()` and consider instead
639
+ :meth:`set_inside polygons()`.
640
+ """
641
+ self.operation_polygons(poly, value, opname="set", inside=True, version=0)
642
+
643
+ def set_inside_polygons(
644
+ self,
645
+ poly: Polygons | list[Polygons],
646
+ value: float, # noqa: F821
647
+ ):
648
+ """Set a value (scalar) for points inside polygons (new behaviour).
649
+
650
+ This is an improved implementation than :meth:`set_inside()`, and is now the
651
+ recommended method, as it is both faster and works similar for all single
652
+ and overlapping sub-polygons within one or more Polygons instances.
653
+
654
+ Args:
655
+ poly: A xtgeo Polygons instance, or a list of xtgeo Polygons instances
656
+ value: Value to set as Z values inside polygons.
657
+
658
+ .. versionadded:: 3.2
659
+ """
660
+ self.operation_polygons(poly, value, opname="set", inside=True, version=2)
661
+
662
+ def set_outside(self, poly, value):
663
+ """Set a value (scalar) to points outside polygons.
664
+
665
+ Args:
666
+ poly: A xtgeo Polygons instance
667
+ value: Value to set Z values outside polygons.
668
+
669
+ See notes under :meth:`operation_polygons()` and consider instead
670
+ :meth:`set_outside polygons()`.
671
+ """
672
+ self.operation_polygons(poly, value, opname="set", inside=False, version=0)
673
+
674
+ def set_outside_polygons(
675
+ self,
676
+ poly: Polygons | list[Polygons],
677
+ value: float, # noqa: F821
678
+ ):
679
+ """Set a value (scalar) for points outside polygons (new behaviour).
680
+
681
+ This is an improved implementation than :meth:`set_outside()`, and is now the
682
+ recommended method, as it is both faster and works similar for all single
683
+ and overlapping sub-polygons within one or more Polygons instances.
684
+
685
+ Args:
686
+ poly: A xtgeo Polygons instance, or a list of xtgeo Polygons instances
687
+ value: Value to set as Z values inside polygons.
688
+
689
+ .. versionadded:: 3.2
690
+ """
691
+ self.operation_polygons(poly, value, opname="set", inside=False, version=2)
692
+
693
+ def eli_inside(self, poly):
694
+ """Eliminate current points inside polygons (old implentation).
695
+
696
+ Args:
697
+ poly: A xtgeo Polygons instance
698
+
699
+ See notes under :meth:`operation_polygons()` and consider instead
700
+ :meth:`eli_inside polygons()`.
701
+ """
702
+ self.operation_polygons(poly, 0, opname="eli", inside=True, version=0)
703
+
704
+ def eli_inside_polygons(self, poly: Polygons | list[Polygons]): # noqa: F821
705
+ """Remove points inside polygons.
706
+
707
+ This is an improved implementation than :meth:`eli_inside()`, and is now the
708
+ recommended method, as it is both faster and works similar for all single
709
+ and overlapping sub-polygons within one or more Polygons instances.
710
+
711
+ Args:
712
+ poly: A xtgeo Polygons instance, or a list of xtgeo Polygons instances
713
+
714
+ .. versionadded:: 3.2
715
+ """
716
+ self.operation_polygons(poly, 0, opname="eli", inside=True, version=2)
717
+
718
+ def eli_outside(self, poly):
719
+ """Eliminate current points outside polygons (old implentation).
720
+
721
+ Args:
722
+ poly: A xtgeo Polygons instance
723
+
724
+ See notes under :meth:`operation_polygons()` and consider instead
725
+ :meth:`eli_outside polygons()`.
726
+ """
727
+ self.operation_polygons(poly, 0, opname="eli", inside=False, version=0)
728
+
729
+ def eli_outside_polygons(self, poly: Polygons | list[Polygons]): # noqa: F821
730
+ """Remove points outside polygons.
731
+
732
+ This is an improved implementation than :meth:`eli_outside()`, and is now the
733
+ recommended method, as it is both faster and works similar for all single
734
+ and overlapping sub-polygons within one or more Polygons instances.
735
+
736
+ Args:
737
+ poly: A xtgeo Polygons instance, or a list of xtgeo Polygons instances
738
+
739
+ .. versionadded:: 3.2
740
+ """
741
+ self.operation_polygons(poly, 0, opname="eli", inside=False, version=2)