xtgeo 4.14.1__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.
Files changed (122) hide show
  1. cxtgeo.py +558 -0
  2. cxtgeoPYTHON_wrap.c +19537 -0
  3. xtgeo/__init__.py +248 -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 +34 -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 +273 -0
  23. xtgeo/cube/cube1.py +1023 -0
  24. xtgeo/grid3d/__init__.py +15 -0
  25. xtgeo/grid3d/_ecl_grid.py +778 -0
  26. xtgeo/grid3d/_ecl_inte_head.py +152 -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 +309 -0
  32. xtgeo/grid3d/_grdecl_grid.py +400 -0
  33. xtgeo/grid3d/_grid3d.py +29 -0
  34. xtgeo/grid3d/_grid3d_fence.py +284 -0
  35. xtgeo/grid3d/_grid3d_utils.py +228 -0
  36. xtgeo/grid3d/_grid_boundary.py +76 -0
  37. xtgeo/grid3d/_grid_etc1.py +1683 -0
  38. xtgeo/grid3d/_grid_export.py +222 -0
  39. xtgeo/grid3d/_grid_hybrid.py +50 -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 +258 -0
  45. xtgeo/grid3d/_grid_roxapi.py +292 -0
  46. xtgeo/grid3d/_grid_translate_coords.py +154 -0
  47. xtgeo/grid3d/_grid_wellzone.py +165 -0
  48. xtgeo/grid3d/_gridprop_export.py +202 -0
  49. xtgeo/grid3d/_gridprop_import_eclrun.py +164 -0
  50. xtgeo/grid3d/_gridprop_import_grdecl.py +132 -0
  51. xtgeo/grid3d/_gridprop_import_roff.py +52 -0
  52. xtgeo/grid3d/_gridprop_import_xtgcpprop.py +168 -0
  53. xtgeo/grid3d/_gridprop_lowlevel.py +171 -0
  54. xtgeo/grid3d/_gridprop_op1.py +272 -0
  55. xtgeo/grid3d/_gridprop_roxapi.py +301 -0
  56. xtgeo/grid3d/_gridprop_value_init.py +140 -0
  57. xtgeo/grid3d/_gridprops_import_eclrun.py +344 -0
  58. xtgeo/grid3d/_gridprops_import_roff.py +83 -0
  59. xtgeo/grid3d/_roff_grid.py +470 -0
  60. xtgeo/grid3d/_roff_parameter.py +303 -0
  61. xtgeo/grid3d/grid.py +3010 -0
  62. xtgeo/grid3d/grid_properties.py +699 -0
  63. xtgeo/grid3d/grid_property.py +1313 -0
  64. xtgeo/grid3d/types.py +15 -0
  65. xtgeo/interfaces/rms/__init__.py +18 -0
  66. xtgeo/interfaces/rms/_regular_surface.py +460 -0
  67. xtgeo/interfaces/rms/_rms_base.py +100 -0
  68. xtgeo/interfaces/rms/_rmsapi_package.py +69 -0
  69. xtgeo/interfaces/rms/rmsapi_utils.py +438 -0
  70. xtgeo/io/__init__.py +1 -0
  71. xtgeo/io/_file.py +603 -0
  72. xtgeo/metadata/__init__.py +17 -0
  73. xtgeo/metadata/metadata.py +435 -0
  74. xtgeo/roxutils/__init__.py +7 -0
  75. xtgeo/roxutils/_roxar_loader.py +54 -0
  76. xtgeo/roxutils/_roxutils_etc.py +122 -0
  77. xtgeo/roxutils/roxutils.py +207 -0
  78. xtgeo/surface/__init__.py +20 -0
  79. xtgeo/surface/_regsurf_boundary.py +26 -0
  80. xtgeo/surface/_regsurf_cube.py +210 -0
  81. xtgeo/surface/_regsurf_cube_window.py +391 -0
  82. xtgeo/surface/_regsurf_cube_window_v2.py +297 -0
  83. xtgeo/surface/_regsurf_cube_window_v3.py +360 -0
  84. xtgeo/surface/_regsurf_export.py +388 -0
  85. xtgeo/surface/_regsurf_grid3d.py +275 -0
  86. xtgeo/surface/_regsurf_gridding.py +347 -0
  87. xtgeo/surface/_regsurf_ijxyz_parser.py +278 -0
  88. xtgeo/surface/_regsurf_import.py +347 -0
  89. xtgeo/surface/_regsurf_lowlevel.py +122 -0
  90. xtgeo/surface/_regsurf_oper.py +538 -0
  91. xtgeo/surface/_regsurf_utils.py +81 -0
  92. xtgeo/surface/_surfs_import.py +43 -0
  93. xtgeo/surface/_zmap_parser.py +138 -0
  94. xtgeo/surface/regular_surface.py +3043 -0
  95. xtgeo/surface/surfaces.py +276 -0
  96. xtgeo/well/__init__.py +24 -0
  97. xtgeo/well/_blockedwell_roxapi.py +241 -0
  98. xtgeo/well/_blockedwells_roxapi.py +68 -0
  99. xtgeo/well/_well_aux.py +30 -0
  100. xtgeo/well/_well_io.py +327 -0
  101. xtgeo/well/_well_oper.py +483 -0
  102. xtgeo/well/_well_roxapi.py +304 -0
  103. xtgeo/well/_wellmarkers.py +486 -0
  104. xtgeo/well/_wells_utils.py +158 -0
  105. xtgeo/well/blocked_well.py +220 -0
  106. xtgeo/well/blocked_wells.py +134 -0
  107. xtgeo/well/well1.py +1516 -0
  108. xtgeo/well/wells.py +211 -0
  109. xtgeo/xyz/__init__.py +6 -0
  110. xtgeo/xyz/_polygons_oper.py +272 -0
  111. xtgeo/xyz/_xyz.py +758 -0
  112. xtgeo/xyz/_xyz_data.py +646 -0
  113. xtgeo/xyz/_xyz_io.py +737 -0
  114. xtgeo/xyz/_xyz_lowlevel.py +42 -0
  115. xtgeo/xyz/_xyz_oper.py +613 -0
  116. xtgeo/xyz/_xyz_roxapi.py +766 -0
  117. xtgeo/xyz/points.py +698 -0
  118. xtgeo/xyz/polygons.py +827 -0
  119. xtgeo-4.14.1.dist-info/METADATA +146 -0
  120. xtgeo-4.14.1.dist-info/RECORD +122 -0
  121. xtgeo-4.14.1.dist-info/WHEEL +5 -0
  122. xtgeo-4.14.1.dist-info/licenses/LICENSE.md +165 -0
@@ -0,0 +1,220 @@
1
+ """XTGeo blockedwell module"""
2
+
3
+ from __future__ import annotations
4
+
5
+ from typing import Any
6
+
7
+ import pandas as pd
8
+
9
+ from xtgeo.common._xyz_enum import _AttrName
10
+ from xtgeo.common.log import null_logger
11
+
12
+ from . import _blockedwell_roxapi
13
+ from .well1 import Well
14
+
15
+ logger = null_logger(__name__)
16
+
17
+
18
+ # =============================================================================
19
+ # METHODS as wrappers to class init + import
20
+
21
+
22
+ def blockedwell_from_file(
23
+ bwfile, fformat="rms_ascii", mdlogname=None, zonelogname=None, strict=False
24
+ ):
25
+ """Make an instance of a BlockedWell directly from file import.
26
+
27
+ Args:
28
+ bmfile (str): Name of file
29
+ fformat (str): See :meth:`Well.from_file`
30
+ mdlogname (str): See :meth:`Well.from_file`
31
+ zonelogname (str): See :meth:`Well.from_file`
32
+ strict (bool): See :meth:`Well.from_file`
33
+
34
+ Example::
35
+
36
+ >>> import xtgeo
37
+ >>> well3 = xtgeo.blockedwell_from_file(well_dir + '/OP_1.bw')
38
+ """
39
+
40
+ return BlockedWell._read_file(
41
+ bwfile,
42
+ fformat=fformat,
43
+ mdlogname=mdlogname,
44
+ zonelogname=zonelogname,
45
+ strict=strict,
46
+ )
47
+
48
+ # return obj
49
+
50
+
51
+ def blockedwell_from_roxar(
52
+ project, gname, bwname, wname, lognames=None, ijk=True, realisation=0
53
+ ):
54
+ """This makes an instance of a BlockedWell directly from Roxar RMS.
55
+
56
+ For arguments, see :meth:`BlockedWell.from_roxar`.
57
+
58
+ Example::
59
+
60
+ # inside RMS:
61
+ import xtgeo
62
+ mylogs = ['ZONELOG', 'GR', 'Facies']
63
+ mybw = xtgeo.blockedwell_from_roxar(project, 'Simgrid', 'BW', '31_3-1',
64
+ lognames=mylogs)
65
+
66
+ """
67
+
68
+ # TODO: replace this with proper class method
69
+ obj = BlockedWell(
70
+ *([0.0] * 3),
71
+ "",
72
+ pd.DataFrame(
73
+ {
74
+ _AttrName.XNAME.value: [],
75
+ _AttrName.YNAME.value: [],
76
+ _AttrName.ZNAME.value: [],
77
+ }
78
+ ),
79
+ )
80
+
81
+ _blockedwell_roxapi.import_bwell_roxapi(
82
+ obj,
83
+ project,
84
+ gname,
85
+ bwname,
86
+ wname,
87
+ lognames=lognames,
88
+ ijk=ijk,
89
+ realisation=realisation,
90
+ )
91
+
92
+ obj._ensure_consistency()
93
+
94
+ return obj
95
+
96
+
97
+ # =============================================================================
98
+ # CLASS
99
+
100
+
101
+ class BlockedWell(Well):
102
+ """Class for a blocked well in the XTGeo framework, subclassed from the
103
+ Well class.
104
+
105
+ Similar to Wells, the blocked well logs are stored as Pandas dataframe,
106
+ which make manipulation easy and fast.
107
+
108
+ For blocked well logs, the numbers of rows cannot be changed if you want to
109
+ save the result in RMS, as this is derived from the grid. Also the blocked well
110
+ icon must exist before save.
111
+
112
+ The well trajectory are here represented as logs, and XYZ have magic names as
113
+ default: X_UTME, Y_UTMN, Z_TVDSS, which are the three first Pandas columns.
114
+
115
+ Other geometry logs has also 'semi-magic' names:
116
+
117
+ M_MDEPTH or Q_MDEPTH: Measured depth, either real/true (M...) or
118
+ quasi computed/estimated (Q...). The Quasi computations may be incorrect for
119
+ all uses, but sufficient for some computations.
120
+
121
+ Similar for M_INCL, Q_INCL, M_AZI, Q_AZI.
122
+
123
+ I_INDEX, J_INDEX, K_INDEX: They are grid indices. For practical reasons
124
+ they are treated as a CONT logs, since the min/max grid indices usually are
125
+ unknown, and hence making a code index is not trivial.
126
+
127
+ All Pandas values (yes, discrete also!) are stored as float32 or float64
128
+ format, and undefined values are Nan. Integers are stored as Float due
129
+ to the lacking support for 'Integer Nan' (currently lacking in Pandas,
130
+ but may come in later Pandas versions).
131
+
132
+ Note there is a method that can return a dataframe (copy) with Integer
133
+ and Float columns, see :meth:`get_filled_dataframe`.
134
+
135
+ The instance can be made either from file or::
136
+
137
+ >>> well1 = xtgeo.blockedwell_from_file(well_dir + '/OP_1.bw') # RMS ascii well
138
+
139
+ If in RMS, instance can be made also from RMS icon::
140
+
141
+ well4 = xtgeo.blockedwell_from_roxar(
142
+ project,
143
+ 'gridname',
144
+ 'bwname',
145
+ 'wellname',
146
+ )
147
+
148
+ """
149
+
150
+ def __init__(self, *args, **kwargs):
151
+ super().__init__(*args, **kwargs)
152
+
153
+ self._gridname = None
154
+
155
+ @property
156
+ def gridname(self):
157
+ """Returns or set (rename) the grid name that the blocked wells
158
+ belongs to."""
159
+ return self._gridname
160
+
161
+ @gridname.setter
162
+ def gridname(self, newname):
163
+ if isinstance(newname, str):
164
+ self._gridname = newname
165
+ else:
166
+ raise ValueError("Input name is not a string.")
167
+
168
+ def copy(self):
169
+ newbw = super().copy()
170
+
171
+ newbw._gridname = self._gridname
172
+
173
+ return newbw
174
+
175
+ def to_roxar(
176
+ self,
177
+ project: Any,
178
+ gridname: str,
179
+ bwname: str,
180
+ wname: str,
181
+ lognames: str | list[str] = "all",
182
+ realisation: int = 0,
183
+ ijk: bool = False,
184
+ ) -> None:
185
+ """Set (export) a single blocked well item inside roxar project.
186
+
187
+ Note this method works only when inside RMS, or when RMS license is
188
+ activated. RMS will store blocked wells as a Gridmodel feature, not as a
189
+ well.
190
+
191
+ Note:
192
+ When project is file path (direct access, outside RMS) then
193
+ ``to_roxar()`` will implicitly do a project save. Otherwise, the project
194
+ will not be saved until the user do an explicit project save action.
195
+
196
+ Args:
197
+ project: Magic object 'project' or file path to project
198
+ gridname: Name of GridModel icon in RMS
199
+ bwname: Name of Blocked Well icon in RMS, usually 'BW'
200
+ wname: Name of well, as shown in RMS.
201
+ lognames: List of lognames to include, or use 'all' for
202
+ all current blocked logs for this well (except index logs). Default is
203
+ "all".
204
+ realisation: Realisation index (0 is default)
205
+ ijk: If True, then also write special index logs if they exist,
206
+ such as I_INDEX, J_INDEX, K_INDEX, etc. Default is False
207
+
208
+ .. versionadded: 2.12
209
+
210
+ """
211
+ _blockedwell_roxapi.export_bwell_roxapi(
212
+ self,
213
+ project,
214
+ gridname,
215
+ bwname,
216
+ wname,
217
+ lognames=lognames,
218
+ ijk=ijk,
219
+ realisation=realisation,
220
+ )
@@ -0,0 +1,134 @@
1
+ """BlockedWells module, (collection of BlockedWell objects)"""
2
+
3
+ from __future__ import annotations
4
+
5
+ from typing import Any
6
+
7
+ from xtgeo.common.log import null_logger
8
+ from xtgeo.common.xtgeo_dialog import XTGeoDialog
9
+
10
+ from . import _blockedwells_roxapi
11
+ from .blocked_well import blockedwell_from_file
12
+ from .wells import Wells
13
+
14
+ xtg = XTGeoDialog()
15
+ logger = null_logger(__name__)
16
+
17
+
18
+ def blockedwells_from_files(
19
+ filelist,
20
+ fformat="rms_ascii",
21
+ mdlogname=None,
22
+ zonelogname=None,
23
+ strict=True,
24
+ ):
25
+ """Import blocked wells from a list of files (filelist).
26
+
27
+ Args:
28
+ filelist (list of str): List with file names
29
+ fformat (str): File format, rms_ascii (rms well) is
30
+ currently supported and default format.
31
+ mdlogname (str): Name of measured depth log, if any
32
+ zonelogname (str): Name of zonation log, if any
33
+ strict (bool): If True, then import will fail if
34
+ zonelogname or mdlogname are asked for but not present
35
+ in wells.
36
+
37
+ Example:
38
+ Here the from_file method is used to initiate the object
39
+ directly::
40
+
41
+ mywells = BlockedWells(['31_2-6.w', '31_2-7.w', '31_2-8.w'])
42
+ """
43
+ return BlockedWells(
44
+ [
45
+ blockedwell_from_file(
46
+ wfile,
47
+ fformat=fformat,
48
+ mdlogname=mdlogname,
49
+ zonelogname=zonelogname,
50
+ strict=strict,
51
+ )
52
+ for wfile in filelist
53
+ ]
54
+ )
55
+
56
+
57
+ def blockedwells_from_roxar(
58
+ project, gname, bwname, lognames=None, ijk=True
59
+ ): # pragma: no cover
60
+ """This makes an instance of a BlockedWells directly from Roxar RMS.
61
+
62
+ For arguments, see :meth:`BlockedWells.from_roxar`.
63
+
64
+ Note the difference between classes BlockedWell and BlockedWells.
65
+
66
+ Example::
67
+
68
+ # inside RMS:
69
+ import xtgeo
70
+ mylogs = ['ZONELOG', 'GR', 'Facies']
71
+ mybws = xtgeo.blockedwells_from_roxar(project, 'Simgrid', 'BW',
72
+ lognames=mylogs)
73
+
74
+ """
75
+ # TODO refactor with class method
76
+
77
+ obj = BlockedWells()
78
+
79
+ obj._from_roxar(project, gname, bwname, ijk=ijk, lognames=lognames)
80
+
81
+ return obj
82
+
83
+
84
+ class BlockedWells(Wells):
85
+ """Class for a collection of BlockedWell objects, for operations that
86
+ involves a number of wells.
87
+
88
+ See also the :class:`xtgeo.well.BlockedWell` class.
89
+ """
90
+
91
+ def copy(self):
92
+ """Copy a BlockedWells instance to a new unique instance."""
93
+
94
+ return BlockedWells([w.copy() for w in self._wells])
95
+
96
+ def get_blocked_well(self, name):
97
+ """Get a BlockedWell() instance by name, or None"""
98
+ logger.debug("Calling super...")
99
+ return super().get_well(name)
100
+
101
+ def _from_roxar(
102
+ self,
103
+ project: Any,
104
+ gridname: str,
105
+ bwname: str,
106
+ lognames: str | list[str],
107
+ ijk: bool,
108
+ realisation: int = 0,
109
+ ):
110
+ """Import (retrieve) blocked wells from roxar project.
111
+
112
+ Note this method works only when inside RMS, or when RMS license is
113
+ activated.
114
+
115
+ All the wells present in the bwname icon will be imported.
116
+
117
+ Args:
118
+ project: Magic string 'project' or file path to project
119
+ gridname: Name of GridModel icon in RMS
120
+ bwname: Name of Blocked Well icon in RMS, usually 'BW'
121
+ lognames: List of lognames to include, or use 'all' for
122
+ all current blocked logs for this well.
123
+ ijk: If True, then logs with grid IJK as I_INDEX, etc
124
+ realisation: Realisation index (0 is default)
125
+ """
126
+ _blockedwells_roxapi.import_bwells_roxapi(
127
+ self,
128
+ project,
129
+ gridname,
130
+ bwname,
131
+ lognames=lognames,
132
+ ijk=ijk,
133
+ realisation=realisation,
134
+ )