How to use the segyio.tools.cube function in segyio

To help you get started, we’ve selected a few segyio examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github microsoft / seismic-deeplearning / interpretation / deepseismic_interpretation / data.py View on Github external
def read_segy(filename):
    """
    Read in a SEGY-format file given a filename

    Args:
        filename: input filename

    Returns:
        numpy data array and its info as a dictionary (tuple)

    """
    logging.info(f"Loading data cube from {filename}")

    # Read full data cube
    data = segyio.tools.cube(filename)

    # Read meta data
    segyfile = segyio.open(filename, "r")
    print("  Crosslines: ", segyfile.xlines[0], ":", segyfile.xlines[-1])
    print("  Inlines:    ", segyfile.ilines[0], ":", segyfile.ilines[-1])
    print("  Timeslices: ", "1", ":", data.shape[2])

    # Make dict with cube-info
    # TODO: read this from segy
    # Read dt and other params needed to do create a new
    data_info = {
        "crossline_start": segyfile.xlines[0],
        "inline_start": segyfile.ilines[0],
        "timeslice_start": 1,
        "shape": data.shape,
    }
github softwareunderground / subsurface / subsurface / io / seismic.py View on Github external
Seismic: Seismic data object based on xarray.DataArray.
    """
    with segyio.open(filepath) as sf:
        sf.mmap()  # memory mapping
        xlines = sf.xlines
        ilines = sf.ilines
        samples = sf.samples
        header = sf.bin
    
    coords = [ 
        ("ilines", ilines), 
        ("xlines", xlines),
        ("samples", samples)
    ]

    cube = segyio.tools.cube(filepath)
    return Seismic(cube, coords=coords)