@@ -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
0 commit comments