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.
- cxtgeo.py +558 -0
- cxtgeoPYTHON_wrap.c +19537 -0
- xtgeo/__init__.py +248 -0
- xtgeo/_cxtgeo.cp313-win_amd64.pyd +0 -0
- xtgeo/_internal.cp313-win_amd64.pyd +0 -0
- xtgeo/common/__init__.py +19 -0
- xtgeo/common/_angles.py +29 -0
- xtgeo/common/_xyz_enum.py +50 -0
- xtgeo/common/calc.py +396 -0
- xtgeo/common/constants.py +30 -0
- xtgeo/common/exceptions.py +42 -0
- xtgeo/common/log.py +93 -0
- xtgeo/common/sys.py +166 -0
- xtgeo/common/types.py +18 -0
- xtgeo/common/version.py +34 -0
- xtgeo/common/xtgeo_dialog.py +604 -0
- xtgeo/cube/__init__.py +9 -0
- xtgeo/cube/_cube_export.py +214 -0
- xtgeo/cube/_cube_import.py +532 -0
- xtgeo/cube/_cube_roxapi.py +180 -0
- xtgeo/cube/_cube_utils.py +287 -0
- xtgeo/cube/_cube_window_attributes.py +273 -0
- xtgeo/cube/cube1.py +1023 -0
- xtgeo/grid3d/__init__.py +15 -0
- xtgeo/grid3d/_ecl_grid.py +778 -0
- xtgeo/grid3d/_ecl_inte_head.py +152 -0
- xtgeo/grid3d/_ecl_logi_head.py +71 -0
- xtgeo/grid3d/_ecl_output_file.py +81 -0
- xtgeo/grid3d/_egrid.py +1004 -0
- xtgeo/grid3d/_find_gridprop_in_eclrun.py +625 -0
- xtgeo/grid3d/_grdecl_format.py +309 -0
- xtgeo/grid3d/_grdecl_grid.py +400 -0
- xtgeo/grid3d/_grid3d.py +29 -0
- xtgeo/grid3d/_grid3d_fence.py +284 -0
- xtgeo/grid3d/_grid3d_utils.py +228 -0
- xtgeo/grid3d/_grid_boundary.py +76 -0
- xtgeo/grid3d/_grid_etc1.py +1683 -0
- xtgeo/grid3d/_grid_export.py +222 -0
- xtgeo/grid3d/_grid_hybrid.py +50 -0
- xtgeo/grid3d/_grid_import.py +79 -0
- xtgeo/grid3d/_grid_import_ecl.py +101 -0
- xtgeo/grid3d/_grid_import_roff.py +135 -0
- xtgeo/grid3d/_grid_import_xtgcpgeom.py +375 -0
- xtgeo/grid3d/_grid_refine.py +258 -0
- xtgeo/grid3d/_grid_roxapi.py +292 -0
- xtgeo/grid3d/_grid_translate_coords.py +154 -0
- xtgeo/grid3d/_grid_wellzone.py +165 -0
- xtgeo/grid3d/_gridprop_export.py +202 -0
- xtgeo/grid3d/_gridprop_import_eclrun.py +164 -0
- xtgeo/grid3d/_gridprop_import_grdecl.py +132 -0
- xtgeo/grid3d/_gridprop_import_roff.py +52 -0
- xtgeo/grid3d/_gridprop_import_xtgcpprop.py +168 -0
- xtgeo/grid3d/_gridprop_lowlevel.py +171 -0
- xtgeo/grid3d/_gridprop_op1.py +272 -0
- xtgeo/grid3d/_gridprop_roxapi.py +301 -0
- xtgeo/grid3d/_gridprop_value_init.py +140 -0
- xtgeo/grid3d/_gridprops_import_eclrun.py +344 -0
- xtgeo/grid3d/_gridprops_import_roff.py +83 -0
- xtgeo/grid3d/_roff_grid.py +470 -0
- xtgeo/grid3d/_roff_parameter.py +303 -0
- xtgeo/grid3d/grid.py +3010 -0
- xtgeo/grid3d/grid_properties.py +699 -0
- xtgeo/grid3d/grid_property.py +1313 -0
- xtgeo/grid3d/types.py +15 -0
- xtgeo/interfaces/rms/__init__.py +18 -0
- xtgeo/interfaces/rms/_regular_surface.py +460 -0
- xtgeo/interfaces/rms/_rms_base.py +100 -0
- xtgeo/interfaces/rms/_rmsapi_package.py +69 -0
- xtgeo/interfaces/rms/rmsapi_utils.py +438 -0
- xtgeo/io/__init__.py +1 -0
- xtgeo/io/_file.py +603 -0
- xtgeo/metadata/__init__.py +17 -0
- xtgeo/metadata/metadata.py +435 -0
- xtgeo/roxutils/__init__.py +7 -0
- xtgeo/roxutils/_roxar_loader.py +54 -0
- xtgeo/roxutils/_roxutils_etc.py +122 -0
- xtgeo/roxutils/roxutils.py +207 -0
- xtgeo/surface/__init__.py +20 -0
- xtgeo/surface/_regsurf_boundary.py +26 -0
- xtgeo/surface/_regsurf_cube.py +210 -0
- xtgeo/surface/_regsurf_cube_window.py +391 -0
- xtgeo/surface/_regsurf_cube_window_v2.py +297 -0
- xtgeo/surface/_regsurf_cube_window_v3.py +360 -0
- xtgeo/surface/_regsurf_export.py +388 -0
- xtgeo/surface/_regsurf_grid3d.py +275 -0
- xtgeo/surface/_regsurf_gridding.py +347 -0
- xtgeo/surface/_regsurf_ijxyz_parser.py +278 -0
- xtgeo/surface/_regsurf_import.py +347 -0
- xtgeo/surface/_regsurf_lowlevel.py +122 -0
- xtgeo/surface/_regsurf_oper.py +538 -0
- xtgeo/surface/_regsurf_utils.py +81 -0
- xtgeo/surface/_surfs_import.py +43 -0
- xtgeo/surface/_zmap_parser.py +138 -0
- xtgeo/surface/regular_surface.py +3043 -0
- xtgeo/surface/surfaces.py +276 -0
- xtgeo/well/__init__.py +24 -0
- xtgeo/well/_blockedwell_roxapi.py +241 -0
- xtgeo/well/_blockedwells_roxapi.py +68 -0
- xtgeo/well/_well_aux.py +30 -0
- xtgeo/well/_well_io.py +327 -0
- xtgeo/well/_well_oper.py +483 -0
- xtgeo/well/_well_roxapi.py +304 -0
- xtgeo/well/_wellmarkers.py +486 -0
- xtgeo/well/_wells_utils.py +158 -0
- xtgeo/well/blocked_well.py +220 -0
- xtgeo/well/blocked_wells.py +134 -0
- xtgeo/well/well1.py +1516 -0
- xtgeo/well/wells.py +211 -0
- xtgeo/xyz/__init__.py +6 -0
- xtgeo/xyz/_polygons_oper.py +272 -0
- xtgeo/xyz/_xyz.py +758 -0
- xtgeo/xyz/_xyz_data.py +646 -0
- xtgeo/xyz/_xyz_io.py +737 -0
- xtgeo/xyz/_xyz_lowlevel.py +42 -0
- xtgeo/xyz/_xyz_oper.py +613 -0
- xtgeo/xyz/_xyz_roxapi.py +766 -0
- xtgeo/xyz/points.py +698 -0
- xtgeo/xyz/polygons.py +827 -0
- xtgeo-4.14.1.dist-info/METADATA +146 -0
- xtgeo-4.14.1.dist-info/RECORD +122 -0
- xtgeo-4.14.1.dist-info/WHEEL +5 -0
- xtgeo-4.14.1.dist-info/licenses/LICENSE.md +165 -0
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
"""ZMAP plus parsing.
|
|
2
|
+
|
|
3
|
+
cf https://saurabhkukade.com/posts/2020/07/understanding-zmap-file-format/
|
|
4
|
+
|
|
5
|
+
Note also from example here:
|
|
6
|
+
https://raw.githubusercontent.com/abduhbm/zmapio/main/examples/NSLCU.dat
|
|
7
|
+
that header lines may end with trailing comma!
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
import dataclasses
|
|
11
|
+
import inspect
|
|
12
|
+
from functools import wraps
|
|
13
|
+
from pathlib import Path
|
|
14
|
+
from typing import Optional
|
|
15
|
+
|
|
16
|
+
import numpy as np
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
@dataclasses.dataclass
|
|
20
|
+
class ZMAPSurface:
|
|
21
|
+
nrow: int
|
|
22
|
+
ncol: int
|
|
23
|
+
xmin: float
|
|
24
|
+
xmax: float
|
|
25
|
+
ymin: float
|
|
26
|
+
ymax: float
|
|
27
|
+
node_width: int
|
|
28
|
+
precision: int
|
|
29
|
+
start_column: int
|
|
30
|
+
nan_value: float
|
|
31
|
+
nr_nodes_per_line: int
|
|
32
|
+
values: Optional[np.array] = None
|
|
33
|
+
|
|
34
|
+
def __post_init__(self):
|
|
35
|
+
for field in dataclasses.fields(self):
|
|
36
|
+
value = getattr(self, field.name)
|
|
37
|
+
if field.type in (int, float) and not isinstance(value, field.type):
|
|
38
|
+
setattr(self, field.name, field.type(value))
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
def takes_stream(name, mode):
|
|
42
|
+
def decorator(func):
|
|
43
|
+
@wraps(func)
|
|
44
|
+
def wrapper(*args, **kwargs):
|
|
45
|
+
kwargs = inspect.getcallargs(func, *args, **kwargs)
|
|
46
|
+
if name in kwargs and isinstance(kwargs[name], (str, Path)):
|
|
47
|
+
with open(kwargs[name], mode) as f:
|
|
48
|
+
kwargs[name] = f
|
|
49
|
+
return func(**kwargs)
|
|
50
|
+
else:
|
|
51
|
+
return func(**kwargs)
|
|
52
|
+
|
|
53
|
+
return wrapper
|
|
54
|
+
|
|
55
|
+
return decorator
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
def parse_header(zmap_data):
|
|
59
|
+
keys = {}
|
|
60
|
+
line_nr = 0
|
|
61
|
+
for line in zmap_data:
|
|
62
|
+
if is_comment(line):
|
|
63
|
+
continue
|
|
64
|
+
try:
|
|
65
|
+
line = [entry.strip() for entry in line.split(",")]
|
|
66
|
+
if not line[-1]:
|
|
67
|
+
line.pop() # deal with input lines ending with comma ','
|
|
68
|
+
if line_nr == 0:
|
|
69
|
+
_, identifier, keys["nr_nodes_per_line"] = line
|
|
70
|
+
if identifier != "GRID":
|
|
71
|
+
raise ZMAPFormatException(
|
|
72
|
+
f"Expected GRID as second entry in line, "
|
|
73
|
+
f"got: {identifier} in line: {line}"
|
|
74
|
+
)
|
|
75
|
+
elif line_nr == 1:
|
|
76
|
+
(
|
|
77
|
+
keys["node_width"],
|
|
78
|
+
dft_nan_value,
|
|
79
|
+
user_nan_value,
|
|
80
|
+
keys["precision"],
|
|
81
|
+
keys["start_column"],
|
|
82
|
+
) = line
|
|
83
|
+
keys["nan_value"] = dft_nan_value if dft_nan_value else user_nan_value
|
|
84
|
+
elif line_nr == 2:
|
|
85
|
+
(
|
|
86
|
+
keys["nrow"],
|
|
87
|
+
keys["ncol"],
|
|
88
|
+
keys["xmin"],
|
|
89
|
+
keys["xmax"],
|
|
90
|
+
keys["ymin"],
|
|
91
|
+
keys["ymax"],
|
|
92
|
+
) = line
|
|
93
|
+
elif line_nr == 3:
|
|
94
|
+
_, _, _ = line
|
|
95
|
+
elif line_nr >= 4 and line[0] != "@":
|
|
96
|
+
raise ZMAPFormatException(
|
|
97
|
+
f"Did not reach the values section, expected @, found: {line}"
|
|
98
|
+
)
|
|
99
|
+
else:
|
|
100
|
+
return keys
|
|
101
|
+
except ValueError as err:
|
|
102
|
+
raise ZMAPFormatException(f"Failed to unpack line: {line}") from err
|
|
103
|
+
line_nr += 1
|
|
104
|
+
raise ZMAPFormatException("End reached without complete header")
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
def is_comment(line):
|
|
108
|
+
return line.startswith(("!", "+"))
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
def parse_values(zmap_data, nan_value):
|
|
112
|
+
"""Parse actual values in zmap plus ascii files.
|
|
113
|
+
|
|
114
|
+
Note that header's node_width and nr_nodes_per_line in ZMAP header are not applied,
|
|
115
|
+
meaning that values import here is more tolerant than original zmap spec.
|
|
116
|
+
"""
|
|
117
|
+
values = []
|
|
118
|
+
for line in zmap_data:
|
|
119
|
+
if not is_comment(line):
|
|
120
|
+
values += line.split()
|
|
121
|
+
|
|
122
|
+
return np.ma.masked_equal(
|
|
123
|
+
np.array(values, dtype=np.float32),
|
|
124
|
+
nan_value,
|
|
125
|
+
)
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
@takes_stream("zmap_file", "r")
|
|
129
|
+
def parse_zmap(zmap_file, load_values=True):
|
|
130
|
+
header = parse_header(zmap_file)
|
|
131
|
+
zmap_data = ZMAPSurface(**header)
|
|
132
|
+
if load_values:
|
|
133
|
+
zmap_data.values = parse_values(zmap_file, zmap_data.nan_value)
|
|
134
|
+
return zmap_data
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
class ZMAPFormatException(Exception):
|
|
138
|
+
pass
|