コード例 #1
0
def interpolator_islith_isfault():

    geo_model = gp.create_model('interpolator_islith_isfault')

    # Importing the data from CSV-files and setting extent and resolution
    gp.init_data(geo_model,
                 path_o=input_path + "/simple_fault_model_orientations.csv",
                 path_i=input_path + "/simple_fault_model_points.csv",
                 default_values=True)

    gp.map_series_to_surfaces(geo_model, {
        "Fault_Series":
        'Main_Fault',
        "Strat_Series":
        ('Sandstone_2', 'Siltstone', 'Shale', 'Sandstone_1', 'basement')
    },
                              remove_unused_series=True)

    geo_model.set_is_fault(['Fault_Series'])

    gp.set_interpolation_data(geo_model,
                              compile_theano=True,
                              theano_optimizer='fast_compile',
                              verbose=[])

    return geo_model.interpolator
コード例 #2
0
gp.map_series_to_surfaces(
    geo_model,
    {
        "Fault_Series":'Main_Fault',
        "Strat_Series": ('Sandstone_2','Siltstone', 'Shale', 'Sandstone_1', 'basement')
    }, remove_unused_series=True)

# geo_model.series

geo_model.set_is_fault(['Fault_Series'])
geo_model.faults.faults_relations_df
# gp.plot.plot_data(geo_model, direction='y')
# gp.plot.plot_3D(geo_model)

gp.set_interpolation_data(geo_model,
                          compile_theano=True,
                          theano_optimizer='fast_compile',
                          verbose=[])


gp.get_data(geo_model, 'kriging')
geo_model.additional_data.structure_data

sol = gp.compute_model(geo_model, compute_mesh=True, sort_surfaces=False)
gp.plot.plot_section(geo_model, cell_number=25,
                     direction='y', show_data=True)

ver , sim = gp.get_surfaces(geo_model)
for i in range(len(ver)):
    fig = plt.figure()
    x, y, z = ver[i][:, 0], ver[i][:, 1], ver[i][:, 2]
    X, Y = np.meshgrid(x, y)
コード例 #3
0
def loop2gempy_(test_data_name, tmp_path, vtk_path, orientations_file, contacts_file, groups_file, dtm_reproj_file,
                bbox, model_base, model_top, vtk):
    import gempy as gp
    from gempy import plot
    geo_model = gp.create_model(test_data_name)

    # If depth coordinates are much smaller than XY the whole system of equations becomes very unstable. Until
    # I fix it properly in gempy this is a handcrafted hack
    ve = (bbox[0] - bbox[2]) / (model_base - model_top)

    if ve < 3:
        ve = 0
    else:
        print('The vertical exageration is: ', ve)

    gp.init_data(geo_model, extent=[bbox[0], bbox[2], bbox[1], bbox[3], model_base*ve, model_top*ve],
        resolution = (50,50,50),
          path_o = orientations_file,
          path_i = contacts_file, default_values=True);

    # Show example lithological points
    #gp.get_data(geo_model, 'surface_points').head()

    # Show example orientations
    #gp.get_data(geo_model, 'orientations').head()

    # Plot some of this data
    #gp.plot.plot_data(geo_model, direction='z')

    geo_model.modify_surface_points(geo_model.surface_points.df.index, Z=geo_model.surface_points.df['Z']*ve)

    # Load reprojected topgraphy to model

    fp = dtm_reproj_file
    geo_model.set_topography(source='gdal',filepath=fp)

    contents=np.genfromtxt(groups_file,delimiter=',',dtype='U100')
    ngroups=len(contents)

    faults = gp.Faults()
    series = gp.Series(faults)
    #series.df

    #display(ngroups,contents)
    groups = []

    for i in range (0,ngroups):
        groups.append(contents[i].replace("\n",""))
        series.add_series(contents[i].replace("\n",""))
        print(contents[i].replace("\n",""))

    series.delete_series('Default series')

    #series

    # Load surfaces and assign to series
    surfaces = gp.Surfaces(series)

    print(ngroups,groups)
    for i in range(0,ngroups):
        contents=np.genfromtxt(tmp_path+groups[i]+'.csv',delimiter=',',dtype='U100')
        nformations=len(contents.shape)

        if(nformations==1):
            for j in range (1,len(contents)):
                surfaces.add_surface(str(contents[j]).replace("\n",""))
                d={groups[i]:str(contents[j]).replace("\n","")}
                surfaces.map_series({groups[i]:(str(contents[j]).replace("\n",""))}) #working but no gps
        else:
            for j in range (1,len(contents[0])):
                surfaces.add_surface(str(contents[0][j]).replace("\n",""))
                d={groups[i]:str(contents[0][j]).replace("\n","")}
                surfaces.map_series({groups[i]:(str(contents[0][j]).replace("\n",""))}) #working but no gps

    # Set Interpolation Data
    id_only_one_bool = geo_model.surface_points.df['id'].value_counts() == 1
    id_only_one = id_only_one_bool.index[id_only_one_bool]
    single_vals = geo_model.surface_points.df[geo_model.surface_points.df['id'].isin(id_only_one)]
    for idx, vals in single_vals.iterrows():
        geo_model.add_surface_points(vals['X'], vals['Y'], vals['Z'], vals['surface'])

    geo_model.update_structure()

    gp.set_interpolation_data(geo_model,
                              compile_theano=True,
                              theano_optimizer='fast_compile',
                              verbose=[])

    # Provide summary data on model

    #geo_model.additional_data.structure_data

    #Calculate Model
    gp.compute_model(geo_model)

    # Extract surfaces to visualize in 3D renderers
    #gp.plot.plot_section(geo_model, 49, direction='z', show_data=False)

    ver, sim = gp.get_surfaces(geo_model)

    # import winsound
    # duration = 700  # milliseconds
    # freq = 1100  # Hz
    # winsound.Beep(freq, duration)
    # winsound.Beep(freq, duration)
    # winsound.Beep(freq, duration)

    #Visualise Model
    gp.plot.plot_3D(geo_model, render_data=False)

    #Save model as vtk
    if(vtk):
        gp.plot.export_to_vtk(geo_model, path=vtk_path, name=test_data_name+'.vtk', voxels=False, block=None, surfaces=True)

    return geo_model
コード例 #4
0
# Setting and ordering the units and series:
#

gp.map_stack_to_surfaces(geo_data, {
    "Strat_Series": ('rock2', 'rock1'),
    "Basement_Series": ('basement')
})

# %matplotlib inline
gp.plot.plot_data(geo_data, direction='y')

######################################################################
# Calculating the model:
#

interp_data = gp.set_interpolation_data(geo_data,
                                        theano_optimizer='fast_compile')

geo_data.update_to_interpolator()

geo_data._orientations

geo_data._interpolator.theano_graph.nugget_effect_grad_T.get_value()

sol = gp.compute_model(geo_data)

######################################################################
# Displaying the result in y and x direction:
#

# %matplotlib inline
gp.plot.plot_section(geo_data, cell_number=15, direction='y', show_data=True)