def test_set_series(self, test_read_surface_points): series = gp.Series() # We can pass a pandas categories_df series.set_series_categories(pn.DataFrame({"fault": ['test2'], "Rest": 'SecondaryReservoir'})) # We can even pass an interface object since sometimes (GeoModeller) we # can import the surface in the same table series.set_series_categories(test_read_surface_points) print(series) # Test init series series = gp.Series(series_distribution={"fault": 'MainFault', "Rest": ('SecondaryReservoir', 'Seal3', 'Reservoir', 'Overlying'), }) return series
def test_read_surface_points(): surface_points = gp.SurfacePoints() surface_points.read_surface_points(os.pardir + "/input_data/FabLessPoints_Points.csv", inplace=True) # Test setting series series = gp.Series(series_distribution={"fault": 'MainFault', "Rest": ('SecondaryReservoir', 'Seal3', 'Reservoir', 'Overlying'), }) surface_points.map_data_from_series(series, 'id') return surface_points
def create_series(create_faults): faults = create_faults series = gp.Series(faults) series.set_series_index(['foo', 'foo2', 'foo5', 'foo7']) series.add_series('foo3') series.delete_series('foo2') series.rename_series({'foo': 'boo'}) series.reorder_series(['foo3', 'boo', 'foo7', 'foo5']) faults.set_is_fault(['boo']) fr = np.zeros((4, 4)) fr[2, 2] = True faults.set_fault_relation(fr) series.add_series('foo20') return series
# %% # Series # ~~~~~~ # # Series is the object that contains the properties associated with each # independent scalar field. Right now it is simply the order of the series # (which is inferred by the index order). But in the future will be add the # unconformity relation or perhaps the type of interpolator # # Series and Faults classes are quite entangled since fault are a view of # series # # %% faults = gp.Faults() series = gp.Series(faults) series.df # %% # We can modify the series bt using ``set_series_index``: # # %% series.set_series_index(['foo', 'foo2', 'foo5', 'foo7']) series # %% # The index of series are pandas categories. These provides quite handy # backend functionality (see pandas.Categorical). #
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