Skip to content

BUG: Ingesting segy file with all sample values exactly zero fails in #550

@amitpendharkar

Description

@amitpendharkar

Issue:
Segy file has the required binary and trace headers but all the sample values in that file are exactly zero. This is possible when delta field is consciously chosen to be exactly zero. Such a file cannot be ingested to mdio format.

Steps to replicate:
Unzip the attached file to get the segy file. This file is just one trace with required headers but all sample values zeros.

AP_Data_900_General_SingleTracewithSampleValuesZero.zip

Following code replicates the issue

from mdio import segy_to_mdio

segy_file = "SingleTracewithSampleValuesZero.sgy"
mdio_file = "SingleTracewithSampleValuesZero.mdio"

if __name__ == "__main__":
    segy_to_mdio(segy_file, mdio_file, index_bytes=[21], index_names=["cdp"], index_types=["int32"], chunksize=(128, 128), overwrite=True)

Error:
The execution fails at

glob_count, glob_sum, glob_sum_square, glob_min, glob_max = chunk_stats

with error

    segy_to_mdio(segy_file, mdio_file, index_bytes=[21], index_names=["cdp"], index_types=["int32"], chunksize=(128, 128), overwrite=True)
ValueError: not enough values to unpack (expected 5, got 0)

Expected behavior
If the segy file has all sample values exactly zeros, we should generate a warning so that user can investigate. The ingestion should however still go through.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions