Skip to content

Commit d69459d

Browse files
committed
Cleanup debug prints
1 parent 3d69893 commit d69459d

File tree

3 files changed

+4
-51
lines changed

3 files changed

+4
-51
lines changed

src/mdio/builder/dataset_builder.py

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -125,32 +125,9 @@ def push_dimension(self, dimension: NamedDimension, position: int, new_dim_chunk
125125
msg = "New dimension chunk size must be greater than 0"
126126
raise ValueError(msg)
127127

128-
# print("###########################STATE BEFORE INSERTING DIMENSION ###########################")
129-
# for d in self._dimensions:
130-
# print(d.model_dump_json())
131-
# for c in self._coordinates:
132-
# print(c.model_dump_json())
133-
# for v in self._variables:
134-
# print(v.model_dump_json())
135-
# print("########################################################################################")
136-
137-
138128
# In-place insertion of the dimension to the existing list of dimensions
139129
self._dimensions.insert(position, dimension)
140130

141-
# def propogate_dimension(variable: Variable, position: int, new_dim_chunk_size: int) -> Variable:
142-
# """Propogates the dimension to the variable or coordinate."""
143-
# if len(variable.dimensions) <= position:
144-
# # Don't do anything if the new dimension is not within the Variable's domain
145-
# return variable
146-
# if variable.name == "trace_mask":
147-
# # Special case for trace_mask. Don't do anything.
148-
# return variable
149-
# # new_dimensions = variable.dimensions[:position] + (dimension,) + variable.dimensions[position:]
150-
# # new_chunk_sizes = variable.chunk_sizes[:position] + (new_dim_chunk_size,) + variable.chunk_sizes[position:]
151-
# new_dimensions = variable.dimensions[:position] + [dimension] + variable.dimensions[position:]
152-
# new_chunk_sizes = variable.chunk_sizes[:position] + [new_dim_chunk_size] + variable.chunk_sizes[position:]
153-
# return variable.model_copy(update={"dimensions": new_dimensions, "chunk_sizes": new_chunk_sizes})
154131
def propogate_dimension(variable: Variable, position: int, new_dim_chunk_size: int) -> Variable:
155132
"""Propogates the dimension to the variable or coordinate."""
156133
from mdio.builder.schemas.chunk_grid import RegularChunkGrid, RegularChunkShape
@@ -160,8 +137,6 @@ def propogate_dimension(variable: Variable, position: int, new_dim_chunk_size: i
160137
if variable.name == "trace_mask":
161138
# Special case for trace_mask. Don't do anything.
162139
return variable
163-
# new_dimensions = variable.dimensions[:position] + (dimension,) + variable.dimensions[position:]
164-
# new_chunk_sizes = variable.chunk_sizes[:position] + (new_dim_chunk_size,) + variable.chunk_sizes[position:]
165140
new_dimensions = variable.dimensions[:position] + [dimension] + variable.dimensions[position:]
166141

167142
# Get current chunk shape from metadata

src/mdio/converters/segy.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -381,17 +381,12 @@ def segy_to_mdio( # noqa PLR0913
381381
header_dtype=to_structured_type(segy_spec.trace.header.dtype),
382382
)
383383

384-
# print(mdio_ds.model_dump_json())
385-
for v in mdio_ds.variables:
386-
print(f"Attempting to dump variable {v.name}... ", end="")
387-
tmp = v.model_dump_json()
388-
print("Good!")
389-
# print(v.model_dump_json())
390-
391384
_add_grid_override_to_metadata(dataset=mdio_ds, grid_overrides=grid_overrides)
392385

393386
xr_dataset: xr_Dataset = to_xarray_dataset(mdio_ds=mdio_ds)
394387

388+
print(xr_dataset)
389+
395390
_, non_dim_coords = _get_coordinates(grid, segy_headers, mdio_template)
396391
xr_dataset, drop_vars_delayed = _populate_coordinates(
397392
dataset=xr_dataset,

src/mdio/segy/utilities.py

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -67,37 +67,20 @@ def get_grid_plan( # noqa: C901
6767
# Create filtered copy using numpy's field selection
6868
reduced_headers_subset = HeaderArray(headers_subset[fields_to_keep])
6969

70-
# print("="*100)
71-
# print(headers_subset.to_dict().keys())
72-
# print(headers_subset)
73-
# print("="*100)
74-
7570
# Handle grid overrides.
7671
override_handler = GridOverrider()
7772
headers_subset, horizontal_coordinates, chunksize = override_handler.run(
7873
# headers_subset,
7974
reduced_headers_subset,
80-
horizontal_coordinates,
81-
# horizontal_dimensions,
75+
# horizontal_coordinates,
76+
horizontal_dimensions,
8277
chunksize=chunksize,
8378
grid_overrides=grid_overrides,
8479
)
8580

86-
# print("="*100)
87-
# print(headers_subset.to_dict().keys())
88-
# print(headers_subset)
89-
# print("="*100)
90-
9181
if grid_overrides.get("HasDuplicates", False):
92-
# print(f"Size of header subset: {headers_subset['trace'].size}")
93-
# print("="*100)
94-
# print(headers_subset)
95-
# print("="*100)
9682
pos = len(template.dimension_names) - 1 # TODO: Implement the negative position case...
97-
# template._queue_transform(lambda builder: builder.push_dimension(Dimension(coords=np.arange(headers_subset["trace"].size), name="trace"), position=pos, new_dim_chunk_size=1))
98-
# template._queue_transform(lambda builder: builder.push_dimension(Dimension(coords=headers_subset["trace"].size, name="trace"), position=pos, new_dim_chunk_size=1))
9983
template._queue_transform(lambda builder: builder.push_dimension(NamedDimension(name="trace", size=headers_subset["trace"].size), position=pos, new_dim_chunk_size=1))
100-
# horizontal_dimensions.append("trace")
10184
horizontal_dimensions = (*horizontal_dimensions, "trace")
10285

10386
dimensions = []

0 commit comments

Comments
 (0)