2727os .environ ["MDIO__IMPORT__SAVE_SEGY_FILE_HEADER" ] = "true"
2828
2929
30- @pytest .mark .parametrize ("grid_override" , [{"HasDuplicates" : True }])
30+ # @pytest.mark.parametrize("grid_override", [{"NonBinned": True, "chunksize": 4, "non_binned_dims": ["channel"]}, {"HasDuplicates": True}])
31+ @pytest .mark .parametrize ("grid_override" , [{"NonBinned" : True , "chunksize" : 4 , "non_binned_dims" : ["channel" ]}])
3132@pytest .mark .parametrize ("chan_header_type" , [StreamerShotGeometryType .C ])
3233class TestImport4DNonReg :
3334 """Test for 4D segy import with grid overrides."""
@@ -43,11 +44,14 @@ def test_import_4d_segy( # noqa: PLR0913
4344 segy_spec : SegySpec = get_segy_mock_4d_spec ()
4445 segy_path = segy_mock_4d_shots [chan_header_type ]
4546
47+ path = "tmp.mdio"
48+ print (f"Running test with grid override: { grid_override } " )
49+
4650 segy_to_mdio (
4751 segy_spec = segy_spec ,
4852 mdio_template = TemplateRegistry ().get ("PreStackShotGathers3DTime" ),
4953 input_path = segy_path ,
50- output_path = zarr_tmp ,
54+ output_path = path ,
5155 overwrite = True ,
5256 grid_overrides = grid_override ,
5357 )
@@ -58,25 +62,31 @@ def test_import_4d_segy( # noqa: PLR0913
5862 cables = [0 , 101 , 201 , 301 ]
5963 receivers_per_cable = [1 , 5 , 7 , 5 ]
6064
61- ds = open_mdio (zarr_tmp )
65+ ds = open_mdio (path )
6266
6367 assert ds ["segy_file_header" ].attrs ["binaryHeader" ]["samples_per_trace" ] == num_samples
6468 assert ds .attrs ["attributes" ]["gridOverrides" ] == grid_override
6569
6670 xrt .assert_duckarray_equal (ds ["shot_point" ], shots )
6771 xrt .assert_duckarray_equal (ds ["cable" ], cables )
6872
69- # HasDuplicates should create a trace dimension
73+ # Both HasDuplicates and NonBinned should create a trace dimension
7074 expected = list (range (1 , np .amax (receivers_per_cable ) + 1 ))
7175 xrt .assert_duckarray_equal (ds ["trace" ], expected )
7276
7377 times_expected = list (range (0 , num_samples , 1 ))
7478 xrt .assert_duckarray_equal (ds ["time" ], times_expected )
7579
76- # HasDuplicates uses chunksize of 1 for trace dimension
80+ # Check trace chunk size based on grid override
7781 trace_chunks = ds ["amplitude" ].chunksizes .get ("trace" , None )
7882 if trace_chunks is not None :
79- assert all (chunk == 1 for chunk in trace_chunks )
83+ if "NonBinned" in grid_override :
84+ # NonBinned uses specified chunksize for trace dimension
85+ expected_chunksize = grid_override .get ("chunksize" , 1 )
86+ assert all (chunk == expected_chunksize for chunk in trace_chunks )
87+ else :
88+ # HasDuplicates uses chunksize of 1 for trace dimension
89+ assert all (chunk == 1 for chunk in trace_chunks )
8090
8191
8292@pytest .mark .parametrize ("grid_override" , [{"AutoChannelWrap" : True }, None ])
0 commit comments