Skip to content

Commit 767a399

Browse files
committed
update shot_index dtype to uint32 and add calculated_dims property
1 parent a77717a commit 767a399

File tree

4 files changed

+9
-1
lines changed

4 files changed

+9
-1
lines changed

src/mdio/builder/templates/base.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ def __init__(self, data_domain: SeismicDataDomain) -> None:
3939
raise ValueError(msg)
4040

4141
self._dim_names: tuple[str, ...] = ()
42+
self._calculated_dims: tuple[str, ...] = ()
4243
self._physical_coord_names: tuple[str, ...] = ()
4344
self._logical_coord_names: tuple[str, ...] = ()
4445
self._var_chunk_shape: tuple[int, ...] = ()
@@ -130,6 +131,11 @@ def dimension_names(self) -> tuple[str, ...]:
130131
"""Returns the names of the dimensions."""
131132
return copy.deepcopy(self._dim_names)
132133

134+
@property
135+
def calculated_dimension_names(self) -> tuple[str, ...]:
136+
"""Returns the names of the dimensions."""
137+
return copy.deepcopy(self._calculated_dims)
138+
133139
@property
134140
def physical_coordinate_names(self) -> tuple[str, ...]:
135141
"""Returns the names of the physical (world) coordinates."""

src/mdio/builder/templates/seismic_3d_streamer_field.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ def __init__(self, data_domain: SeismicDataDomain = "time"):
2525
super().__init__(data_domain=data_domain)
2626

2727
self._spatial_dim_names = ("sail_line", "gun", "shot_index", "cable", "channel")
28+
self._calculated_dims = ("shot_index",)
2829
self._dim_names = (*self._spatial_dim_names, self._data_domain)
2930
self._physical_coord_names = ("source_coord_x", "source_coord_y", "group_coord_x", "group_coord_y")
3031
self._logical_coord_names = ("shot_point", "orig_field_record_num") # ffid

src/mdio/converters/segy.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -488,6 +488,7 @@ def _validate_spec_in_template(segy_spec: SegySpec, mdio_template: AbstractDatas
488488
header_fields = {field.name for field in segy_spec.trace.header.fields}
489489

490490
required_fields = set(mdio_template.spatial_dimension_names) | set(mdio_template.coordinate_names)
491+
required_fields = required_fields - set(mdio_template.calculated_dimension_names) # remove to be calculated
491492
required_fields = required_fields | {"coordinate_scalar"} # ensure coordinate scalar is always present
492493
missing_fields = required_fields - header_fields
493494

src/mdio/segy/geometry.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -487,7 +487,7 @@ def transform(
487487

488488
# This might be slow and potentially could be improved with a rewrite
489489
# to prevent so many lookups
490-
shot_index = np.empty(len(index_headers), dtype="uint8")
490+
shot_index = np.empty(len(index_headers), dtype="uint32")
491491
index_headers = rfn.append_fields(index_headers, "shot_index", shot_index)
492492
if geom_type == ShotGunGeometryType.B:
493493
for sail_line in unique_sail_lines:

0 commit comments

Comments
 (0)