Esempio n. 1
0
def las2rsf(lasf, rsff):
    las = LASReader(lasf)
    rsf = m8r.Output(rsff)
    data = las.data2d
    shape = data.shape
    rsf.put('n1', shape[1])
    rsf.put('n2', shape[0])
    rsf.put('o2', las.start)
    rsf.put('d2', las.step)
    rsf.put('null', las.null)
    k = 0
    for name in las.curves.names:
        k += 1
        key = 'key%d' % k
        rsf.put(key, name)
        item = las.curves.items[name]
        rsf.put(key + '_units', item.units)
        desc = ' '.join(item.descr.translate(None, '"').split()[1:])
        rsf.put(name, desc)
    for name in las.well.names:
        item = las.well.items[name]
        desc = item.data.translate(None, '"')
        rsf.put(name, desc)
    rsf.write(data)
    rsf.close()
Esempio n. 2
0
def las2rsf(lasf, rsff):
    las = LASReader(lasf)
    rsf = m8r.Output(rsff)
    data = las.data2d
    data = data.astype('float32')
    shape = data.shape
    rsf.put('n1', shape[1])
    rsf.put('n2', shape[0])
    rsf.put('o2', las.start)
    rsf.put('d2', las.step)
    rsf.put('null', las.null)
    k = 0
    for name in las.curves.names:
        k += 1
        key = 'key%d' % k
        rsf.put(key, name)
        item = las.curves.items[name]
        rsf.put(key + '_units', item.units)
        if sys.version_info[0] >= 3:
            desc = ' '.join(
                item.descr.translate(str.maketrans('', '', '"')).split()[1:])
        else:
            desc = ' '.join(item.descr.translate(None, '"').split()[1:])
        rsf.put(name, desc)
    for name in las.well.names:
        item = las.well.items[name]
        if sys.version_info[0] >= 3:
            desc = item.data.translate(str.maketrans('', '', '"'))
        else:
            desc = item.data.translate(None, '"')
        rsf.put(name, desc)
    rsf.write(data)
    rsf.close()
Esempio n. 3
0
    def _plot(self, well, fig, axes):                
        start = 0
        outwell= {}
        trackplace = [0,0,0,0,0,0]
        max_depth = 0
        global_max_depth = 0

        logs = LASReader(self.laspath, null_subs=np.nan)
        nc = logs.data2d.shape[1]-1
        for i, curve in enumerate(logs.curves.names[1:]):      
            global_max_depth = self._bar_plot(logs, axes, trackplace, i, curve, nc, start=start, max_depth=max_depth, global_max_depth=global_max_depth)
        
        for i, ax in enumerate(axes):
            axes[i].invert_yaxis()
            (ymax, ymin) = axes[i].get_ylim()
            axes[i].set_xlim((1,max(trackplace)+1))
            axes[i].set_ylim((global_max_depth,0))
            axes[i].get_xaxis().set_ticks([])
            axes[i].grid('on')
            axes[i].yaxis.set_visible(False)
        
            
        axes[0].set_ylabel('measured depth [m]')
        axes[0].get_yaxis().set_visible(True)
        self._track_names(axes)
Esempio n. 4
0
 def getLogData(self):
     fname = QFileDialog.getOpenFileName(self,
                                         'Open las File',
                                         os.getenv('HOME'),
                                         selectedFilter='*.las')
     strfname = str(fname)
     log_file = LASReader(strfname, null_subs=np.nan)
     self.log_df = pd.DataFrame(log_file.data2d,
                                columns=log_file.curves.names,
                                index=log_file.data['DEPTH'])
     # added for crosshairs
     self.startValue = log_file.start
     self.stopValue = log_file.stop
     self.stepValue = log_file.step
     # just to keep things clean
     del log_file
     # add the names of all the curves in the file (now DataFrame) to a list
     self.curvesList = list(self.log_df.columns.values)
     self.createDockWindows()
Esempio n. 5
0
 def test_test(self):
     las = LASReader('las_input/Lasfiles/Penobscot_B-41_LASOut_W4.las')
     self.assertEqual(las.curves.names[0], 'DEPTH')
     self.assertEqual(las.curves.names[3], 'DEPTH1')
Esempio n. 6
0
        # The data type is determined by the items from the '~Curves' section.
        dt = np.dtype([(name, float) for name in self.curves.names])
        if self.wrap:
            a = _read_wrapped_data(f, dt)
        else:
            a = np.loadtxt(f, dtype=dt)
        self.data = a

        if opened_here:
            f.close()


if __name__ == "__main__":
    import sys

    las = LASReader(sys.argv[1], null_subs=np.nan)
    print "wrap? ", las.wrap
    print "vers? ", las.vers
    print "null =", las.null
    print "start =", las.start
    print "stop  =", las.stop
    print "step  =", las.step
    print "Version ---"
    las.version.display()
    print "Well ---"
    las.well.display()
    print "Curves ---"
    las.curves.display()
    print "Parameters ---"
    las.parameters.display()
    print "Other ---"
Esempio n. 7
0
import numpy as np
from las import LASReader
from matplotlib.pyplot import plot, show
import matplotlib.pyplot as plt
import pywt
import math
# from scipy.signal import cwt
# from scipy.fftpack import fft

myLas = LASReader('las3.las', null_subs=np.nan)
# print(myLas.data)
# print(myLas.start, myLas.stop, myLas.step)

#print(myLas.well.PROV.data, myLas.well.UWI.data)
# plot(myLas.data['DEPT'], myLas.data['GR'])
# plt.ylim(111.5, 112.5)
# plt.xlim(0,100)
# plot(myLas.data['HVOLTA'])

sig = myLas.data['GR']

#========================================================
cleanedSig = [x for x in sig if math.isnan(x) != True]
plot(cleanedSig)
show()
#
# arr = pywt.wavedec(cleanedSig, 'db1', level=2)
#
# ca = arr[0]
# for i in range(1,7):
#    cd = arr[i]
Esempio n. 8
0
def generate_reflectivity():
    L30 = LASReader('./synth/L-30.las', null_subs=np.nan)

    print L30.curves.names

    print L30.curves.DEPTH.units

    # [7]
    z = f2m(L30.data['DEPTH'])  # convert feet to metres
    GR = L30.data['GRS']
    IL8 = L30.data['LL8']
    ILM = L30.data['ILM']
    ILD = L30.data['ILD']
    NPHISS = L30.data['NPHISS']
    NPHILS = L30.data['NPHILS']
    ILD = L30.data['ILD']
    DT = L30.data['DT'] * 3.28084  # convert usec/ft to usec/m
    RHOB = L30.data['RHOB'] * 1000  # convert to SI units

    # Deal with absence of logs in the shallow section
    #[8]
    print "KB elevation [m]: ", f2m(L30.well.KB.data)  # Kelly Bushing (ft)
    print "Seafloor elevation [m]: ", f2m(
        L30.well.GL.data)  # Depth to Sea Floor (ft)
    print "Top of sonic log [m]: ", f2m(
        L30.start)  # top of log (ft) (actually 1150 ft)

    repl_int = f2m(L30.start) - f2m(L30.well.KB.data) + f2m(L30.well.GL.data)
    water_vel = 1480
    print "replacement interval [m]: ", repl_int

    repl_vel = 1600  # m/s
    repl_time = 2 * repl_int / repl_vel
    print "two-way-replacement time: ", repl_time

    water_time = 2 * np.abs(f2m(L30.well.GL.data)) / water_vel
    print "seafloor bottom :", water_time

    log_start_time = water_time + repl_time
    print 'log_start_time:', log_start_time

    top_log_TVDss = f2m(L30.well.KB.data) - f2m(L30.well.GL.data)

    # Fix and edit the logs
    # [11] (now in median_filter)
    rho_sm = median_filter(RHOB)

    # In [14]:
    rho = despike(RHOB)

    # [16] filter sonic
    dt = despike(DT)

    # [18] Computing the time-to-depth relationship
    # The time-to-depth relationship is obtained by scaling the sonic log by the sample interval (6" or 0.1524 m) and by calling np.cumsum() on it.
    # two-way-time to depth relationship
    scaled_dt = 0.1524 * np.nan_to_num(dt) / 1e6

    tcum = 2 * np.cumsum(scaled_dt)
    tdr = tcum + log_start_time

    # [19] Compute acoustic impedance
    Z = (1e6 / dt) * rho

    # [20] Compute reflection coefficient series
    RC = (Z[1:] - Z[:-1]) / (Z[1:] + Z[:-1])

    z_size = z.size
    RC = np.resize(RC, z.size)
    #plot_logs('well_reflectivity', z, RC, RC, start_z, end_z, title='well reflectivity')

    #### I'm ignoring the side by side QC plots for now as they are not necessary. ####

    # [26] Converting logs to two-way-travel time

    t, Z_t = z2t(Z, tdr)

    RC_t = (Z_t[1:] - Z_t[:-1]) / (Z_t[1:] + Z_t[:-1])

    RC_t = np.nan_to_num(RC_t)

    RC_t = np.resize(RC_t, t.size)

    return t, RC_t
Esempio n. 9
0
import numpy as np
from las import LASReader
import matplotlib.pyplot as plt
from scipy.stats import skew

well = LASReader('Panuke_B-90.las', null_subs=0)  #np.nan)

DT = well.data['DT']
RHOB = well.data['RHOB']
GR = well.data['GR']
z = well.data['DEPTH']
dz = well.step

start = 1000
stop = 25000
n = (stop - start) / 1000
print n
GR = GR[start:stop]
z = z[start:stop]
ncols = 50


def moment1(GR, dz, moment=1, max_window=820, ncols=50):
    """
    GR is log
    dz is sample rate (m)
    max_window = 1640 (m)
    moment: is the nth order moment to calculate
    """
    w = max_window / dz  # integer with log base 2 max num windows
    print w