1111from mdio .builder .schemas .v1 .dataset import Dataset
1212from mdio .builder .schemas .v1 .units import LengthUnitEnum
1313from mdio .builder .schemas .v1 .units import LengthUnitModel
14+ from mdio .builder .schemas .v1 .units import TimeUnitEnum
15+ from mdio .builder .schemas .v1 .units import TimeUnitModel
1416from mdio .builder .templates .seismic_prestack import SeismicPreStackTemplate
1517
1618UNITS_METER = LengthUnitModel (length = LengthUnitEnum .METER )
19+ UNITS_SECOND = TimeUnitModel (time = TimeUnitEnum .SECOND )
1720
1821
1922def _validate_coordinates_headers_trace_mask (dataset : Dataset , headers : StructuredType , domain : str ) -> None :
@@ -27,15 +30,15 @@ def _validate_coordinates_headers_trace_mask(dataset: Dataset, headers: Structur
2730 dataset ,
2831 name = "headers" ,
2932 dims = [("shot_line" , 1 ), ("gun" , 3 ), ("shot_point" , 256 ), ("cable" , 512 ), ("channel" , 24 )],
30- coords = ["energy_source_point_number " , "source_coord_x" , "source_coord_y" , "group_coord_x" , "group_coord_y" ],
33+ coords = ["orig_field_record_num " , "source_coord_x" , "source_coord_y" , "group_coord_x" , "group_coord_y" ],
3134 dtype = headers ,
3235 )
3336
3437 validate_variable (
3538 dataset ,
3639 name = "trace_mask" ,
3740 dims = [("shot_line" , 1 ), ("gun" , 3 ), ("shot_point" , 256 ), ("cable" , 512 ), ("channel" , 24 )],
38- coords = ["energy_source_point_number " , "source_coord_x" , "source_coord_y" , "group_coord_x" , "group_coord_y" ],
41+ coords = ["orig_field_record_num " , "source_coord_x" , "source_coord_y" , "group_coord_x" , "group_coord_y" ],
3942 dtype = ScalarType .BOOL ,
4043 )
4144
@@ -97,9 +100,9 @@ def _validate_coordinates_headers_trace_mask(dataset: Dataset, headers: Structur
97100 # Verify non-dimension coordinate variables
98101 validate_variable (
99102 dataset ,
100- name = "energy_source_point_number " ,
103+ name = "orig_field_record_num " ,
101104 dims = [("shot_line" , 1 ), ("gun" , 3 ), ("shot_point" , 256 )],
102- coords = ["energy_source_point_number " ],
105+ coords = ["orig_field_record_num " ],
103106 dtype = ScalarType .INT32 ,
104107 )
105108
@@ -148,39 +151,43 @@ def test_configuration(self) -> None:
148151 t = SeismicPreStackTemplate (data_domain = "time" )
149152
150153 # Template attributes for prestack shot
151- assert t ._data_domain == "time"
152- assert t ._coord_dim_names == ["shot_line" , "gun" , "shot_point" , "cable" , "channel" ]
153- assert t ._dim_names == ["shot_line" , "gun" , "shot_point" , "cable" , "channel" , "time" ]
154- assert t ._coord_names == [
155- "energy_source_point_number" ,
154+ assert t .name == "PreStackGathers3DTime"
155+ assert t .default_variable_name == "amplitude"
156+ assert t .trace_domain == "time"
157+ assert t .spatial_dimension_names == ("shot_line" , "gun" , "shot_point" , "cable" , "channel" )
158+ assert t .dimension_names == ("shot_line" , "gun" , "shot_point" , "cable" , "channel" , "time" )
159+ assert t .physical_coordinate_names == ("source_coord_x" , "source_coord_y" , "group_coord_x" , "group_coord_y" )
160+ assert t .logical_coordinate_names == ("orig_field_record_num" ,)
161+ assert t .coordinate_names == (
156162 "source_coord_x" ,
157163 "source_coord_y" ,
158164 "group_coord_x" ,
159165 "group_coord_y" ,
160- ]
161- assert t ._var_chunk_shape == [1 , 1 , 16 , 1 , 32 , - 1 ]
166+ "orig_field_record_num" ,
167+ )
168+ assert t .full_chunk_size == (1 , 1 , 16 , 1 , 32 , - 1 )
162169
163170 # Variables instantiated when build_dataset() is called
164171 assert t ._builder is None
165172 assert t ._dim_sizes == ()
166- assert t ._horizontal_coord_unit is None
173+ assert t ._units == {}
167174
168175 # Verify prestack shot attributes
169176 attrs = t ._load_dataset_attributes ()
170177 assert attrs == {"surveyDimensionality" : "3D" , "ensembleType" : "shot_point" , "processingStage" : "pre-stack" }
178+ assert t .default_variable_name == "amplitude"
171179
172180 assert t .name == "PreStackGathers3DTime"
173181
174182 def test_build_dataset (self , structured_headers : StructuredType ) -> None :
175183 """Unit tests for SeismicPreStackTemplate build in time domain."""
176184 t = SeismicPreStackTemplate (data_domain = "time" )
185+ t .add_units ({"source_coord_x" : UNITS_METER , "source_coord_y" : UNITS_METER }) # spatial domain units
186+ t .add_units ({"group_coord_x" : UNITS_METER , "group_coord_y" : UNITS_METER }) # spatial domain units
187+ t .add_units ({"time" : UNITS_SECOND }) # data domain units
177188
178- assert t .name == "PreStackGathers3DTime"
179189 dataset = t .build_dataset (
180- "North Sea 3D Shot Time" ,
181- sizes = (1 , 3 , 256 , 512 , 24 , 2048 ),
182- horizontal_coord_unit = UNITS_METER ,
183- header_dtype = structured_headers ,
190+ "North Sea 3D Shot Time" , sizes = (1 , 3 , 256 , 512 , 24 , 2048 ), header_dtype = structured_headers
184191 )
185192
186193 assert dataset .metadata .name == "North Sea 3D Shot Time"
@@ -195,7 +202,7 @@ def test_build_dataset(self, structured_headers: StructuredType) -> None:
195202 dataset ,
196203 name = "amplitude" ,
197204 dims = [("shot_line" , 1 ), ("gun" , 3 ), ("shot_point" , 256 ), ("cable" , 512 ), ("channel" , 24 ), ("time" , 2048 )],
198- coords = ["energy_source_point_number " , "source_coord_x" , "source_coord_y" , "group_coord_x" , "group_coord_y" ],
205+ coords = ["orig_field_record_num " , "source_coord_x" , "source_coord_y" , "group_coord_x" , "group_coord_y" ],
199206 dtype = ScalarType .FLOAT32 ,
200207 )
201208 assert isinstance (seismic .compressor , Blosc )
0 commit comments