In [128]:
import sys, os
import matplotlib.pyplot as plt
# adjust some settings for matplotlib
from matplotlib import rcParams
# print rcParams
rcParams['font.size'] = 15
# determine path of repository to set paths corretly below
os.chdir(r'/Users/Florian/git/pynoddy/docs/notebooks/')# some basic module imports
repo_path = os.path.realpath('../..')
import pynoddy
In [129]:
reload(pynoddy.history)
reload(pynoddy.events)
reload(pynoddy.output)
# Change to sandbox directory to store results
os.chdir(os.path.join(repo_path, 'sandbox'))
# Path to exmaple directory in this repository
example_directory = os.path.join(repo_path,'examples')
# Compute noddy model for history file
history = 'simple_two_faults.his'
history_ori = os.path.join(example_directory, history)
output_name = 'noddy_out'
H1 = pynoddy.history.NoddyHistory(history_ori)
# Before we do anything else, let's actually define the cube size here to
# adjust the resolution for all subsequent examples
H1.change_cube_size(100)
# compute model - note: not strictly required, here just to ensure changed cube size
H1.write_history(history)
pynoddy.compute_model(history, output_name)
his_full_3d = pynoddy.history.NoddyHistory(history)
block_full_3d = pynoddy.output.NoddyOutput(output_name)
# now create the slice history with the same cube size
H1 = pynoddy.history.NoddyHistory(os.path.join(example_directory,
"simple_two_faults_slice.his"))
H1.change_cube_size(100)
# compute model - note: not strictly required, here just to ensure changed cube size
H1.write_history(history)
pynoddy.compute_model(history, output_name)
his_2d_slice = pynoddy.history.NoddyHistory(history)
block_2d_slice = pynoddy.output.NoddyOutput(output_name)
In [130]:
block_full_3d.nx, block_full_3d.ny, block_full_3d.nz
Out[130]:
In [131]:
block_2d_slice.nx, block_2d_slice.ny, block_2d_slice.nz
Out[131]:
In [132]:
block_full_3d.plot_section('x', position=20)
In [135]:
block_2d_slice.plot_section('y', position=0)
In [136]:
block_2d_slice.block = np.array(block_2d_slice.block)
In [137]:
block_2d_slice.export_to_vtk(vtk_filename = "slice_model")
In [28]:
block_full_3d.export_to_vtk()
In [5]:
reload(pynoddy.history)
# Change to sandbox directory to store results
os.chdir(os.path.join(repo_path, 'sandbox'))
# Path to exmaple directory in this repository
example_directory = os.path.join(repo_path,'examples')
In [123]:
noddy_his = os.path.join(example_directory, "slightly_complicated.his")
noddy_out = 'slightly_complicated_out'
# recompute model
pynoddy.compute_model(noddy_his, noddy_out)
In [124]:
f = open(noddy_out + ".g12").readlines()
In [125]:
len(f[0].strip().split("\t"))
Out[125]:
In [126]:
# Now open output file
reload(pynoddy.output)
no = pynoddy.output.NoddyOutput(noddy_out)
print no.block.shape
imshow(no.block[10,:,:], interpolation = 'nearest')
no.export_to_vtk(vtk_filename = noddy_out)
In [127]:
no.plot_section('x')
no.plot_section('y')
no.plot_section('z')
In [114]:
im = imshow(no.block[40,:,:], interpolation='nearest')
In [91]:
nh = pynoddy.history.NoddyHistory(noddy_his)
In [94]:
nh.events[1].__dict__
Out[94]:
In [16]:
?? np.loadtxt
Void ratio as degree of compactness
In [1]:
def e(n): return n/(1-n)
In [2]:
e(0.5)
Out[2]:
In [8]:
ns = np.linspace(0.01,0.8)
In [18]:
plt.plot(ns, e(ns))
plt.title('Void ratio as degree of compactness')
plt.xlabel('Eulerian porosity')
plt.ylabel('Void ratio')
plt.axvline(0.5, color = 'k', linestyle = ':')
plt.axhline(1.0, color = 'k', linestyle = ':')
Out[18]:
In [ ]: