Skip to content

Commit

Permalink
Removing faults.py and adding documentation.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ricardo Serrano committed Dec 21, 2017
1 parent 2c1b309 commit e3e235b
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 215 deletions.
2 changes: 1 addition & 1 deletion docs/source/intro.rst
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ The requirements of Geomodelr Query Tool are:
- Currently, Linux and Mac OS X are supported in Python 2.7 but we plan to support Windows and Python 3.5 in the near future.
- C++ Build tools that support C++11.
- Boost Libraries.
- numpy, scipy and shapely, (pip will install them).
- numpy, scipy and (pip will install them).

In general, you can install geomodelr by calling::

Expand Down
25 changes: 23 additions & 2 deletions geomodelr/cpp/geomodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,27 @@ BOOST_PYTHON_MODULE(cpp)
" (double)\n"
" The signed distance from the unit to the point.\n";

const char* doc_intersect_planes = "Intersects a set of planes with the faults of the Geological Model.\n"
"Takes a set of plane represented with its four corners and returns the set\n"
"of lines that intersect that plane with the faults. The coordinates start from\n"
"the first plane lower corner, and increase by dist(plane[i][0], plane[i][1]) for the\n"
"next plane.\n\n"
"Args:\n"
" (list) plane: List with planes. Each plane has a list with four corners\n"
" that we want to intersect the fault with.\n"
"Returns:\n"
" (dict): a dictionary with fault names as keys, and lines, (list of points)\n"
" as values.\n";
const char* doc_intersect_plane = "Intersects a plane with the faults of the Geological Model.\n\n"
"Takes a plane represented with its four corners and returns the set\n"
"of lines that intersect that plane with the faults.\n\n"
"Args:\n"
" (list) plane: list with the four corners of the plane that we \n"
" want to intersect the fault with.\n\n"
"Returns:\n"
" (dict): a dictionary with fault names as keys, and lines,\n"
" (list of points) as values. The coordinates go from the\n"
" lower left corner, (0.0, 0.0).\n";
// Register exception.
python::class_<GeomodelrException> GeomodelrExceptionClass("GeomodelrException", boost::python::init<std::string>());

Expand Down Expand Up @@ -203,8 +224,8 @@ BOOST_PYTHON_MODULE(cpp)
.def("signed_distance_bounded", &ModelPython::signed_distance_bounded, python::args("unit", "point"), doc_signed_distance_bounded)
.def("signed_distance_unbounded", &ModelPython::signed_distance_unbounded, python::args("unit", "point"), doc_signed_distance_unbounded)
.def("height", &ModelPython::height, python::args("point"), doc_height)
.def("intersect_plane", &ModelPython::intersect_plane)
.def("intersect_planes", &ModelPython::intersect_planes)
.def("intersect_plane", &ModelPython::intersect_plane, doc_intersect_plane)
.def("intersect_planes", &ModelPython::intersect_planes, doc_intersect_planes)
.def("info", &ModelPython::info)
.add_property("bbox", &ModelPython::pybbox)
.add_property("matches", &ModelPython::get_matches, &ModelPython::set_matches)
Expand Down
171 changes: 0 additions & 171 deletions geomodelr/faults.py

This file was deleted.

38 changes: 0 additions & 38 deletions geomodelr/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.

import shared
import faults
import json
import datetime
import numpy as np
Expand Down Expand Up @@ -254,43 +253,6 @@ def verbose_info(collection):
print "\tFault names present: %s" % ", ".join(lnames)
print "\tFault properties present: %s" % ", ".join(lprops)

#def intersect_plane( self, plane ):
"""
Intersects a plane with the faults of the Geological Model.
Takes a plane represented with its four corners and returns the set
of lines that intersect that plane with the faults.
Args:
(list) plane: list with the four corners of the plane that we
want to intersect the fault with.
Returns:
(dict): a dictionary with fault names as keys, and lines,
(list of points) as values. The coordinates go from the
lower left corner, (0.0, 0.0).
"""
#return faults.find_faults_plane_intersection( self.faults, plane )

#def intersect_planes( self, planes ):
"""
Intersects a set of planes with the faults of the Geological Model.
Takes a set of plane represented with its four corners and returns the set
of lines that intersect that plane with the faults. The coordinates start from
the first plane lower corner, and increase by dist(plane[i][0], plane[i][1]) for the
next plane.
Args:
(list) plane: List with planes. Each plane has a list with four corners
that we want to intersect the fault with.
Returns:
(dict): a dictionary with fault names as keys, and lines, (list of points)
as values.
"""
#return faults.find_faults_multiple_planes_intersection( self.faults, planes )

def validate( self ):
"""
Validates that the Geological JSON has correct information.
Expand Down
3 changes: 1 addition & 2 deletions geomodelr/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import os
import model
import json
import faults
import shared
import utils
import isosurfaces
Expand Down Expand Up @@ -719,7 +718,7 @@ def test_faults(self):
for ls in range(faults_size[fp]):
self.assertEqual(len(Fault_int.values()[fp][ls]),lines_size[fp][ls])

Fault_int_py = faults.find_faults_multiple_planes_intersection(geo_model.faults,planes)
Fault_int_py = cpp.find_faults_intersection(geo_model.faults,planes)

for name,fault in Fault_int.iteritems():
flat_fault = np.array([item for sublist in fault for item in sublist])
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def if_env(**kwargs):
license='AGPL',
packages=['geomodelr'],
ext_modules=[cppextension],
install_requires=['numpy', 'scipy', 'shapely'],# 'scikit-image', 'numpy-stl'],
install_requires=['numpy', 'scipy'],# 'scikit-image', 'numpy-stl'],
keywords=['geology', 'geological modelling', 'cross sections', 'geomodelr'],
entry_points = {
'console_scripts': [
Expand Down

0 comments on commit e3e235b

Please sign in to comment.