Skip to content

Commit 7b4020e

Browse files
committed
Removed raw byte inserts
Removed the insertions of raw bytes into the raw bytes Variable. This issue will be addressed in tgsai/segy release >0.5.1
1 parent 55d9464 commit 7b4020e

File tree

1 file changed

+0
-33
lines changed

1 file changed

+0
-33
lines changed

src/mdio/converters/segy.py

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,12 @@
44

55
import logging
66
import os
7-
from copy import deepcopy
87
from typing import TYPE_CHECKING
98

109
import numpy as np
1110
import zarr
1211
from segy import SegyFile
1312
from segy.config import SegySettings
14-
from segy.schema import HeaderField
15-
from segy.schema import ScalarType as ScalarType2
1613
from segy.standards.codes import MeasurementSystem as segy_MeasurementSystem
1714
from segy.standards.fields.trace import Rev0 as TraceHeaderFieldsRev0
1815

@@ -344,33 +341,6 @@ def _add_grid_override_to_metadata(dataset: Dataset, grid_overrides: dict[str, A
344341
dataset.metadata.attributes["gridOverrides"] = grid_overrides
345342

346343

347-
def _scalar_to_size(scalar: ScalarType2) -> int:
348-
# TODO(BrianMichell): #0000 Lazy way to support conversion.
349-
if scalar == ScalarType2.STRING8:
350-
return 8
351-
try:
352-
return int(str(scalar)[-2:]) // 8
353-
except ValueError:
354-
return 1
355-
356-
357-
def _customize_segy_spec(segy_spec: SegySpec) -> SegySpec:
358-
assigned_bytes = []
359-
360-
ret = deepcopy(segy_spec)
361-
362-
for field in segy_spec.trace.header.fields:
363-
byte = field.byte - 1
364-
for i in range(byte, byte + _scalar_to_size(field.format)):
365-
assigned_bytes.append(i) # noqa: PERF402
366-
unassigned_bytes = [i for i in range(240) if i not in assigned_bytes]
367-
field_to_customize = [
368-
HeaderField(name=f"__MDIO_RAW_UNSPECIFIED_Field_{i}", format=ScalarType.UINT8, byte=i + 1)
369-
for i in unassigned_bytes
370-
]
371-
return ret.customize(trace_header_fields=field_to_customize)
372-
373-
374344
def _add_raw_headers_to_template(mdio_template: AbstractDatasetTemplate) -> AbstractDatasetTemplate:
375345
"""Add raw headers capability to the MDIO template by monkey-patching its _add_variables method.
376346
@@ -451,9 +421,6 @@ def segy_to_mdio( # noqa PLR0913
451421
input_path = _normalize_path(input_path)
452422
output_path = _normalize_path(output_path)
453423

454-
if os.getenv("MDIO__DO_RAW_HEADERS") == "1":
455-
segy_spec = _customize_segy_spec(segy_spec)
456-
457424
if not overwrite and output_path.exists():
458425
err = f"Output location '{output_path.as_posix()}' exists. Set `overwrite=True` if intended."
459426
raise FileExistsError(err)

0 commit comments

Comments
 (0)