@@ -421,19 +421,51 @@ def transform_chunksize(
421421
422422
423423class NonBinned (DuplicateIndex ):
424- """Automatically index traces in a single specified axis - trace."""
424+ """Handle non-binned dimensions by converting them to a trace dimension with coordinates.
425+
426+ This override takes dimensions that are not regularly sampled (non-binned) and converts
427+ them into a single 'trace' dimension. The original non-binned dimensions become coordinates
428+ indexed by the trace dimension.
429+
430+ Example:
431+ Template with dimensions [shot_point, cable, channel, azimuth, offset, sample]
432+ and non_binned_dims=['azimuth', 'offset'] becomes:
433+ - dimensions: [shot_point, cable, channel, trace, sample]
434+ - coordinates: azimuth and offset with dimensions [shot_point, cable, channel, trace]
435+
436+ Attributes:
437+ required_keys: No required keys for this override.
438+ required_parameters: Set containing 'chunksize' and 'non_binned_dims'.
439+ """
425440
426441 required_keys = None
427- required_parameters = {"chunksize" }
442+ required_parameters = {"chunksize" , "non_binned_dims" }
443+
444+ def validate (self , index_headers : HeaderArray , grid_overrides : dict [str , bool | int ]) -> None :
445+ """Validate if this transform should run on the type of data."""
446+ self .check_required_params (grid_overrides )
447+
448+ # Validate that non_binned_dims is a list
449+ non_binned_dims = grid_overrides .get ("non_binned_dims" , [])
450+ if not isinstance (non_binned_dims , list ):
451+ msg = f"non_binned_dims must be a list, got { type (non_binned_dims )} "
452+ raise ValueError (msg )
453+
454+ # Validate that all non-binned dimensions exist in headers
455+ missing_dims = set (non_binned_dims ) - set (index_headers .dtype .names )
456+ if missing_dims :
457+ msg = f"Non-binned dimensions { missing_dims } not found in index headers"
458+ raise ValueError (msg )
428459
429460 def transform_chunksize (
430461 self ,
431462 chunksize : Sequence [int ],
432463 grid_overrides : dict [str , bool | int ],
433464 ) -> Sequence [int ]:
434- """Perform the transform of chunksize ."""
465+ """Insert chunksize for trace dimension at N-1 position ."""
435466 new_chunks = list (chunksize )
436- new_chunks .insert (- 1 , grid_overrides ["chunksize" ])
467+ trace_chunksize = grid_overrides ["chunksize" ]
468+ new_chunks .insert (- 1 , trace_chunksize )
437469 return tuple (new_chunks )
438470
439471
@@ -544,6 +576,9 @@ def get_allowed_parameters(self) -> set:
544576
545577 parameters .update (command .required_parameters )
546578
579+ # Add optional parameters that are not strictly required but are valid
580+ parameters .add ("non_binned_dims" )
581+
547582 return parameters
548583
549584 def run (
0 commit comments