Skip to content

Commit 671ad84

Browse files
authored
Merge branch 'main' into update_deps
2 parents 7b65451 + 1623f89 commit 671ad84

2 files changed

Lines changed: 27 additions & 43 deletions

File tree

src/mdio/builder/templates/seismic_3d_receiver_gathers.py

Lines changed: 14 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,19 @@
1111

1212

1313
class Seismic3DReceiverGathersTemplate(AbstractDatasetTemplate):
14-
"""Seismic 3D receiver gathers template with calculated shot index."""
14+
"""Seismic 3D receiver gathers template."""
1515

1616
def __init__(self) -> None:
1717
super().__init__(data_domain="time")
1818

19-
self._dim_names = ("receiver", "shot_line", "shot_index", "time")
20-
self._calculated_dims = ("shot_index",)
19+
self._dim_names = ("receiver", "shot_line", "shot_point", "time")
2120
self._physical_coord_names = (
2221
"receiver_x",
2322
"receiver_y",
2423
"source_coord_x",
2524
"source_coord_y",
2625
)
27-
self._logical_coord_names = ("shot_point",)
26+
self._logical_coord_names = ()
2827
self._var_chunk_shape = (1, 1, 512, 4096)
2928

3029
@property
@@ -37,11 +36,10 @@ def _load_dataset_attributes(self) -> dict[str, Any]:
3736
def declare_coordinate_specs(self) -> tuple[CoordinateSpec, ...]:
3837
"""Declare receiver- and shot-indexed coordinates for the 3D receiver gathers template."""
3938
receiver_dim = ("receiver",)
40-
shot_dims = ("shot_line", "shot_index")
39+
shot_dims = ("shot_line", "shot_point")
4140
return (
4241
CoordinateSpec(name="receiver_x", dimensions=receiver_dim, dtype=ScalarType.FLOAT64),
4342
CoordinateSpec(name="receiver_y", dimensions=receiver_dim, dtype=ScalarType.FLOAT64),
44-
CoordinateSpec(name="shot_point", dimensions=shot_dims, dtype=ScalarType.UINT32),
4543
CoordinateSpec(name="source_coord_x", dimensions=shot_dims, dtype=ScalarType.FLOAT64),
4644
CoordinateSpec(name="source_coord_y", dimensions=shot_dims, dtype=ScalarType.FLOAT64),
4745
)
@@ -51,12 +49,12 @@ def declare_dim_coordinate_types(self) -> DimCoordinateTypes:
5149
return {
5250
"receiver": ScalarType.UINT32,
5351
"shot_line": ScalarType.UINT32,
52+
"shot_point": ScalarType.UINT32,
5453
self._data_domain: ScalarType.INT32,
5554
}
5655

5756
def _add_coordinates(self) -> None:
5857
# Add dimension coordinates
59-
# Note: shot_index is calculated (0-N), so we don't add a coordinate for it
6058
self._builder.add_coordinate(
6159
"receiver",
6260
dimensions=("receiver",),
@@ -69,6 +67,12 @@ def _add_coordinates(self) -> None:
6967
data_type=self._dim_dtype("shot_line"),
7068
metadata=CoordinateMetadata(units_v1=self.get_unit_by_key("shot_line")),
7169
)
70+
self._builder.add_coordinate(
71+
"shot_point",
72+
dimensions=("shot_point",),
73+
data_type=self._dim_dtype("shot_point"),
74+
metadata=CoordinateMetadata(units_v1=self.get_unit_by_key("shot_point")),
75+
)
7276
self._builder.add_coordinate(
7377
self.trace_domain,
7478
dimensions=(self.trace_domain,),
@@ -95,26 +99,17 @@ def _add_coordinates(self) -> None:
9599
metadata=CoordinateMetadata(units_v1=self.get_unit_by_key("receiver_y")),
96100
)
97101

98-
# Shot point coordinate (actual shot point numbers, varies by shot_line and shot_index)
99-
self._builder.add_coordinate(
100-
"shot_point",
101-
dimensions=("shot_line", "shot_index"),
102-
data_type=ScalarType.UINT32,
103-
compressor=compressor,
104-
metadata=CoordinateMetadata(units_v1=self.get_unit_by_key("shot_point")),
105-
)
106-
107-
# Source coordinates (vary by shot_line and shot_index)
102+
# Source coordinates (vary by shot_line and shot_point)
108103
self._builder.add_coordinate(
109104
"source_coord_x",
110-
dimensions=("shot_line", "shot_index"),
105+
dimensions=("shot_line", "shot_point"),
111106
data_type=ScalarType.FLOAT64,
112107
compressor=compressor,
113108
metadata=CoordinateMetadata(units_v1=self.get_unit_by_key("source_coord_x")),
114109
)
115110
self._builder.add_coordinate(
116111
"source_coord_y",
117-
dimensions=("shot_line", "shot_index"),
112+
dimensions=("shot_line", "shot_point"),
118113
data_type=ScalarType.FLOAT64,
119114
compressor=compressor,
120115
metadata=CoordinateMetadata(units_v1=self.get_unit_by_key("source_coord_y")),

tests/unit/v1/templates/test_seismic_3d_receiver_gathers.py

Lines changed: 13 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -21,20 +21,24 @@
2121
EXPECTED_COORDINATES = [
2222
"receiver_x",
2323
"receiver_y",
24-
"shot_point",
2524
"source_coord_x",
2625
"source_coord_y",
2726
]
2827

29-
DATASET_SIZE_MAP = {"receiver": 100, "shot_line": 10, "shot_index": 500, "time": 2048}
28+
DATASET_SIZE_MAP = {"receiver": 100, "shot_line": 10, "shot_point": 500, "time": 2048}
3029

3130

3231
def _validate_coordinates_headers_trace_mask(dataset: Dataset, headers: StructuredType) -> None:
3332
"""Validate the coordinate, headers, trace_mask variables in the dataset."""
34-
dataset_dtype_map = {"receiver": "uint32", "shot_line": "uint32", "time": "int32"}
33+
dataset_dtype_map = {
34+
"receiver": "uint32",
35+
"shot_line": "uint32",
36+
"shot_point": "uint32",
37+
"time": "int32",
38+
}
3539

3640
# Verify variables
37-
# 3 dim coords (excluding shot_index) + 5 non-dim coords + 1 data + 1 trace mask + 1 headers = 11 variables
41+
# 4 dim coords + 4 non-dim coords + 1 data + 1 trace mask + 1 headers = 11 variables
3842
assert len(dataset.variables) == 11
3943

4044
# Verify trace headers
@@ -54,11 +58,8 @@ def _validate_coordinates_headers_trace_mask(dataset: Dataset, headers: Structur
5458
dtype=ScalarType.BOOL,
5559
)
5660

57-
# Verify dimension coordinate variables (excluding shot_index which is calculated)
61+
# Verify dimension coordinate variables
5862
for dim_name, dim_size in DATASET_SIZE_MAP.items():
59-
if dim_name == "shot_index":
60-
continue
61-
6263
validate_variable(
6364
dataset,
6465
name=dim_name,
@@ -86,26 +87,14 @@ def _validate_coordinates_headers_trace_mask(dataset: Dataset, headers: Structur
8687
)
8788
assert receiver_y.metadata.units_v1.length == LengthUnitEnum.METER
8889

89-
# Verify shot_point coordinate (logical)
90-
validate_variable(
91-
dataset,
92-
name="shot_point",
93-
dims=[
94-
("shot_line", DATASET_SIZE_MAP["shot_line"]),
95-
("shot_index", DATASET_SIZE_MAP["shot_index"]),
96-
],
97-
coords=["shot_point"],
98-
dtype=ScalarType.UINT32,
99-
)
100-
10190
# Verify source coordinate variables
10291
for coord_name in ["source_coord_x", "source_coord_y"]:
10392
coord = validate_variable(
10493
dataset,
10594
name=coord_name,
10695
dims=[
10796
("shot_line", DATASET_SIZE_MAP["shot_line"]),
108-
("shot_index", DATASET_SIZE_MAP["shot_index"]),
97+
("shot_point", DATASET_SIZE_MAP["shot_point"]),
10998
],
11099
coords=[coord_name],
111100
dtype=ScalarType.FLOAT64,
@@ -122,10 +111,10 @@ def test_configuration(self) -> None:
122111

123112
# Template attributes
124113
assert t.name == "ReceiverGathers3D"
125-
assert t._dim_names == ("receiver", "shot_line", "shot_index", "time")
126-
assert t._calculated_dims == ("shot_index",)
114+
assert t._dim_names == ("receiver", "shot_line", "shot_point", "time")
115+
assert t._calculated_dims == ()
127116
assert t._physical_coord_names == ("receiver_x", "receiver_y", "source_coord_x", "source_coord_y")
128-
assert t._logical_coord_names == ("shot_point",)
117+
assert t._logical_coord_names == ()
129118
assert t.full_chunk_shape == (1, 1, 512, 4096)
130119

131120
# Variables instantiated when build_dataset() is called

0 commit comments

Comments
 (0)