11"""MDIO factories for seismic data."""
22
3+ # TODO(BrianMichell): Add implementations for other canonical datasets.
4+
35from __future__ import annotations
46
5- import importlib
6- from datetime import UTC
7- from datetime import datetime
87from enum import Enum
98from enum import auto
109from typing import Any
11- from typing import Dict
12- from typing import List
13- from typing import Optional
1410
1511from mdio .core .v1 .builder import MDIODatasetBuilder
1612from mdio .schema .compressors import Blosc
1713from mdio .schema .dtype import ScalarType
1814from mdio .schema .dtype import StructuredType
1915from mdio .schema .v1 .dataset import Dataset
20- from mdio .schema .v1 .units import AllUnits
21- from mdio .schema .v1 .units import LengthUnitModel
2216
2317
2418class MDIOSchemaType (Enum ):
@@ -46,14 +40,14 @@ def __init__(self):
4640 def create (
4741 self ,
4842 name : str ,
49- shape : List [int ],
50- header_fields : Dict [str , str ],
43+ shape : list [int ],
44+ header_fields : dict [str , str ],
5145 create_coords : bool = False ,
52- sample_format : Optional [ str ] = None ,
53- chunks : Optional [ List [ int ]] = None ,
54- sample_units : Optional [ Dict [ str , str ]] = None ,
55- z_units : Optional [ Dict [ str , str ]] = None ,
56- attributes : Optional [ Dict [ str , Any ]] = None ,
46+ sample_format : str | None = None ,
47+ chunks : list [ int ] | None = None ,
48+ sample_units : dict [ str , str ] | None = None ,
49+ z_units : dict [ str , str ] | None = None ,
50+ attributes : dict [ str , Any ] | None = None ,
5751 ) -> Dataset :
5852 """Create a generic seismic dataset schema.
5953
@@ -80,7 +74,7 @@ def create(
8074 )
8175
8276 # Add dimensions
83- for dim_name , dim_size in zip (self ._dim_names , shape ):
77+ for dim_name , dim_size in zip (self ._dim_names , shape , strict = True ):
8478 builder .add_dimension (
8579 name = dim_name ,
8680 size = dim_size ,
@@ -108,10 +102,12 @@ def create(
108102 )
109103
110104 # Add header variable with structured dtype
111- header_dtype = StructuredType (fields = [
112- {"name" : field_name , "format" : field_type }
113- for field_name , field_type in header_fields .items ()
114- ])
105+ header_dtype = StructuredType (
106+ fields = [
107+ {"name" : field_name , "format" : field_type }
108+ for field_name , field_type in header_fields .items ()
109+ ]
110+ )
115111 builder .add_variable (
116112 name = "headers" ,
117113 data_type = header_dtype ,
@@ -145,14 +141,14 @@ def __init__(self, domain: str):
145141 def create (
146142 self ,
147143 name : str ,
148- shape : List [int ],
149- header_fields : Dict [str , str ],
144+ shape : list [int ],
145+ header_fields : dict [str , str ],
150146 create_coords : bool = False ,
151- sample_format : Optional [ str ] = None ,
152- chunks : Optional [ List [ int ]] = None ,
153- sample_units : Optional [ Dict [ str , str ]] = None ,
154- z_units : Optional [ Dict [ str , str ]] = None ,
155- attributes : Optional [ Dict [ str , Any ]] = None ,
147+ sample_format : str | None = None ,
148+ chunks : list [ int ] | None = None ,
149+ sample_units : dict [ str , str ] | None = None ,
150+ z_units : dict [ str , str ] | None = None ,
151+ attributes : dict [ str , Any ] | None = None ,
156152 ) -> Dataset :
157153 """Create a seismic dataset schema with domain-specific attributes."""
158154 # Add seismic-specific attributes
@@ -197,14 +193,14 @@ def __init__(self, domain: str):
197193 def create (
198194 self ,
199195 name : str ,
200- shape : List [int ],
201- header_fields : Dict [str , str ],
196+ shape : list [int ],
197+ header_fields : dict [str , str ],
202198 create_coords : bool = False ,
203- sample_format : Optional [ str ] = None ,
204- chunks : Optional [ List [ int ]] = None ,
205- sample_units : Optional [ Dict [ str , str ]] = None ,
206- z_units : Optional [ Dict [ str , str ]] = None ,
207- attributes : Optional [ Dict [ str , Any ]] = None ,
199+ sample_format : str | None = None ,
200+ chunks : list [ int ] | None = None ,
201+ sample_units : dict [ str , str ] | None = None ,
202+ z_units : dict [ str , str ] | None = None ,
203+ attributes : dict [ str , Any ] | None = None ,
208204 ) -> Dataset :
209205 """Create a seismic dataset schema with pre-stack attributes."""
210206 # Add seismic-specific attributes
0 commit comments