xtgeo 4.8.0__cp313-cp313-macosx_11_0_arm64.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.cpython-313-darwin.so +0 -0
  5. xtgeo/_internal.cpython-313-darwin.so +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 +6 -0
  117. xtgeo-4.8.0.dist-info/licenses/LICENSE.md +165 -0
@@ -0,0 +1,216 @@
1
+ """XTGeo blockedwell module"""
2
+
3
+ import pandas as pd
4
+
5
+ from xtgeo.common._xyz_enum import _AttrName
6
+ from xtgeo.common.log import null_logger
7
+
8
+ from . import _blockedwell_roxapi
9
+ from .well1 import Well
10
+
11
+ logger = null_logger(__name__)
12
+
13
+
14
+ # =============================================================================
15
+ # METHODS as wrappers to class init + import
16
+
17
+
18
+ def blockedwell_from_file(
19
+ bwfile, fformat="rms_ascii", mdlogname=None, zonelogname=None, strict=False
20
+ ):
21
+ """Make an instance of a BlockedWell directly from file import.
22
+
23
+ Args:
24
+ bmfile (str): Name of file
25
+ fformat (str): See :meth:`Well.from_file`
26
+ mdlogname (str): See :meth:`Well.from_file`
27
+ zonelogname (str): See :meth:`Well.from_file`
28
+ strict (bool): See :meth:`Well.from_file`
29
+
30
+ Example::
31
+
32
+ >>> import xtgeo
33
+ >>> well3 = xtgeo.blockedwell_from_file(well_dir + '/OP_1.bw')
34
+ """
35
+
36
+ return BlockedWell._read_file(
37
+ bwfile,
38
+ fformat=fformat,
39
+ mdlogname=mdlogname,
40
+ zonelogname=zonelogname,
41
+ strict=strict,
42
+ )
43
+
44
+ # return obj
45
+
46
+
47
+ def blockedwell_from_roxar(
48
+ project, gname, bwname, wname, lognames=None, ijk=True, realisation=0
49
+ ):
50
+ """This makes an instance of a BlockedWell directly from Roxar RMS.
51
+
52
+ For arguments, see :meth:`BlockedWell.from_roxar`.
53
+
54
+ Example::
55
+
56
+ # inside RMS:
57
+ import xtgeo
58
+ mylogs = ['ZONELOG', 'GR', 'Facies']
59
+ mybw = xtgeo.blockedwell_from_roxar(project, 'Simgrid', 'BW', '31_3-1',
60
+ lognames=mylogs)
61
+
62
+ """
63
+
64
+ # TODO: replace this with proper class method
65
+ obj = BlockedWell(
66
+ *([0.0] * 3),
67
+ "",
68
+ pd.DataFrame(
69
+ {
70
+ _AttrName.XNAME.value: [],
71
+ _AttrName.YNAME.value: [],
72
+ _AttrName.ZNAME.value: [],
73
+ }
74
+ ),
75
+ )
76
+
77
+ _blockedwell_roxapi.import_bwell_roxapi(
78
+ obj,
79
+ project,
80
+ gname,
81
+ bwname,
82
+ wname,
83
+ lognames=lognames,
84
+ ijk=ijk,
85
+ realisation=realisation,
86
+ )
87
+
88
+ obj._ensure_consistency()
89
+
90
+ return obj
91
+
92
+
93
+ # =============================================================================
94
+ # CLASS
95
+
96
+
97
+ class BlockedWell(Well):
98
+ """Class for a blocked well in the XTGeo framework, subclassed from the
99
+ Well class.
100
+
101
+ Similar to Wells, the blocked well logs are stored as Pandas dataframe,
102
+ which make manipulation easy and fast.
103
+
104
+ For blocked well logs, the numbers of rows cannot be changed if you want to
105
+ save the result in RMS, as this is derived from the grid. Also the blocked well
106
+ icon must exist before save.
107
+
108
+ The well trajectory are here represented as logs, and XYZ have magic names as
109
+ default: X_UTME, Y_UTMN, Z_TVDSS, which are the three first Pandas columns.
110
+
111
+ Other geometry logs has also 'semi-magic' names:
112
+
113
+ M_MDEPTH or Q_MDEPTH: Measured depth, either real/true (M...) or
114
+ quasi computed/estimated (Q...). The Quasi computations may be incorrect for
115
+ all uses, but sufficient for some computations.
116
+
117
+ Similar for M_INCL, Q_INCL, M_AZI, Q_AZI.
118
+
119
+ I_INDEX, J_INDEX, K_INDEX: They are grid indices. For practical reasons
120
+ they are treated as a CONT logs, since the min/max grid indices usually are
121
+ unknown, and hence making a code index is not trivial.
122
+
123
+ All Pandas values (yes, discrete also!) are stored as float32 or float64
124
+ format, and undefined values are Nan. Integers are stored as Float due
125
+ to the lacking support for 'Integer Nan' (currently lacking in Pandas,
126
+ but may come in later Pandas versions).
127
+
128
+ Note there is a method that can return a dataframe (copy) with Integer
129
+ and Float columns, see :meth:`get_filled_dataframe`.
130
+
131
+ The instance can be made either from file or::
132
+
133
+ >>> well1 = xtgeo.blockedwell_from_file(well_dir + '/OP_1.bw') # RMS ascii well
134
+
135
+ If in RMS, instance can be made also from RMS icon::
136
+
137
+ well4 = xtgeo.blockedwell_from_roxar(
138
+ project,
139
+ 'gridname',
140
+ 'bwname',
141
+ 'wellname',
142
+ )
143
+
144
+ """
145
+
146
+ def __init__(self, *args, **kwargs):
147
+ super().__init__(*args, **kwargs)
148
+
149
+ self._gridname = None
150
+
151
+ @property
152
+ def gridname(self):
153
+ """Returns or set (rename) the grid name that the blocked wells
154
+ belongs to."""
155
+ return self._gridname
156
+
157
+ @gridname.setter
158
+ def gridname(self, newname):
159
+ if isinstance(newname, str):
160
+ self._gridname = newname
161
+ else:
162
+ raise ValueError("Input name is not a string.")
163
+
164
+ def copy(self):
165
+ newbw = super().copy()
166
+
167
+ newbw._gridname = self._gridname
168
+
169
+ return newbw
170
+
171
+ def to_roxar(self, *args, **kwargs):
172
+ """Set (export) a single blocked well item inside roxar project.
173
+
174
+ Note this method works only when inside RMS, or when RMS license is
175
+ activated. RMS will store blocked wells as a Gridmodel feature, not as a
176
+ well.
177
+
178
+ Note:
179
+ When project is file path (direct access, outside RMS) then
180
+ ``to_roxar()`` will implicitly do a project save. Otherwise, the project
181
+ will not be saved until the user do an explicit project save action.
182
+
183
+ Args:
184
+ project (str or object): Magic object 'project' or file path to project
185
+ gname (str): Name of GridModel icon in RMS
186
+ bwname (str): Name of Blocked Well icon in RMS, usually 'BW'
187
+ wname (str): Name of well, as shown in RMS.
188
+ lognames (list or "all"): List of lognames to include, or use 'all' for
189
+ all current blocked logs for this well (except index logs). Default is
190
+ "all".
191
+ realisation (int): Realisation index (0 is default)
192
+ ijk (bool): If True, then also write special index logs if they exist,
193
+ such as I_INDEX, J_INDEX, K_INDEX, etc. Default is False
194
+
195
+ .. versionadded: 2.12
196
+
197
+ """
198
+ # TODO: go from *args, **kwargs to keywords
199
+ project = args[0]
200
+ gname = args[1]
201
+ bwname = args[2]
202
+ wname = args[3]
203
+ lognames = kwargs.get("lognames", "all")
204
+ ijk = kwargs.get("ijk", False)
205
+ realisation = kwargs.get("realisation", 0)
206
+
207
+ _blockedwell_roxapi.export_bwell_roxapi(
208
+ self,
209
+ project,
210
+ gname,
211
+ bwname,
212
+ wname,
213
+ lognames=lognames,
214
+ ijk=ijk,
215
+ realisation=realisation,
216
+ )
@@ -0,0 +1,122 @@
1
+ """BlockedWells module, (collection of BlockedWell objects)"""
2
+
3
+ from xtgeo.common.log import null_logger
4
+ from xtgeo.common.xtgeo_dialog import XTGeoDialog
5
+
6
+ from . import _blockedwells_roxapi
7
+ from .blocked_well import blockedwell_from_file
8
+ from .wells import Wells
9
+
10
+ xtg = XTGeoDialog()
11
+ logger = null_logger(__name__)
12
+
13
+
14
+ def blockedwells_from_files(
15
+ filelist,
16
+ fformat="rms_ascii",
17
+ mdlogname=None,
18
+ zonelogname=None,
19
+ strict=True,
20
+ ):
21
+ """Import blocked wells from a list of files (filelist).
22
+
23
+ Args:
24
+ filelist (list of str): List with file names
25
+ fformat (str): File format, rms_ascii (rms well) is
26
+ currently supported and default format.
27
+ mdlogname (str): Name of measured depth log, if any
28
+ zonelogname (str): Name of zonation log, if any
29
+ strict (bool): If True, then import will fail if
30
+ zonelogname or mdlogname are asked for but not present
31
+ in wells.
32
+
33
+ Example:
34
+ Here the from_file method is used to initiate the object
35
+ directly::
36
+
37
+ mywells = BlockedWells(['31_2-6.w', '31_2-7.w', '31_2-8.w'])
38
+ """
39
+ return BlockedWells(
40
+ [
41
+ blockedwell_from_file(
42
+ wfile,
43
+ fformat=fformat,
44
+ mdlogname=mdlogname,
45
+ zonelogname=zonelogname,
46
+ strict=strict,
47
+ )
48
+ for wfile in filelist
49
+ ]
50
+ )
51
+
52
+
53
+ def blockedwells_from_roxar(
54
+ project, gname, bwname, lognames=None, ijk=True
55
+ ): # pragma: no cover
56
+ """This makes an instance of a BlockedWells directly from Roxar RMS.
57
+
58
+ For arguments, see :meth:`BlockedWells.from_roxar`.
59
+
60
+ Note the difference between classes BlockedWell and BlockedWells.
61
+
62
+ Example::
63
+
64
+ # inside RMS:
65
+ import xtgeo
66
+ mylogs = ['ZONELOG', 'GR', 'Facies']
67
+ mybws = xtgeo.blockedwells_from_roxar(project, 'Simgrid', 'BW',
68
+ lognames=mylogs)
69
+
70
+ """
71
+ # TODO refactor with class method
72
+
73
+ obj = BlockedWells()
74
+
75
+ obj._from_roxar(project, gname, bwname, ijk=ijk, lognames=lognames)
76
+
77
+ return obj
78
+
79
+
80
+ class BlockedWells(Wells):
81
+ """Class for a collection of BlockedWell objects, for operations that
82
+ involves a number of wells.
83
+
84
+ See also the :class:`xtgeo.well.BlockedWell` class.
85
+ """
86
+
87
+ def copy(self):
88
+ """Copy a BlockedWells instance to a new unique instance."""
89
+
90
+ return BlockedWells([w.copy() for w in self._wells])
91
+
92
+ def get_blocked_well(self, name):
93
+ """Get a BlockedWell() instance by name, or None"""
94
+ logger.debug("Calling super...")
95
+ return super().get_well(name)
96
+
97
+ def _from_roxar(self, *args, **kwargs): # pragma: no cover
98
+ """Import (retrieve) blocked wells from roxar project.
99
+
100
+ Note this method works only when inside RMS, or when RMS license is
101
+ activated.
102
+
103
+ All the wells present in the bwname icon will be imported.
104
+
105
+ Args:
106
+ project (str): Magic string 'project' or file path to project
107
+ gname (str): Name of GridModel icon in RMS
108
+ bwname (str): Name of Blocked Well icon in RMS, usually 'BW'
109
+ lognames (list): List of lognames to include, or use 'all' for
110
+ all current blocked logs for this well.
111
+ ijk (bool): If True, then logs with grid IJK as I_INDEX, etc
112
+ realisation (int): Realisation index (0 is default)
113
+ """
114
+ project = args[0]
115
+ gname = args[1]
116
+ bwname = args[2]
117
+ lognames = kwargs.get("lognames")
118
+ ijk = kwargs.get("ijk", True)
119
+
120
+ _blockedwells_roxapi.import_bwells_roxapi(
121
+ self, project, gname, bwname, lognames=lognames, ijk=ijk
122
+ )