regeo_mesh¶
- regeo_mesh.CONNE_count(save_csv=False)[source]¶
Return a dataframe with the name of elements and the number of connection
- Parameters
save_csv (bool) – If true writes the output dataframe as csv, default False
- Returns
dataframe – count_conne: blocks and number of connections
file – CONNE_count.csv: at ../mesh/
- regeo_mesh.CONNE_to_json(input_dictionary, to_sql=False)[source]¶
It creates a json file from the CONNE file on mesh/to_steinar folder
- Parameters
input_dictionary (dictionary) – Dictionary containing the path and name of database and the path of the input file
- Returns
CONNE.json: on ../mesh/
- Return type
file
Attention
Currently, it uses the steinar folder because it assume the modeler will perfome the block assignation on it
Examples
>>> CONNE_to_json()
- regeo_mesh.ELEM_to_json(input_dictionary, to_sql=False)[source]¶
It combines the files eleme and in from the steinar folder into a single json file
- Parameters
input_dictionary (dictionary) – Dictionary containing the path and name of database and the path of the input file
- Returns
ELEME.json: on ../mesh/
- Return type
file
Attention
Currently, it uses the steinar function because it assume the modeler will perfome the block assignation on it
Examples
>>> ELEM_to_json()
- regeo_mesh.change_ref_elevation(variation=0)[source]¶
It modifies the in files from the folders to_steinar and from_amesh by increasing (or decreasing) a fixed value
- Parameters
variation (float) – Defined value change the elevation of the in file from amesh
- Returns
in: modified on folders ../mesh/to_steinar and ../mesh/from_amesh
- Return type
file
Attention
The change is generated on all the elements. It is recommened to run ELEM_to_json() after this execution
Examples
>>> change_ref_elevation(variation=-100)
- regeo_mesh.clip_steinar_data()[source]¶
Modifies the eleme file on steinar folder. It converts all elements on top of topography to ATMOS rock type and add rocktype to rock file
Attention
The output file is written on a file named rocks2
- regeo_mesh.empty_mesh()[source]¶
If the suggested T2GEORES folder structure is used. The folder mesh/to_steinar, mesh/from_amesh and mesh/GIS are emptied
Note
No input parameter is needed
Examples
>>> empty_mesh()
- regeo_mesh.feedpoints_to_vtu()[source]¶
It generates a cube (Hexahedron) for each feedzone
- Returns
{index}_{well}.vtu in output/vtu/feedzones/
- Return type
file
Attention
The file input/well_feedzone_xyz.csv has to be created prior the execution of this function
- regeo_mesh.mesh_creation_func(input_mesh_dictionary, input_dictionary)[source]¶
Creates a grid
Most of the parameters are keywords from the input dictionary input_mesh_dictionary. Otherwise, the input dictionary is specified.
- Parameters
filename (str) – File name with well feedzone location
filepath (str) – Path of input files
Xmin (float) – Minimun X coordinates for the grid
Xmax (float) – Maximun X coordinates for the grid
Ymin (float) – Minimun Y coordinates for the grid
Ymax (float) – Maximun Y coordinates for the grid
toler (float) – AMESH parameter
layers (dictionary) – Name (correlative) and thickness of every layer on the model, keyword on input_dictionary
layer_to_plot (int) – In case it is specified a voronoi plot will be performed
x_space (float) – Horizontal distance between elements for the outerfield
y_space (float) – Vertical distance between elements for the outerfield
radius_criteria (float) – Minimun distance between well location and a regular element
x_from_boarder (float) – Horizontal distance from the first element to the east border
y_from_boarder (float) – Vertical distance from the first element to the south border
x_gap_min (float) – Minimun X coordinates on the grid for the well field
x_gap_max (float) – Maximun X coordinates on the grid for the well field
x_gap_space (float) – Horizontal distance between elements for the farfield
y_gap_min (float) – Minimun Y coordinates on the grid for the well field o
y_gap_max (float) – Maximun X coordinates on the grid for the well field
y_gap_space (float) – Vertical distance between elements for the farfield
plot_names (bool) – If true it plots the name of the blocks from the selected layer to plot
plot_centers (bool) – If true it plots the centers of the blocks from the selected layer to plot
z0_level (float) – Reference level (elevation) for all the grid, keyword on input_dictionary
mesh_creation (bool) – If true the mesh is created
plot_layer (bool) – If true it plots the selected layer
to_steinar (bool) – If true it creates the input files for steinar
to_GIS (bool) – If true it generates a shapefile of the selected layer
plot_all_GIS (bool) – If true it generates a shapefile of all layers
from_leapfrog (bool) – lee archivos leapfrong ../mesh/from_leapfrog/LF_geometry.dat y ../mesh/from_leapfrog/LF_t2.dat, sin embargo se pierde la simbologia usada en leapfrog y no te utiliza la malla regular ni los pozos. Solamente se crea la malla utilizando amesh
line_file (str) – It defines the path and name of a line that can represented a fault or other structure on the mesh, The input file must contain the header: ID,X,Y on csv format. ID referes to the same structure, thus, more than one structure can be defined on a single file.
fault_distance (float) – In case a line_file is define, some paralels elements will be created at a defined distance
with_polygon (bool) – If true a shapefile will be read to define the wellfield.
polygon_shape (str) – The shapefile deines the wellfield boundaries. The shape must not contain any cavity
set_inac_from_poly (bool) – If true all the elements on the outside of the shapefile are defined as inactive
set_inac_from_inner (bool) – If true all the elements on the outerfield are defined as inactive
rotate (bool) – If true it rotates the mesh a defined angle
angle (float) – Angle in degrees
inner_mesh_type (string) – Type of mesh on the inner part of the mesh, it could be ‘honeycomb’ or ‘regular’
- Returns
file – eleme: list of blocks from the grid
file – conne : list of connections on the grid
shapefile – mesh_{field}_layer_{layer} : shapefile of a defined (or all) layer including rock distribution
plot – Voronoi plot (in case is specified)
Attention
A copy of AMESH must be on the path or directory
- regeo_mesh.mesh_to_paraview(input_dictionary)[source]¶
It generates a vtu file to be read on Paraview including the rocktype and block name.
- Parameters
input_dictionary (dictionary) – Contains the information of the layers on the model.
- Returns
model_mesh.vtu: on ../mesh
- Return type
file
- regeo_mesh.plot_voronoi(input_mesh_dictionary, geners, layer='D', plot_center=False, mark_elements=False, cross_section=None, savefig=False)[source]¶
It plots a selected layer, showing the rock distribution
- Returns
layer (str) – It defines the layer correlative to plot
plot_center (bool) – If True it plots the center point for each element
mark_elements (bool) – If True it considers the final four identifiers from each constant sink/source element defined on geners and fill the block with a different color.
cross_section (bool) – If true plot a line where a vertical cross section is created with the output module
savefig (bool) – If true a png file is saved on ../mesh
input_mesh_dictionary (dictionary) – Contains a unique color for every rocktype.
geners (dictionary) – Contains the neccesary information to define a sink/source. g.e. ‘DA110’:{‘SL’:’GEN’,’NS’:10,’TYPE’:’MASS’,’GX’:1,’EX’:1.1E6}
- Returns
layer_{layer}: containing the rock distribution from the selected layer
- Return type
plot
Attention
The functions ELEM_to_json()
Examples
>>> segmnt_to_json() and segmnt_to_json() should be executed previously
- class regeo_mesh.py2amesh(filename, filepath, Xmin, Xmax, Ymin, Ymax, toler, layers, layer_to_plot, x_space, y_space, radius_criteria, x_from_boarder, y_from_boarder, x_gap_min, x_gap_max, x_gap_space, y_gap_min, y_gap_max, y_gap_space, plot_names, plot_centers, z0_level, plot_all_GIS, from_leapfrog, line_file, fault_distance, with_polygon, polygon_shape, set_inac_from_poly, set_inac_from_inner, rotate, angle, inner_mesh_type, distance_points, fault_rows, relaxation_times, points_around_well, distance_points_around_well, outer_polygon)[source]¶
Bases:
object
It creates a mesh based on well positions and irregular blocks
The main characteristics are:
-It generates the mesh based on defined boundaries
-The inner section is called wellfield and can contain elements with hexagonal or square shape
-The wellfield can be delimited by a shapefile or by fixed squared boundaries.
-It allows to generates elements along a line to represent structures.
-The voronoi elements are generated by AMESH.
-The elements name cannot contain two consecutive zeros.
-The well blocks are the first on the list
-It creates the input files to work on Steinar (RockEditor)
-It can export a defined layer on a shapefile format
-It can plot a selected layer (It is recommended to use the function plot_voronoi() to plot)
-Two json file are generated with the correlative block for each well, from which can be track during all the modelling steps.
- Parameters
filename (str) – File name with well feedzone location
filepath (str) – Path of input files
Xmin (float) – Minimun X coordinates for the grid
Xmax (float) – Maximun X coordinates for the grid
Ymin (float) – Minimun Y coordinates for the grid
Ymax (float) – Maximun Y coordinates for the grid
toler (float) – AMESH parameter
layers (dictionary) – Name (correlative) and thickness of every layer on the model, keyword on input_dictionary
layer_to_plot (int) – In case it is specified a voronoi plot will be performed
x_space (float) – Horizontal distance between elements for the outerfield
y_space (float) – Vertical distance between elements for the outerfield
radius_criteria (float) – Minimun distance between well location and a regular element
x_from_boarder (float) – Horizontal distance from the first element to the east border
y_from_boarder (float) – Vertical distance from the first element to the south border
x_gap_min (float) – Minimun X coordinates on the grid for the well field
x_gap_max (float) – Maximun X coordinates on the grid for the well field
x_gap_space (float) – Horizontal distance between elements for the farfield
y_gap_min (float) – Minimun Y coordinates on the grid for the well field o
y_gap_max (float) – Maximun X coordinates on the grid for the well field
y_gap_space (float) – Vertical distance between elements for the farfield
plot_names (bool) – If true it plots the name of the blocks from the selected layer to plot
plot_centers (bool) – If true it plots the centers of the blocks from the selected layer to plot
z0_level (float) – Reference level (elevation) for all the grid, keyword on input_dictionary
mesh_creation (bool) – If true the mesh is created
plot_layer (bool) – If true it plots the selected layer
to_steinar (bool) – If true it creates the input files for steinar
to_GIS (bool) – If true it generates a shapefile of the selected layer
plot_all_GIS (bool) – If true it generates a shapefile of all layers
from_leapfrog (bool) – lee archivos leapfrong ../mesh/from_leapfrog/LF_geometry.dat y ../mesh/from_leapfrog/LF_t2.dat, sin embargo se pierde la simbologia usada en leapfrog y no te utiliza la malla regular ni los pozos. Solamente se crea la malla utilizando amesh
line_file (str) – It defines the path and name of a line that can represented a fault or other structure on the mesh, The input file must contain the header: ID,X,Y on csv format. ID referes to the same structure, thus, more than one structure can be defined on a single file.
fault_distance (float) – In case a line_file is define, some paralels elements will be created at a defined distance
with_polygon (bool) – If true a shapefile will be read to define the wellfield.
polygon_shape (str) – The shapefile deines the wellfield boundaries. The shape must not contain any cavity
set_inac_from_poly (bool) – If true all the elements on the outside of the shapefile are defined as inactive
set_inac_from_inner (bool) – If true all the elements on the outerfield are defined as inactive
rotate (bool) – If true it rotates the mesh a defined angle
angle (float) – Angle in degrees
inner_mesh_type (string) – Type of mesh on the inner part of the mesh, it could be ‘honeycomb’ or ‘regular’
- Returns
file – eleme: list of blocks from the grid
file – conne : list of connections on the grid
shapefile – mesh_{field}_layer_{layer} : shapefile of a defined (or all) layer including rock distribution
plot – Voronoi plot (in case is specified)
Attention
A copy of AMESH must be on the path or directory
- check_in_out(position, point, source)[source]¶
Verifica si un punto de la malla del campo cercano esta dentro o fuera del poligo definido por el shapefile de entrada o del campo cercano
- data()[source]¶
Define los puntos que ingresaran al archivo de entrada para amesh. Adicionalmente, en caso de definir un linea en el archivo de entrada <i><lines_data/i> se procedera a ingresar estos puntos y crear puntos paralelos en ambos extremos de la linea
- from_leapfrog_mesh()[source]¶
Extrae puntos mas extremos y la posicion de los elementos de un set de datos provinientes de leapfrog, sin embargo no considera los elementos asociados a la roca ATM 0
- outer_polygon¶
shape = shapefile.Reader(polygon_shape)
#first feature of the shapefile feature = shape.shapeRecords()[0] points = feature.shape.__geo_interface__ self.polygon=[] for n in points:
- for v in points[n]:
- if n==’coordinates’:
self.polygon.append([v[0],v[1]]) # (GeoJSON format)
- plot_voronoi()[source]¶
En caso de ser solicitado, grafica la malla a partir de los archivo en la carpeta ../mesh/from_amesh
- radius_select(x0, y0, xr, yr, type_i='mesh')[source]¶
Verifica si dos puntos estan mas cerca que el criterio seleccionado
- regular_mesh()[source]¶
Genera malla regular en en toda la extension de la region definida por Xmin,Xmax,Ymin y Ymax
- to_GIS()[source]¶
Toma como entrada el archivo segment de ../mesh/from_amesh y eleme de ../mesh/to_stainar y los convierte en shapefile con atributos de roca, nombre y volumen
- regeo_mesh.reasig_feedzone(input_dictionary)[source]¶
It reassing the block related with a well feedzone
Attention
Files: ‘../input/well_feedzone_xyz.csv’ and ‘../mesh/ELEME.json’ need to be updated
- Returns
file – well_dict.txt: at ../mesh/
file – wells_correlative.txt: at ../mesh/
- regeo_mesh.segmnt_to_json(input_dictionary, to_sql=False)[source]¶
It combines the information from eleme and segmt from folder mesh/to_steinar into a single json
- Parameters
input_dictionary (dictionary) – Dictionary containing the path and name of database and the path of the input file
- Returns
segmt.json: on ../mesh/
- Return type
file
Attention
Currently, it uses the steinar folder because it assume the modeler will perfome the block assignation on it.
Examples
>>> segmnt_to_json()
- regeo_mesh.set_layer_inactive(layers=[])[source]¶
It sets innactive one layer from the mesh on the ELEME file
- Parameters
layer (str) – Layer to set inactive
- Returns
in: modified on folders ../mesh/to_steinar and ../mesh/from_amesh
- Return type
file
Examples
>>> set_layer_inactive(variation = 'A')
- regeo_mesh.surface_cut(input_mesh_dictionary)[source]¶
It generates an json file with the elements below the surface
- Parameters
input_mesh_dictionary (dictionary) – Contains the path for the file on csv format with the topography data
- Returns
ELEME.json: on the path ../mesh/vtu/
- Return type
file
Attention
csv file should have X,Y,Z on the first line and comma (,) as a delimiter
- regeo_mesh.to_GIS(input_mesh_dictionary, layer='A')[source]¶
It plots a selected layer, showing the rock distribution
- Returns
layer (str) – It defines the layer correlative to plot
plot_center (bool) – If True it plots the center point for each element
mark_elements (bool) – If True it considers the final four identifiers from each constant sink/source element defined on geners and fill the block with a different color.
cross_section (bool) – If true plot a line where a vertical cross section is created with the output module
savefig (bool) – If true a png file is saved on ../mesh
input_mesh_dictionary (dictionary) – Contains a unique color for every rocktype.
geners (dictionary) – Contains the neccesary information to define a sink/source. g.e. ‘DA110’:{‘SL’:’GEN’,’NS’:10,’TYPE’:’MASS’,’GX’:1,’EX’:1.1E6}
- Returns
layer_{layer}: containing the rock distribution from the selected layer
- Return type
plot
Attention
The functions ELEM_to_json()
Examples
>>> segmnt_to_json() and segmnt_to_json() should be executed previously