In [1]:
# load some modules
import pandas as pd
import numpy as np
from pygslib.drillhole import * # here we are importing all the classes and functions in pygslib.drillhole
import matplotlib.pylab as plt
%matplotlib inline
In [2]:
# create artificial "know data" to desurvey
DEG2RAD=3.141592654/180.0
azm= np.linspace(0.0,359.0,360)
dip= np.linspace(90,0,360)
#make sure BHID is string, XCOLLAR is float...
collar=pd.DataFrame({'BHID': ['1'],'XCOLLAR':[0.], 'YCOLLAR': [0.], 'ZCOLLAR':[0.]})
assay = pd.DataFrame({'BHID': np.ones([360], dtype = str),
'FROM':np.linspace(0,359,360),
'TO': np.linspace(1,360,360),
'R_AZM':azm,
'R_DIP':dip})
#assuming each 1m interval straight we calculate x,y,z
assay['xb_real']=np.zeros([360], dtype = float)
assay['yb_real']=np.zeros([360], dtype = float)
assay['zb_real']=np.zeros([360], dtype = float)
DEG2RAD=3.141592654/180.0
for i in range(1,360):
x,y,z = ang2cart( assay['R_AZM'][i-1], assay['R_DIP'][i-1]) # this is for one unit length interval
assay.loc[i, 'xb_real']= assay['xb_real'][i-1] + x
assay.loc[i,'yb_real']= assay['yb_real'][i-1] + y
assay.loc[i,'zb_real']= assay['zb_real'][i-1] + z
# create survey every 50m
survey = pd.DataFrame({'BHID': assay['BHID'][::50],
'AT': assay['FROM'][::50],
'AZ': assay['R_AZM'][::50],
'DIP': assay['R_DIP'][::50]})
#print values
print (collar)
print (assay.head())
print (survey)
#plot drillhole
plt.plot (assay['xb_real'],assay['yb_real'], label= 'reference data')
plt.xlabel('xb_real')
plt.ylabel('yb_real')
plt.legend(loc=2)
plt.show()
plt.plot (assay['xb_real'],assay['zb_real'], label= 'reference data')
plt.xlabel('xb_real')
plt.ylabel('zb_real')
plt.legend(loc=2)
plt.show()
In [3]:
# creating a working Drillhole database.
mydholedb=Drillhole(collar=collar,survey=survey)
In [4]:
# add assay table
mydholedb.addtable(assay, 'assay' ,overwrite = False)
In [5]:
mydholedb.validate()
In [6]:
mydholedb.validate_table('assay')
In [7]:
mydholedb.desurvey('assay', endpoints=True)
mydholedb.table['assay'].head()
Out[7]:
In [8]:
# this is the euclidean distance between real and estimate at xbig, ybig, zbig
mydholedb.table['assay']['err']=np.sqrt(((mydholedb.table['assay']['xb_real']-mydholedb.table['assay']['xb'])**2 + \
(mydholedb.table['assay']['yb_real']-mydholedb.table['assay']['yb'])**2 + \
(mydholedb.table['assay']['zb_real']-mydholedb.table['assay']['zb'])**2))
plt.plot(mydholedb.table['assay']['FROM'],mydholedb.table['assay']['err'])
mydholedb.survey
Out[8]:
In [9]:
#plot drillhole
plt.plot (mydholedb.table['assay']['xb_real'],mydholedb.table['assay']['yb_real'], label= 'reference data')
plt.plot (mydholedb.table['assay']['xm'],mydholedb.table['assay']['ym'], label= 'desurveyed data')
plt.xlabel('xb')
plt.ylabel('yb')
plt.legend(loc=2)
plt.show()
plt.plot (mydholedb.table['assay']['xb_real'],mydholedb.table['assay']['zb_real'], label= 'reference data')
plt.plot (mydholedb.table['assay']['xm'],mydholedb.table['assay']['zm'], label= 'desurveyed data')
plt.xlabel('xb')
plt.ylabel('zb')
plt.legend(loc=2)
plt.show()
In [10]:
mydholedb.table['assay']['len']=np.sqrt(((mydholedb.table['assay']['xb']-mydholedb.table['assay']['xe'])**2 + \
(mydholedb.table['assay']['yb']-mydholedb.table['assay']['ye'])**2 + \
(mydholedb.table['assay']['zb']-mydholedb.table['assay']['ze'])**2))
mydholedb.table['assay']['len2']= mydholedb.table['assay']['TO'] - mydholedb.table['assay']['FROM']
print ('desurveyed legth: ', mydholedb.table['assay']['len'].sum())
print ('interval legth : ', mydholedb.table['assay']['len2'].sum())
In [12]:
print ('desurveyed legth: ')
mydholedb.table['assay']['len']
Out[12]:
In [ ]: