@@ -261,6 +261,38 @@ def test_import(self, test_conf: MaskedExportConfig, export_masked_path: Path) -
261261 overwrite = True ,
262262 )
263263
264+ def test_ingested_mdio (self , test_conf : MaskedExportConfig , export_masked_path : Path ) -> None :
265+ """Verify if ingested data is correct."""
266+ grid_conf , segy_factory_conf , segy_to_mdio_conf , _ = test_conf
267+ mdio_path = export_masked_path / f"{ grid_conf .name } .mdio"
268+
269+ ndim = len (segy_to_mdio_conf .chunks )
270+ access_pattern = "" .join (map (str , range (ndim )))
271+ actual_reader = MDIOReader (mdio_path , access_pattern = access_pattern , return_metadata = True )
272+
273+ # Test dimensions and ingested dimension headers
274+ expected_dims = grid_conf .dims
275+ for expected_dim in expected_dims :
276+ actual_dim = actual_reader .grid .select_dim (expected_dim .name )
277+ assert expected_dim .name == actual_dim .name
278+ assert expected_dim .size == actual_dim .coords .size
279+ assert expected_dim .start == actual_dim .coords [0 ]
280+
281+ num_traces = np .prod (actual_reader .live_mask .shape )
282+
283+ # Read all the data into memory
284+ live , headers , traces = actual_reader [..., 0 ]
285+
286+ # Ensure live mask is full
287+ np .testing .assert_equal (live , True )
288+
289+ # TODO(Altay): Check if all dimension headers are correct
290+ # https://github.com/TGSAI/mdio-python/issues/593
291+
292+ # Check if all trace values are correct (e.g. == sequential 1 to N)
293+ np .testing .assert_array_equal (traces .ravel (), np .arange (1 , num_traces + 1 ))
294+
295+
264296 def test_export (self , test_conf : MaskedExportConfig , export_masked_path : Path ) -> None :
265297 """Test export of an n-D MDIO file back to SEG-Y."""
266298 grid_conf , segy_factory_conf , segy_to_mdio_conf , _ = test_conf
0 commit comments