Demo entry 5852048

Python

   

Submitted by anonymous on Jul 19, 2016 at 23:15
Language: Python. Code size: 11.9 kB.

#!/bin/python


#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#
#           Lab 1: Archie's Law and Pickett Plots
#
#           Brandon Clayton
#           Donald Arthur
#
#
#
#
#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%5%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%




#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#
#.......................... Import Modules  ...............................

import numpy as np                  # Math package

import matplotlib.pyplot as plt     # Plotting package

import subprocess as sp             # Terminal command package

import matplotlib as mpl            # Matplot package

mpl.rcParams['font.size']=18        # Set default font size for graphs

#------------------------- End Import -----------------------------------
#
#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%




#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%5%%%%%%%%%%%%%%%%%%%%
#
#................... Read Data File In .....................................

sp.call(['clear'])                                  # Clear command window

#................. Given Data ...............................



fin = 'data.txt'                                    # File to be read in

dataIn = np.loadtxt(fin)                            # Read in file

print ('\n\n Data Read = \n %s \n\n') %dataIn       # Check data array


res = dataIn[:,0]                                   # Resistivity is first column 

por = dataIn[:,1]                                   # Porosity is second column

depth = dataIn[0:-1,2]                              # Depth is last column, skip last point

#----------------------------------------------------------------


#................. Bore Hole Data ..........................


fin2 = 'boreData.txt'                               # Borehole data file name

boreIn = np.loadtxt(fin2)                           # Read in file

print ('\n\n Bore Data = %s \n\n') %boreIn          # Check values read in 


temp = boreIn[:,0]                                  # Temperature is first column

cond = boreIn[:,1]                                  # Conductivity is second column

boreDepth = boreIn[:,2]                             # Depth is thrid column


cond = cond / 10                                    # Put in S/m from mS/cm

#----------------------------------------------------------


#-------------------------------- End Read Data File --------------------------
#
#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%5%%%




#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#
#............................ Equations .............................................


#............................. Constants .......................................

rhoWater = .018                 # Resistivity of water, given

mClean = 2.                     # Cementation factor, given

mClay = 1.7                     # Cementation factor for dirty sand, given

n = 2.                          # Saturation exponent, given


sat0 = np.array([.71,.5,.41,.35,.27,.22])   # Saturations given

rho0 = np.array([2.,4.,6.,8.,14.,20.])      # Corresponding resistivities to graph

rhoLin = np.c_[.01:100.:.5]                 # Array of values to plot

#--------------------------- End Constants -----------------------



#................................ For Clean Sandstone .................................

y1Clean = pow(rhoWater/rhoLin,1/mClean)                 # Porosity function given resistivity of water


xVert = np.array([1.,1.])                               # Creat vertical line to intersect
yVert = np.array([.01,1.1])

xHor = np.array([.01,100])                              # Create horizontal line to intersect
yHor = np.array([np.sqrt(rhoWater),np.sqrt(rhoWater)])

xInter = 1.                                             # Create point at intersection
yInter = np.sqrt(rhoWater)

y2Clean = pow(rhoWater*pow(sat0,-n)/rhoLin,1/mClean)    # Remaining functions for saturation at specific percents 

satClean = pow(rhoWater*pow(por,-mClean)/res,1/n)       # Find satruation given original data 

#------------------------- End Clean Sandstone ---------------------------------------------


#............................. Clay in Sandstone .........................................................

y1Clay = pow(rhoWater/rhoLin,1/mClay)                   # Porosity function given new cementation exponent

y2Clay = pow(rhoWater*pow(sat0,-n)/rhoLin,1/mClay)      # Remaining functions for satruation 

satClay = pow(rhoWater*pow(por,-mClay)/res,1/n)         # Find saturation with new exponent

xHorClay = np.array([.01,100])                          # Create horizontal line to intersect 
yHorClay = np.array([pow(rhoWater,1/mClay),pow(rhoWater,1/mClay)])

xInterClay = 1.                                         # Create point at intersection
yInterClay = pow(rhoWater,1/mClay)

#--------------------------- End Clay in Sandtone Equations --------------------------------------



#------------------------------- End Equations ----------------------------------------------------------
#
#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%






#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#
#.................................... Plots ..............................................................


#............ Log-Log Plot: Clean Sandstone ....................

fig1 = plt.figure(figsize=(20,10))


plt.plot(xVert,yVert,'--m')
plt.plot(xHor,yHor,'--m')
plt.plot(xInter,yInter,'xr',markersize=16,markeredgewidth=2,label=r'$1\Omega m$ with 100% Saturation')
plt.loglog(res,por,'ob',markersize=10)
plt.loglog(rhoLin,y1Clean,'k',linewidth=2,label=r'$S_w = 100\%%$')
for ii in range (0,len(sat0)):
    plt.loglog(rhoLin,y2Clean[:,ii],linewidth=2,
        label=r'$S_w = %3.0f \%%$'%(sat0[ii]*100))


plt.legend(loc='lower left',fontsize=22)

plt.xlim(.01,100)

plt.ylim(.01,1.1)

plt.xlabel(r'Resistivity $\Omega m$',fontsize=18)

plt.ylabel('Porosity (%)',fontsize=18)

plt.title(r'Porosity Vs. Resistivity-Clean Sandstone: $\phi =$'
          r'$\left( \frac{\rho_w S^{-n}}{\rho} \right) ^{\frac{1}{m}}$',fontsize=28,y=1.03)


fig1.savefig('loglogClean.eps',fmt='eps',dpi=1000)


#---------------------------- End Log-Log Graph: Clean Sandstone -----------------------------------------------------




#.................................. Plots with Depth: Resistivity and Porosity .....................................

fig2 = plt.figure(figsize=(20,10))



plt.subplot(121)
plt.plot(por[0:-1],depth,'-ob',linewidth=2,markersize=10)
plt.gca().invert_yaxis()
plt.xlabel('Porosity (%)',fontsize=18)
plt.ylabel('Depth (m)',fontsize=18)
plt.xlim(.05,.25)
plt.title('Depth Vs. Porosity',fontsize=20)




plt.subplot(122)
plt.plot(res[0:-1],depth,'-or',linewidth=2,markersize=10)
plt.gca().invert_yaxis()
plt.xlabel(r'Resistivity $(\Omega m)$',fontsize=18)
plt.ylabel('Depth (m)',fontsize=18)
plt.xlim(0,8.5)
plt.title('Depth Vs. Resistivity',fontsize=20)

plt.subplots_adjust(wspace=.8,top=.85)

plt.suptitle('Porosity and Resistivity with Depth',fontsize=28)

fig2.savefig('porRes.eps',fmt='eps',dpi=1000)

#-------------------------- End Plots with Depth: Clean Sandstone --------------------------------------------------



#................................... Log-Log Plot: Clay in Sandstone .............................................

fig3 = plt.figure(figsize=(20,10))


plt.plot(xVert,yVert,'--m')
plt.plot(xHorClay,yHorClay,'--m')
plt.plot(xInterClay,yInterClay,'xr',markersize=16,markeredgewidth=2,label=r'$1\Omega m$ with 100% Saturation')
plt.loglog(res,por,'ob',markersize=10)
plt.loglog(rhoLin,y1Clay,'k',linewidth=2,label=r'$S_w = 100\%%$')
for ii in range (0,len(sat0)):
    plt.loglog(rhoLin,y2Clay[:,ii],linewidth=2,
        label=r'$S_w = %3.0f \%%$'%(sat0[ii]*100))


plt.legend(loc='lower left',fontsize=22)

plt.xlim(.01,100)

plt.ylim(.01,1.1)

plt.xlabel(r'Resistivity $\Omega m$',fontsize=18)

plt.ylabel('Porosity (%)',fontsize=18)

plt.title(r'Porosity Vs. Resistivity-Clay in Sandstone: $\phi =$'
          r'$\left( \frac{\rho_w S^{-n}}{\rho} \right) ^{\frac{1}{m}}$',fontsize=28,y=1.03)

fig3.savefig('loglogClay.eps',fmt='eps',dpi=1000)


#------------------------------------ End First Log-Log Graph ------------------------------------------------------




#........................ Plots with Depth: Saturation Comparison ...........................................................

fig4 = plt.figure(figsize=(20,10))

plt.subplot(131)
plt.plot(satClean[0:-1],depth,'-og',linewidth=2,markersize=10)
plt.gca().invert_yaxis()
plt.xlabel('Saturation (%)',fontsize=18)
plt.ylabel('Depth (m)',fontsize=18)
plt.xlim(.25,.95)
plt.title('Cementation Factor m=2',fontsize=20)
plt.xlim(.2,1.)
start, end = plt.gca().get_xlim()
plt.gca().xaxis.set_ticks(np.arange(start, end+.2, .2))


plt.subplot(132)
plt.plot(satClay[0:-1],depth,'-o',color='darkorange',markersize=10,linewidth=2)
plt.gca().invert_yaxis()
plt.xlabel('Saturation (%)',fontsize=18)
plt.ylabel('Depth (m)',fontsize=18)
plt.xlim(.15,.75)
plt.title('Cementation Factor m=1.7',fontsize=20)
start,end = plt.gca().get_xlim()
plt.gca().xaxis.set_ticks(np.arange(start,end+.2,.2))



plt.subplot(133)
plt.plot(satClean[0:-1],depth,'-og',linewidth=2,markersize=10,label='m=2')
plt.plot(satClay[0:-1],depth,'-o',color='darkorange',markersize=10,linewidth=2,label='m=1.7')
plt.gca().invert_yaxis()
plt.xlabel('Saturation (%)',fontsize=18)
plt.ylabel('Depth (m)',fontsize=18)
plt.xlim(.1,1)
plt.title('m=2 Vs. m=1.7',fontsize=20)
start,end = plt.gca().get_xlim()
plt.gca().xaxis.set_ticks(np.arange(start,end+.2,.2))
plt.legend(fontsize=18)

plt.subplots_adjust(wspace=.5,top=.85)

plt.suptitle('Saturation Comparison',fontsize=28)

fig4.savefig('satComp.eps',fmt='eps',dpi=1000)

#----------------------------- End Plots with Depth ---------------------------------------------------------------------------



#.................... Bore Hole Data Plot .....................................


fig5 = plt.figure(figsize=(20,10))

plt.subplot(1,3,1)
plt.plot(cond,boreDepth,'-ob',linewidth=2)
plt.gca().invert_yaxis()
plt.xlabel(r'Conductivity $\left(\frac{S}{m} \right)$',fontsize=18)
plt.ylabel('Depth (m)',fontsize=18)
start,end = plt.gca().get_xlim()
plt.gca().xaxis.set_ticks(np.arange(start-2,end+5,5))
plt.title('Conductivity',fontsize=22)


plt.subplot(1,3,2)
plt.plot(1/cond,boreDepth,'-ob',linewidth=2)
plt.gca().invert_yaxis()
plt.xlabel(r'Resistivity $(\Omega m)$',fontsize=18)
plt.ylabel('Depth (m)',fontsize=18)
start,end = plt.gca().get_xlim()
plt.gca().xaxis.set_ticks(np.arange(start,end+.0008,.0008))
plt.title('Resistivity',fontsize=22)



plt.subplot(1,3,3)
plt.plot(temp,boreDepth,'-or',linewidth=2)
plt.gca().invert_yaxis()
plt.xlabel(r'Temperature $(^{\circ}c)$',fontsize=18)
plt.ylabel('Depth (m)',fontsize=18)
plt.title('Temperature',fontsize=22)
start,end = plt.gca().get_xlim()
plt.gca().xaxis.set_ticks(np.arange(start,end+1,1))

plt.suptitle('Borehole Data',fontsize=28,y=.99)

plt.subplots_adjust(wspace=.4)

fig5.savefig('borehole.eps',fmt='eps',dpi=1000)

#--------------- End Borehole Plot --------------------------------------------------


#----------------------------------------- End Plots -----------------------------------------------------------------
#
#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%



#######################----------------- END ------------------------#############################################

This snippet took 0.01 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).