Esempio n. 1
0
def test_masked_marching_cubes():
    cwd = os.path.dirname(__file__)
    data_path = cwd + '/../../../examples/'
    geo_model = gp.load_model(
        r'Tutorial_ch1-8_Onlap_relations',
        path=data_path + 'data/gempy_models/Tutorial_ch1-8_Onlap_relations',
        recompile=True)

    geo_model.set_regular_grid([-200, 1000, -500, 500, -1000, 0], [50, 50, 50])
    # geo_model.set_topography(d_z=np.array([-600, -100]))

    s = gp.compute_model(geo_model, compute_mesh=True, debug=False)

    gp.plot.plot_2d(geo_model, cell_number=2)

    gp.plot_2d(geo_model,
               cell_number=[2],
               regular_grid=geo_model.solutions.mask_matrix_pad[0],
               show_data=True,
               kwargs_regular_grid={
                   'cmap': 'gray',
                   'norm': None
               })

    gp.plot_2d(geo_model,
               cell_number=[2],
               regular_grid=geo_model.solutions.mask_matrix_pad[1],
               show_data=True,
               kwargs_regular_grid={
                   'cmap': 'gray',
                   'norm': None
               })

    gp.plot_2d(geo_model,
               cell_number=[2],
               regular_grid=geo_model.solutions.mask_matrix_pad[2],
               show_data=True,
               kwargs_regular_grid={
                   'cmap': 'gray',
                   'norm': None
               })

    gp.plot_2d(geo_model,
               cell_number=[2],
               regular_grid=geo_model.solutions.mask_matrix_pad[3],
               show_data=True,
               kwargs_regular_grid={
                   'cmap': 'gray',
                   'norm': None
               })

    p3d = gp.plot_3d(geo_model,
                     show_surfaces=True,
                     show_data=True,
                     image=True,
                     kwargs_plot_structured_grid={'opacity': .2})
Esempio n. 2
0
    def test_gempy_to_rex_with_topo(self):
        model_file = pooch.retrieve(
            url=
            "https://github.com/cgre-aachen/gempy_data/raw/master/data/gempy_models/combination.zip",
            known_hash=None)

        geo_model = gempy.load_model(name='combination', path=model_file)
        gempy_to_rex = GemPyToRex()
        bytes = gempy_to_rex(geo_model)
        print(bytes)
Esempio n. 3
0
def test_gempy_th_op_set_grav():
    path_dir = os.getcwd(
    ) + '/../../examples/tutorials/ch5_probabilistic_modeling'
    geo_model = gp.load_model(r'2-layers', path=path_dir, recompile=False)
    gp.set_interpolator(geo_model, output='grav')

    gto = GemPyThOp(geo_model)
    th_op_grav = gto.set_th_op('gravity')
    i = geo_model.interpolator.get_python_input_block()
    th_f = theano.function([], th_op_grav(*i), on_unused_input='warn')
Esempio n. 4
0
def test_load_model(recompute=False):
    """Load model from disk"""
    cwd = os.path.dirname(__file__)
    data_path = cwd + '/../../examples/'

    if recompute:
        geo_model = gp.load_model(r'Tutorial_ch1-8_Onlap_relations',
                                  path=data_path +
                                  'data/gempy_models/Tutorial_ch1'
                                  '-8_Onlap_relations',
                                  recompile=True)
        gp.compute_model(geo_model)
        gp.plot_3d(geo_model, image=True)

    else:
        geo_model = gp.load_model(r'Tutorial_ch1-8_Onlap_relations',
                                  path=data_path +
                                  'data/gempy_models/Tutorial_ch1'
                                  '-8_Onlap_relations',
                                  recompile=False)
Esempio n. 5
0
def test_load_model_compressed_remote2():
    model_file = pooch.retrieve(
        url="https://github.com/cgre-aachen/gempy_data/raw/master/"
        "data/gempy_models/Onlap_relations.zip",
        known_hash=None)

    geo_model = gp.load_model(name='Onlap_relations',
                              path=model_file,
                              recompile=True)
    gp.compute_model(geo_model)
    gp.plot_3d(geo_model, image=True)
Esempio n. 6
0
# %%
# Model definition
# ----------------
#

# %%
# This is to make it work in sphinx gallery
cwd = os.getcwd()
if not 'examples' in cwd:
    path_dir = os.getcwd() + '/examples/tutorials/ch5_probabilistic_modeling'
else:
    path_dir = cwd

# %%
geo_model = gp.load_model(r'/2-layers', path=path_dir, recompile=True)

# %%
geo_model.modify_surface_points(2, Z=1000)
gp.compute_model(geo_model)

# %%


def plot_geo_setting_well():
    device_loc = np.array([[6e3, 0, 3700]])
    p2d = gp.plot_2d(geo_model, show_topography=True, legend=False)

    well_1 = 3.41e3
    well_2 = 3.6e3
    p2d.axes[0].scatter([3e3], [well_1],
Esempio n. 7
0
import numpy as np
import pandas as pd
import os
import matplotlib.pyplot as plt

np.random.seed(1515)
pd.set_option('precision', 2)

# %%
cwd = os.getcwd()
if 'examples' not in cwd:
    data_path = os.getcwd() + '/examples/'
else:
    data_path = cwd + '/../../'

geo_model = gp.load_model('Greenstone', path=data_path + 'data/gempy_models')

# %%
geo_model.stack

# %%
geo_model.surfaces

# %%
gp.plot_2d(geo_model)

# %%

# %%
# Creating grid
# ~~~~~~~~~~~~~
Esempio n. 8
0
# %%
# We import a model from an existing folder, representing a subduction
# zone with onlap relationships. The theano function is automatically
# recombined to allow changes.
#

# %%
cwd = os.getcwd()
if not 'examples' in cwd:
    data_path = os.getcwd() + '/examples/'
else:
    data_path = cwd + '/../../'

geo_model = gp.load_model(r'Tutorial_ch1-8_Onlap_relations',
                          path=data_path +
                          'data/gempy_models/Tutorial_ch1-8_Onlap_relations',
                          recompile=True)

geo_model.meta.project_name = "Onlap_relations"

# %%
gp.plot_2d(geo_model)

# %%
geo_model.set_regular_grid([-200, 1000, -500, 500, -1000, 0], [50, 50, 50])
geo_model.set_topography(d_z=np.array([-600, -100]))

# %%
s = gp.compute_model(geo_model, compute_mesh=True, debug=False)

# %%
Esempio n. 9
0
def test_load_model():
    model = gp.load_model(os.pardir + "/input_data/test_solution.pickle")
    return model
# temperature estimates from boreholes, of ± 3 to 5 K, even when measured after a long enough time [1].
# For logging devices, temperature logs can have effective accuracies between ± 0.25 and 0.5 °C [2]. In addition to the device specific
# accuracies, errors can be introduced by the measurement procedure itself, e.g. by the logging speed [3].

#%%
# Model preparation
# -----------------
# To see, where our data points are situated, we load the model topography and plot the position of gravity stations and temperature boreholes:

# import DTM
dtm = np.load('../../models/Graben_base_model_topography.npy')

# load base model
model_path = '../../models/2021-06-04_POC_base_model/'

geo_model = gp.load_model('POC_PCT_model', path=model_path, recompile=False)

# get delx and dely of the model, so cell sizes
delx = geo_model._grid.regular_grid.dx
dely = geo_model._grid.regular_grid.dy
delz = geo_model._grid.regular_grid.dz

# import gravity data and borehole locations
g_data = pd.read_csv('../../models/2021-06-16_grav_of_POC_base_model.csv')
bhole = np.array([[31, 14], [78, 22], [53, 34], [49, 44]])

# plot the map
fig = plt.figure(figsize=[15, 7])
cs = plt.contourf(dtm[:, :, 0],
                  dtm[:, :, 1],
                  dtm[:, :, 2],
Esempio n. 11
0
np.random.seed(1515)
pd.set_option('precision', 2)

# %%
# We import a model from an existing folder.
# 

# %%
cwd = os.getcwd()
if 'examples' not in cwd:
    data_path = os.getcwd() + '/examples/'
else:
    data_path = cwd + '/../../'

geo_model = gp.load_model(r'Tutorial_ch1-9a_Fault_relations',
                          path=data_path + 'data/gempy_models/Tutorial_ch1-9a_Fault_relations',
                          recompile=True)


# %% 
geo_model.faults.faults_relations_df

# %% 
geo_model.faults

# %% 
geo_model.surfaces

# %% 
gp.compute_model(geo_model, compute_mesh=False)
Esempio n. 12
0
def test_load_model_compressed_remote_fail():
    with pytest.raises(Exception):
        model_file = pooch.retrieve(url="https://nowhere.zip", known_hash=None)

        geo_model = gp.load_model(name='error', path=model_file)
Esempio n. 13
0
def test_load_model_compressed():
    geo_model = gp.load_model(name="one_fault_model")
Esempio n. 14
0
def test_load_model():
    cwd = os.path.dirname(__file__)
    data_path = cwd + '/../../examples/'
    geo_model = gp.load_model(r'Tutorial_ch1-8_Onlap_relations',
                              path=data_path + 'data/gempy_models',
                              recompile=False)
Esempio n. 15
0
def test_load_model_compressed_remote():
    model_file = pooch.retrieve(url="https://github.com/cgre-aachen/gempy_data/raw/master/"
                                    "data/gempy_models/viz_3d.zip",
                                known_hash=None)

    geo_model = gp.load_model(name='viz_3d', path=model_file)