Skip to content

Instantly share code, notes, and snippets.

View kwinkunks's full-sized avatar
🐍
Writing bugs

Matt Hall kwinkunks

🐍
Writing bugs
View GitHub Profile
@kwinkunks
kwinkunks / segy2tiff.csh
Created March 19, 2021 13:56
Old-school conversion of SEG-Y to TIFF (requires segy2ascii and pnmtotiff)
#!/bin/csh
# ++++++++++++++++++++++
# segy2ascii
# Matt Hall, October 2009
# Converts SEGY file to a TIFF, one sample per pixel
# First, export a SEGY file from Poststack, putting Trace in byte 13
# Note the name of the project and the name of the file
# Run this file and follow the instructions
# ++++++++++++++++++++++
#
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@kwinkunks
kwinkunks / check_seg2.py
Last active March 24, 2021 19:28
Read a SEG2 formatted seismic or GPR file.
"""
Run as a script:
python test_check.py /path/to/myfile.seg2
Adapted from https://github.com/agile-geoscience/jeepr
"""
from struct import unpack
import sys
@kwinkunks
kwinkunks / read_from_web.py
Last active October 25, 2021 17:37
Read a file from the Internet to give to an arbitrary function
import re
import urllib
from io import BytesIO
# If the fname you gave me looks like a URL...
if re.match(r'https?://.+\..+/.+?', fname) is not None:
try:
data = urllib.request.urlopen(fname).read()
except urllib.error.HTTPError as e:
@kwinkunks
kwinkunks / spwla.py
Last active June 15, 2021 19:41
Reads special core analysis and core description from SPWLA formatted files.
#!/usr/bin/env python
"""
Reads special core analysis and core description from SPWLA formatted files.
Usage:
./spwla.py infile.spwla outfile.csv
Author:
Matt Hall, ca. 2021
© agilescientific.com
@kwinkunks
kwinkunks / README.md
Last active April 28, 2021 17:18
Convert SEG-Y into WAV files

You'll need to install Python somehow before using this script.

I recommend installing Miniconda

Then do this in the terminal (or Anaconda prompt on Windows):

conda create -n segy2wav python=3.8 scipy
conda activate segy2wav
pip install click segyio

python segy2wav.py --help

@kwinkunks
kwinkunks / Image-based_modeling_with_PSF.ipynb
Created September 8, 2021 17:18
Forward model seismic data by convolution of a reflectivity series with a point-spread function
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@kwinkunks
kwinkunks / Spectral_decomposition.ipynb
Created September 24, 2021 18:03
Spectral decomposition
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@kwinkunks
kwinkunks / minimum_phase.py
Created September 24, 2021 20:39
A minimum phase wavelet
from scipy.signal import remez, minimum_phase
import matplotlib.pyplot as plt
# Based on this example from the scipy docs:
# https://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.minimum_phase.html
freq = [0, 0.2, 0.3, 1.0]
desired = [1, 0]
h_linear = remez(151, freq, desired, Hz=2.0)
h_min_hil = minimum_phase(h_linear, method='hilbert')
@kwinkunks
kwinkunks / Striplog_from_DataFrame.ipynb
Created September 27, 2021 14:08
Making a striplog from a DataFrame
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.