Dipping Layer for MLMC

Setup for simple dipping layer model as an input for MLMC


In [1]:
from matplotlib import rc_params

In [2]:
from IPython.core.display import HTML
css_file = 'pynoddy.css'
# HTML(open(css_file, "r").read())

In [3]:
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
repo_path = os.path.realpath('../..')
import pynoddy.history
reload(pynoddy.history)


Out[3]:
<module 'pynoddy.history' from '/Users/flow/git/pynoddy/pynoddy/history.pyc'>

In [4]:
%matplotlib inline

In [5]:
rcParams.update({'font.size': 20})

Swap to working directory


In [ ]:
os.chdir(r'/Users/flow/git/mlmc/case_studies/dipping_layer')

Defining a stratigraphy

We start with the definition of a (base) stratigraphy for the model.


In [20]:
reload(pynoddy.history)
# Combined: model generation and output vis to test:
history = "simple_model.his"
output_name = "simple_out"
#
# A general note: the 'reload' statements are only important
# for development purposes (when modules were chnaged), but not
# in required for normal execution.
#
reload(pynoddy.history)
reload(pynoddy.events)

# create pynoddy object
nm = pynoddy.history.NoddyHistory()
# add stratigraphy
strati_options = {'num_layers' : 2,
                  'layer_names' : ['layer 1', 'layer 2'], 
                  'layer_thickness' : [1500, 1500]}
nm.add_event('stratigraphy', strati_options )

nm.write_history(history)

In [21]:
# Compute the model
reload(pynoddy)
pynoddy.compute_model(history, output_name)


Out[21]:
''

In [22]:
# Plot output
import pynoddy.output
reload(pynoddy.output)
nout = pynoddy.output.NoddyOutput(output_name)
nout.plot_section('y', layer_labels = strati_options['layer_names'][::-1], 
                  colorbar = True, title="",
                  savefig = False, fig_filename = "ex01_strati.eps")


Add tilt event


In [41]:
# create pynoddy object
nm = pynoddy.history.NoddyHistory()
# add stratigraphy
strati_options = {'num_layers' : 2,
                  'layer_names' : ['layer 1', 'layer 2'], 
                  'layer_thickness' : [1500, 1500]}
nm.add_event('stratigraphy', strati_options )

tilt_options = {'name' : 'Tilt',
                'pos' : (6000, 0, 5000),
                'rotation' : 10,
               'plunge_direction' : 0,
               'plunge' : 20}

nm.add_event('tilt', tilt_options)
nm.events
nm.write_history(history)
# Compute the model
pynoddy.compute_model(history, output_name)


Out[41]:
''

In [42]:
# Plot output
reload(pynoddy.output)
nout = pynoddy.output.NoddyOutput(output_name)
nout.plot_section('y', layer_labels = strati_options['layer_names'][::-1], 
                  colorbar = True, title = "",
                  savefig = False, fig_filename = "ex01_fault_E.eps")


Calculate gravity field for tilted model

Compute now the gravity field


In [43]:
!pwd


/Users/flow/git/pynoddy/docs/notebooks

In [ ]:


In [ ]:

Add a fault event

As a next step, let's now add the faults to the model.


In [10]:
# The following options define the fault geometry:
fault_options = {'name' : 'Fault_E',
                 'pos' : (6000, 0, 5000),
                 'dip_dir' : 270,
                 'dip' : 60,
                 'slip' : 1000}

nm.add_event('fault', fault_options)

In [11]:
nm.events


Out[11]:
{1: <pynoddy.events.Stratigraphy at 0x107838fd0>,
 2: <pynoddy.events.Fault at 0x10782c310>}

In [12]:
nm.write_history(history)

In [13]:
# Compute the model
pynoddy.compute_model(history, output_name)


Out[13]:
''

In [14]:
# Plot output
reload(pynoddy.output)
nout = pynoddy.output.NoddyOutput(output_name)
nout.plot_section('y', layer_labels = strati_options['layer_names'][::-1], 
                  colorbar = True, title = "",
                  savefig = False, fig_filename = "ex01_fault_E.eps")



In [15]:
# The following options define the fault geometry:
fault_options = {'name' : 'Fault_1',
                 'pos' : (5500, 3500, 0),
                 'dip_dir' : 270,
                 'dip' : 60,
                 'slip' : 1000}

nm.add_event('fault', fault_options)

In [16]:
nm.write_history(history)

In [17]:
# Compute the model
pynoddy.compute_model(history, output_name)


Out[17]:
''

In [18]:
# Plot output
reload(pynoddy.output)
nout = pynoddy.output.NoddyOutput(output_name)
nout.plot_section('y', layer_labels = strati_options['layer_names'][::-1], colorbar = True)



In [19]:
nm1 = pynoddy.history.NoddyHistory(history)


---------------------------------------------------------------------------
IndexError                                Traceback (most recent call last)
<ipython-input-19-785a8a3b01af> in <module>()
----> 1 nm1 = pynoddy.history.NoddyHistory(history)

/Users/flow/git/pynoddy/pynoddy/history.pyc in __init__(self, history, **kwds)
     45             # load existing history
     46             self.load_history(history)
---> 47             self.determine_events(verbose=vb)
     48 
     49     def __repr__(self):

/Users/flow/git/pynoddy/pynoddy/history.pyc in determine_events(self, **kwds)
    357             elif 'STRATIGRAPHY' in e['type']:
    358                 # event_lines = event_lines[:-1]
--> 359                 ev = events.Stratigraphy(lines=event_lines)
    360             elif 'TILT' in e['type']:  # AK
    361                 ev = events.Tilt(lines=event_lines)

/Users/flow/git/pynoddy/pynoddy/events.pyc in __init__(self, **kwds)
     83         # iterate through lines and determine attributes
     84         if "lines" in kwds:
---> 85             self.parse_event_lines(kwds['lines'])
     86             self.event_type = self.event_lines[0].split("=")[1].strip()
     87 

/Users/flow/git/pynoddy/pynoddy/events.pyc in parse_event_lines(self, lines)
    127         #         self.property_lines[l[0].strip()] = i
    128 
--> 129         self.name = self.event_lines[-1].split("=")[1].strip()
    130 
    131     def update_properties(self, **kwds):

IndexError: list index out of range

In [ ]:
nm1.get_extent()

Complete Model Set-up

And here now, combining all the previous steps, the entire model set-up with base stratigraphy and two faults:


In [35]:
reload(pynoddy.history)
reload(pynoddy.events)
nm = pynoddy.history.NoddyHistory()
# add stratigraphy
strati_options = {'num_layers' : 8,
                  'layer_names' : ['layer 1', 'layer 2', 'layer 3',
                                   'layer 4', 'layer 5', 'layer 6', 
                                   'layer 7', 'layer 8'],
                  'layer_thickness' : [1500, 500, 500, 500, 500, 
                                       500, 500, 500]}
nm.add_event('stratigraphy', strati_options )

# The following options define the fault geometry:
fault_options = {'name' : 'Fault_W',
                 'pos' : (4000, 3500, 5000),
                 'dip_dir' : 90,
                 'dip' : 60,
                 'slip' : 1000}

nm.add_event('fault', fault_options)
# The following options define the fault geometry:
fault_options = {'name' : 'Fault_E',
                 'pos' : (6000, 3500, 5000),
                 'dip_dir' : 270,
                 'dip' : 60,
                 'slip' : 1000}

nm.add_event('fault', fault_options)
nm.write_history(history)

In [22]:
# Change cube size
nm1 = pynoddy.history.NoddyHistory(history)
nm1.change_cube_size(50)
nm1.write_history(history)

In [23]:
# Compute the model
pynoddy.compute_model(history, output_name)


Out[23]:
''

In [24]:
# Plot output
reload(pynoddy.output)
nout = pynoddy.output.NoddyOutput(output_name)
nout.plot_section('y', layer_labels = strati_options['layer_names'][::-1], 
                  colorbar = True, title="",
                  savefig = True, fig_filename = "ex01_faults_combined.eps",
                  cmap = 'YlOrRd') # note: YlOrRd colourmap should be suitable for colorblindness!