In [1]:
import pandas as pd
import numpy as np
import matplotlib.pyplot as pl
import utils
%matplotlib inline
In [9]:
geo = pd.read_csv('Complete_Geophysics.csv')
lith = pd.read_csv('corrected_lithology.csv')
In [4]:
hole = geo.query('HOLEID == "DD0509"')
In [6]:
subset = hole[['DENB','DENL','GRDE', 'LSDU', 'DEPTH']].sort('DEPTH')
In [7]:
subset.plot(x='DEPTH',y=['DENB','DENL','GRDE','LSDU'],figsize=(50,50))
Out[7]:
In [6]:
boreid = 'DD0541'
[utils.get_label(boreid, d) for d in range(100)]
Out[6]:
In [68]:
# Drafting the function for getting the window.
#def get_windows(bore_id, centre_point, window_size, bin_width):
atv = pd.read_excel('Acoustic Scanner/ATV_Data_{}.xlsx'.format(bore_id))
In [181]:
df = geo.query('HOLEID == @boreid').sort('DEPTH')
centre_point = 280
window_size = 1
column = 'DENB'
bin_width = 0.1
def calc_bin_per_column(df, column, centre_point, window_size, bin_width):
bottom = centre_point - window_size/2.
top = centre_point + window_size/2.
inner_window_size = abs(bottom-top)/bin_width
data = df[[column, 'DEPTH']].query('DEPTH > @bottom and DEPTH <= @top').sort('DEPTH')
ret = pd.rolling_mean(data[column], inner_window_size, min_periods=0)
return ret.values[::inner_window_size]
In [127]:
inner_window_size
Out[127]:
In [3]:
utils.get_windows?
In [35]:
import imp
imp.reload(utils)
Out[35]:
In [15]:
utils.get_windows(boreid, centre_point=280, window_size=1, bin_width=0.1)
Out[15]:
In [17]:
utils.get_label(boreid, depth=280)
Out[17]:
In [18]:
import json
In [19]:
with open('processed/DD1097.json') as fp:
dat = json.load(fp)
In [20]:
dat
Out[20]:
In [21]:
seam = dat['Seam Structure']
In [33]:
js = []
js.append({'top': 0, 'bot': seam[0][0], 'type':'Not Coal'})
for i, item in enumerate(seam):
js.append({'top':item[0], 'bot':item[1], 'type':'Coal'})
if i < len(seam)-1:
item[1]
seam[i+1]
js.append({'top':item[1], 'bot':seam[i+1][0], 'type':'Not Coal'})
with open('output.json','w') as fp:
json.dump(js, fp)
In [34]:
Out[34]:
In [ ]: