Skip to content

Commit 116f625

Browse files
committed
simplify 240-byte scalar type
1 parent 8af1c58 commit 116f625

File tree

4 files changed

+3
-5
lines changed

4 files changed

+3
-5
lines changed

src/mdio/builder/schemas/dtype.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class ScalarType(StrEnum):
3232
COMPLEX64 = "complex64"
3333
COMPLEX128 = "complex128"
3434
COMPLEX256 = "complex256"
35-
HEADERS_V3 = "r1920" # Raw number of BITS, must be a multiple of 8
35+
BYTES240 = "V240" # fixed-width 240-byte string, used for raw v0/1/2 trace headers
3636

3737

3838
class StructuredField(CamelCaseStrictModel):

src/mdio/constants.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,5 +64,5 @@ class ZarrFormat(IntEnum):
6464
ScalarType.COMPLEX64: complex(np.nan, np.nan),
6565
ScalarType.COMPLEX128: complex(np.nan, np.nan),
6666
ScalarType.COMPLEX256: complex(np.nan, np.nan),
67-
ScalarType.HEADERS_V3: b"\x00" * 240,
67+
ScalarType.BYTES240: b"\x00" * 240,
6868
}

src/mdio/converters/segy.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,7 @@ def enhanced_add_variables() -> None:
380380
name="raw_headers",
381381
long_name="Raw Headers",
382382
dimensions=mdio_template._dim_names[:-1], # All dimensions except vertical
383-
data_type=ScalarType.HEADERS_V3,
383+
data_type=ScalarType.BYTES240,
384384
compressor=Blosc(cname=BloscCname.zstd),
385385
coordinates=None, # No coordinates as specified
386386
metadata=VariableMetadata(chunk_grid=chunk_metadata),

src/mdio/converters/type_converter.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,6 @@ def to_structured_type(data_type: np_dtype) -> StructuredType:
7878
def to_numpy_dtype(data_type: ScalarType | StructuredType) -> np_dtype:
7979
"""Get the numpy dtype for a variable."""
8080
if isinstance(data_type, ScalarType):
81-
if data_type == ScalarType.HEADERS_V3:
82-
return np_dtype("|V240")
8381
return np_dtype(data_type.value)
8482
if isinstance(data_type, StructuredType):
8583
return np_dtype([(f.name, f.format.value) for f in data_type.fields])

0 commit comments

Comments
 (0)