Esempio n. 1
0
#          + steps __str__ = [645.63943742]
#          + steps __str__ = [99276.94573919]
#          + steps __str__ = [1961.52029888]
# 


# %%
# Export to gocad
# ---------------
# 

# %% 
def write_property_to_gocad_voxet(propertyfilename, propertyvalues):
    """
    This function writes a numpy array into the right format for a gocad
    voxet property file. This assumet there is a property already added to the .vo file,
    and is just updating the file.
    propertyfile - string giving the path to the file to write
    propertyvalues - numpy array nz,ny,nx ordering and in float format
    """
    propertyvalues = propertyvalues.astype('>f4')  # big endian
    #     array = propertyvalues.newbyteorder()
    propertyvalues.tofile(propertyfilename)


# %%
write_property_to_gocad_voxet('claudius_sf_gempy',
                              geo_model.solutions.scalar_field_matrix[1].reshape([38, 55, 30]).ravel('F'))

gp.save_model(geo_model)
Esempio n. 2
0
def test_save_solutions(model_horizontal_two_layers, tmpdir):
    gp.save_model(model_horizontal_two_layers,
                  solution=True,
                  compress=False,
                  path=tmpdir)
Esempio n. 3
0
gp.plot_2d(geo_data, direction='y')

# %%
# Calculating the model:
#

# %%
interp_data = gp.set_interpolator(geo_data, theano_optimizer='fast_compile')

# %%
sol = gp.compute_model(geo_data)

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

# %%
gp.plot_2d(geo_data,
           cell_number=5,
           direction='y',
           show_data=False,
           show_boundaries=True)

# %%
# sphinx_gallery_thumbnail_number = 2
gp.plot_2d(geo_data, cell_number=5, direction='x', show_data=True)

# %%
gp.plot_3d(geo_data)
gp.save_model(geo_data)
Esempio n. 4
0
def create_example(name_model,
                   interpolator=None,
                   save_pickle=False,
                   plot_section=True):
    """
    Create an inter_data from one of the examples data_set
    
    Attr:
        name_model (str): name of the model that you want to generate. It has to be in ['Model 1' ,'Model 2', 'Model 3', 'Model 4','Model 5' 'Model 6','Model 7',
                          'Model 8', 'Model 9']
        save_pickle (bool, str): Save to a pickle the interp_data object. You can pass the path as a string otherwse
                                the default name will be given
        plot_section (bool)
    
    """
    name_list = np.array([
        'Model 1', 'Model 2', 'Model 3', 'Model 4', 'Model 5', 'Model 6',
        'Model 7', 'Model 8', 'Model 9'
    ])
    assert name_model in name_list, 'Name model must be in the following list: ' + str(
        name_list)
    # Extract number of the model
    n_model = name_model[-1]

    # Load right gempy geodata
    geo_data = gp.create_data(
        name_model,
        extent=[0, 2000, 0, 2000, 0, 1600],
        resolution=[50, 50, 50],
        path_o=data_path + "/data/input_data/lisa_models/foliations" +
        n_model + ".csv",
        path_i=data_path + "/data/input_data/lisa_models/interfaces" +
        n_model + ".csv")

    # Set the right sequential pile
    subset_list_1 = np.array(['Model 1'])
    subset_list_2 = np.array(['Model 5', 'Model 8'])
    subset_list_3 = np.array(['Model 2', 'Model 3', 'Model 9', 'Model 6'])
    subset_list_4 = np.array(['Model 7'])
    ### Model 1 - Discordant layering ###
    if name_model in subset_list_1:
        gp.map_series_to_surfaces(
            geo_data,
            {
                "Strat_Series_1": ('Sandstone', 'Siltstone', 'Shale'),
                "Strat_Series_2": ('Sandstone2', 'Siltstone2', 'Shale2')
            },
        )
    ### Model 5 - One normal Fault ###
    ### Model 8 - ###
    elif name_model in subset_list_2:
        gp.map_series_to_surfaces(
            geo_data,
            {
                "Fault_Series":
                'Main_Fault',
                "Strat_Series": ('Sandstone', 'Siltstone', 'Shale',
                                 'Sandstone_2', 'Schist', 'Gneiss')
            },
        )
        geo_data.set_is_fault(['Fault_Series'])
    elif name_model in subset_list_3:
        ### Model 2 - Aufwölbung (durch Salzstock?) ###
        ### Model 3+9 - Parallele NNE Schichtung ohne Verwerfung ###
        ### Model 6 - Mulde ###
        gp.map_series_to_surfaces(
            geo_data,
            {
                "Strat_Series": ('Sandstone', 'Siltstone', 'Shale',
                                 'Sandstone_2', 'Schist', 'Gneiss')
            },
        )

    elif name_model in subset_list_4:
        ### Model 7 - Graben ###
        gp.map_series_to_surfaces(
            geo_data,
            {
                "Fault_1":
                'Fault_1',
                "Fault_2":
                'Fault_2',
                "Strat_Series": ('Sandstone', 'Siltstone', 'Shale',
                                 'Sandstone_2', 'Schist', 'Gneiss')
            },
        )
        geo_data.set_is_fault(['Fault_1', 'Fault_2'])

    else:
        print('You would never reach this point. Look for the bug')

    # Interpolation and Computation
    if interpolator is None:
        interp_data = gp.set_interpolator(geo_data,
                                          theano_optimizer='fast_run')
    else:
        interp_data = interpolator
        geo_data.set_theano_function(interpolator)
    sol = gp.compute_model(geo_data)

    if plot_section is True:
        # 2D Plot
        gp.plot_2d(geo_data, cell_number=25, direction='y', show_data=True)
        gp.plot_3d(geo_data)

    if save_pickle is not False:
        if type(save_pickle) is str:
            gp.save_model_to_pickle(geo_data, save_pickle)
        else:
            gp.save_model_to_pickle(geo_data, 'lisa-' + str(n_model))

    gp.save_model(geo_data)

    return interp_data
Esempio n. 5
0
def test_save_model(one_fault_model_no_interp):
    """Save a model in a zip file with the default name and path"""
    gp.save_model(one_fault_model_no_interp)
Esempio n. 6
0
def test_save_model_solution(one_fault_model_topo_solution, tmpdir):
    """Save a model in a zip file with the default name and path"""
    gp.save_model(one_fault_model_topo_solution,
                  path=tmpdir,
                  solution=True)
    print('foo')