Skip to content

Commit c9d035d

Browse files
committed
Get known size for pushed dimension
1 parent 14c7c60 commit c9d035d

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

src/mdio/builder/dataset_builder.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ def add_dimension(self, name: str, size: int) -> "MDIODatasetBuilder":
101101
self._state = _BuilderState.HAS_DIMENSIONS
102102
return self
103103

104-
def push_dimension(self, dimension: NamedDimension, position: int, new_dim_chunk_size: int=1) -> "MDIODatasetBuilder":
104+
def push_dimension(self, dimension: NamedDimension, position: int, new_dim_chunk_size: int=1, new_dim_size: int=1) -> "MDIODatasetBuilder":
105105
"""Pushes a dimension to all Coordiantes and Variables.
106106
The position argument is the domain index of the dimension to push.
107107
If a Variable is within the position domain, it will be inserted at the position and all remaining dimensions will be shifted to the right.
@@ -128,8 +128,7 @@ def push_dimension(self, dimension: NamedDimension, position: int, new_dim_chunk
128128
# In-place insertion of the dimension to the existing list of dimensions
129129
self._dimensions.insert(position, dimension)
130130

131-
# TODO: HARDCODED FOR DEBUGGING
132-
self._dimensions[-1].size = 25
131+
self._dimensions[position].size = new_dim_size
133132

134133
def propogate_dimension(variable: Variable, position: int, new_dim_chunk_size: int) -> Variable:
135134
"""Propogates the dimension to the variable or coordinate."""

src/mdio/segy/utilities.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def delayed_transform(builder):
5252

5353
# Add the trace dimension
5454
trace_dimension = NamedDimension(name="trace", size=trace_size)
55-
builder.push_dimension(trace_dimension, position=position, new_dim_chunk_size=1)
55+
builder.push_dimension(trace_dimension, position=position, new_dim_chunk_size=1, new_dim_size=trace_size)
5656

5757
# Add the corresponding coordinate for the trace dimension
5858
builder.add_coordinate(

0 commit comments

Comments
 (0)