def test_segy_header_scan_all(temp_dir, temp_segy):
    _, scanned = segy_header_scan(temp_segy, max_traces_scan=0, silent=True)
    assert scanned == TEST_SEGY_SIZE**2
    _, scanned = segy_header_scan(temp_segy,
                                  max_traces_scan='all',
                                  silent=True)
    assert scanned == TEST_SEGY_SIZE**2
Beispiel #2
0
def test_segy_header_scan_all(temp_dir, temp_segy):
    _ = segy_header_scan(temp_segy, max_traces_scan=0, silent=True)
    scanned = _.nscan
    assert scanned == TEST_SEGY_SIZE**2
    _ = segy_header_scan(temp_segy, max_traces_scan="all", silent=True)
    scanned = _.nscan
    assert scanned == TEST_SEGY_SIZE**2
Beispiel #3
0
def test_segy_header_scan(temp_dir, temp_segy):
    head = segy_header_scan(temp_segy)
    scanned = head.nscan
    assert scanned == TEST_SEGY_SIZE ** 2
    # assert isinstance(head, dict) now a dataframe
    head = segy_header_scan(temp_segy, max_traces_scan=TEST_SEGY_SIZE, silent=True)
    scanned = head.nscan
    assert scanned == TEST_SEGY_SIZE
def test_segy_header_scan(temp_dir, temp_segy):
    head, scanned = segy_header_scan(temp_segy)
    assert scanned == TEST_SEGY_SIZE**2
    assert isinstance(head, dict)
    head, scanned = segy_header_scan(temp_segy,
                                     max_traces_scan=TEST_SEGY_SIZE,
                                     silent=True)
    assert scanned == TEST_SEGY_SIZE
    assert isinstance(head, dict)
Beispiel #5
0
def scan(max_traces, filename):
    input_file = pathlib.Path(filename)
    hscan = segy_header_scan(input_file, max_traces_scan=max_traces)
    click.echo(f"Traces scanned: {hscan.nscan}")
    import pandas as pd

    pd.set_option("display.max_rows", hscan.shape[0])
    click.echo(hscan[["byte_loc", "min", "max", "mean"]])
Beispiel #6
0
def scan(max_traces, filename):
    input_file = pathlib.Path(filename)
    hscan, nscan = segy_header_scan(input_file, max_traces_scan=max_traces)

    click.echo(f"Traces scanned: {nscan}")
    click.echo("{:>40s} {:>8s} {:>10s} {:>10s}".format("Item", "Byte Loc",
                                                       "Min", "Max"))
    for key, item in hscan.items():
        click.echo("{:>40s} {:>8d} {:>10.0f} {:>10.0f}".format(
            key, item[0], item[1], item[2]))
Beispiel #7
0
def main():

    # how to track down warnings
    #import warnings
    #warnings.filterwarnings('error', category=UnicodeWarning)
    #warnings.filterwarnings('error', category=DeprecationWarning, module='numpy')

    #parse args
    sys_parser = segysakArgsParser()
    args = sys_parser.parse_args()

    # gaffe
    print(f'SEGY-SAK - v{version}')

    # initialise logging
    LOGGER.info(f'segysak v{version}')

    # check inputs
    checked_files = check_file(args.files)

    # Generate or Load Configuration File

    for input_file in checked_files:
        print(input_file.name)
        # Print EBCIDC header
        if args.ebcidc:
            try:
                print(get_segy_texthead(input_file))
            except IOError:
                LOGGER.error(
                    "Input SEGY file was not found - check name and path")

        if args.scan > 0:
            hscan, nscan = segy_header_scan(input_file,
                                            max_traces_scan=args.scan)
            width = 10
            print(f'Traces scanned: {nscan}')
            print("{:>40s} {:>8s} {:>10s} {:>10s}".format(
                'Item', 'Byte Loc', 'Min', 'Max'))
            for key, item in hscan.items():
                print("{:>40s} {:>8d} {:>10.0f} {:>10.0f}".format(
                    key, item[0], item[1], item[2]))

        iline = args.iline
        xline = args.xline

        if args.netCDF is None or args.netCDF is not False:
            if args.netCDF is None:
                outfile = input_file.stem + '.SEISNC'
            else:
                outfile = args.netCDF
            _ = segy_loader(input_file,
                            ncfile=outfile,
                            iline=iline,
                            xline=xline,
                            ix_crop=args.crop)
            LOGGER.info(f"NetCDF output written to {outfile}")

        if args.SEGY is None or args.SEGY is not False:
            if args.SEGY is None:
                outfile = input_file.stem + '.segy'
            else:
                outfile = args.SEGY
            ncdf2segy(input_file, outfile, iline=iline,
                      xline=xline)  #, crop=args.crop)
            LOGGER.info(f"SEGY output written to {outfile}")
Beispiel #8
0
# %%
from segysak.segy import get_segy_texthead

get_segy_texthead(V3D_path)

# %% [markdown]
# If you need to investigate the trace header data more deeply, then *segy_header_scan* can be used to report
# basic statistic of each byte position for a limited number of traces.
#
# *segy_header_scan* returns a `pandas.DataFrame`. To see the full DataFrame use the `pandas` option_context manager.

# %%
from segysak.segy import segy_header_scan

scan = segy_header_scan(V3D_path)
scan

# %% [markdown]
# The header report can also be reduced by filtering blank byte locations. Here we use the standard deviation `std`
# to filter away blank values which can help us to understand the composition of the data.
#
# For instance, key values like **trace UTM coordinates** are located in bytes *73* for X & *77* for Y. We
# can also see the byte positions of the **local grid** for INLINE_3D in byte *189* and for CROSSLINE_3D in byte *193*.

# %%
scan[scan["std"] > 0]

# %% [markdown]
# To retreive the raw header content use `segy_header_scrape`. Setting `partial_scan=None` will return the
# full dataframe of trace header information.