diff --git a/README.md b/README.md index f98a2657d..df4efee7d 100644 --- a/README.md +++ b/README.md @@ -49,53 +49,53 @@ The following package defines [Paraview](https://docs.paraview.org/) plugins tha GEOS Python packages dependency tree (inter-dependency and main external dependencies) is the following: ``` -|-- geos-ats -|-- pygeos-tools -|-- geos-utils -|-- geos-geomechanics -| |-- geos-utils -| -|-- hdf5-wrapper -| |-- h5py -| -|-- geos-xml-tools -| |-- lxml -| -|-- geos-mesh -| |-- geos-utils -| |-- vtk -| -|-- geos-prep -| |-- geos-mesh -| |-- geos-xml-tools -| -|-- geos-posp -| |-- geos-mesh -| |-- geos-geomechanics -| -|-- time-history -| |-- hdf5-wrapper -| -|-- mesh-doctor -| |-- geos-prep -| |-- pyvista -| -|-- geos-trame -| |-- geos-xml-tools -| |-- geos-mesh -| |-- pyvista -| |-- trame -| -|-- geos-xml-viewer -| |-- geos-xml-tools -| |-- geos-mesh -| |-- pyvista -| -|-- geos-pv - |-- geos-prep - |-- geos-posp - |-- geos-xml-tools - |-- paraview +├── geos-ats +├── pygeos-tools +├── geos-utils +├── geos-geomechanics +│ ├── geos-utils +│ +├── hdf5-wrapper +│ ├── h5py +│ +├── geos-xml-tools +│ ├── lxml +│ +├── geos-mesh +│ ├── geos-utils +│ ├── vtk +│ +├── geos-prep +│ ├── geos-mesh +│ ├── geos-xml-tools +│ +├── geos-posp +│ ├── geos-mesh +│ ├── geos-geomechanics +│ +├── time-history +│ ├── hdf5-wrapper +│ +├── mesh-doctor +│ ├── geos-prep +│ ├── pyvista +│ +├── geos-trame +│ ├── geos-xml-tools +│ ├── geos-mesh +│ ├── pyvista +│ ├── trame +│ +├── geos-xml-viewer +│ ├── geos-xml-tools +│ ├── geos-mesh +│ ├── pyvista +│ +├── geos-pv + ├── geos-prep + ├── geos-posp + ├── geos-xml-tools + ├── paraview ``` See the [documentation](https://geosx-geosx.readthedocs-hosted.com/projects/geosx-geospythonpackages/en/latest/) for additional details about the packages and how to use them. @@ -149,43 +149,26 @@ If you do not have the rights to push the code and open new PRs, consider openin Any new package must have the following architecture: ``` -package-name -|-- pyproject.toml -|-- setup.py -|-- src -| |-- geos -| |-- package_name -| |-- file1.py -| |-- file1.py -|-- tests - |-- test1.py - |-- test2.py +package-name/ +├── pyproject.toml +├── src +│ ├── geos +│ ├── package_name +│ ├── file1.py +│ ├── file1.py +├── tests + ├── test1.py + ├── test2.py ``` -The *setup.py* file is optional. It is required if the package depends on another GEOS Python package located in the root directory. If you want a package1 to depend on package2, follow this [procedure](https://stackoverflow.com/questions/75159453/specifying-local-relative-dependency-in-pyproject-toml): - -* in the *package1/pyproject.py*, replace the tag `dependencies = ["external_packageX", "external_packageY",]` with `dynamic = ["dependencies"]` -* create the *package1/setup.py* file -* copy the following lines in the *setup.py* and update the dependencies - ``` - from pathlib import Path - from setuptools import setup - - # This is where you add any fancy path resolution to the local lib: - package_name = "geos-utils" - geos_utils_path: str = (Path(__file__).parent.parent / package_name).as_uri() - - setup( - install_requires=[ - "vtk >= 9.3", - "numpy >= 1.26", - "pandas >= 2.2", - "typing_extensions >= 4.12", - f"{package_name} @ {geos_utils_path}", - ] - ) - ``` +If you want a package to depend on another GEOS Python package (let's say `geos-utils`), in the pyproject.toml the dependency takes the form: +``` +dependencies = [ + ... + "geos-utils @ file:./geos-utils", +] +``` Release ------- diff --git a/geos-geomechanics/pyproject.toml b/geos-geomechanics/pyproject.toml index 6ec7b6611..d49048c36 100644 --- a/geos-geomechanics/pyproject.toml +++ b/geos-geomechanics/pyproject.toml @@ -21,7 +21,13 @@ classifiers = [ "Development Status :: 4 - Beta", "Programming Language :: Python" ] -dynamic = ["dependencies"] +dependencies=[ + "vtk >= 9.3", + "numpy >= 1.26", + "pandas >= 2.2", + "typing_extensions >= 4.12", + "geos-utils @ file:./geos-utils", +] requires-python = ">= 3.10" [project.optional-dependencies] diff --git a/geos-geomechanics/setup.py b/geos-geomechanics/setup.py deleted file mode 100644 index 3c542ff61..000000000 --- a/geos-geomechanics/setup.py +++ /dev/null @@ -1,13 +0,0 @@ -from pathlib import Path -from setuptools import setup - -# This is where you add any fancy path resolution to the local lib: -geos_utils_path: str = ( Path( __file__ ).parent.parent / "geos-utils" ).as_uri() - -setup( install_requires=[ - "vtk >= 9.3", - "numpy >= 1.26", - "pandas >= 2.2", - "typing_extensions >= 4.12", - f"geos-utils @ {geos_utils_path}", -] ) diff --git a/geos-geomechanics/src/geos/geomechanics/processing/geomechanicsCalculatorFunctions.py b/geos-geomechanics/src/geos/geomechanics/processing/geomechanicsCalculatorFunctions.py index 174c17267..f436c8144 100644 --- a/geos-geomechanics/src/geos/geomechanics/processing/geomechanicsCalculatorFunctions.py +++ b/geos-geomechanics/src/geos/geomechanics/processing/geomechanicsCalculatorFunctions.py @@ -31,7 +31,8 @@ def specificGravity( density: npt.NDArray[ np.float64 ], specificDensity: float if abs( specificDensity ) < EPSILON: return np.full_like( density, np.nan ) - return ( density / specificDensity ).astype( np.float64 ) + + return ( density / specificDensity ).astype( float ) # https://en.wikipedia.org/wiki/Elastic_modulus @@ -626,7 +627,7 @@ def criticalPorePressure( stressVector: npt.NDArray[ np.float64 ], rockCohesion: float, frictionAngle: float = 0.0, -) -> npt.NDArray[ np.float64 ]: +) -> npt.NDArray[ np.floating[ Any ] ]: r"""Compute the critical pore pressure. Fracturing can occur in areas where Critical pore pressure is greater than @@ -665,9 +666,10 @@ def criticalPorePressure( maximumPrincipalStress[ i ] = p1 # assertion frictionAngle < np.pi/2., so sin(frictionAngle) != 1 - cohesiveTerm: npt.NDArray[ np.float64 ] = ( rockCohesion * np.cos( frictionAngle ) / - ( 1 - np.sin( frictionAngle ) ) ) - residualTerm: npt.NDArray[ np.floating[ Any ] ] = ( 3 * minimumPrincipalStress - maximumPrincipalStress ) / 2.0 + cohesiveTerm: npt.NDArray[ np.floating[ Any ] ] = ( rockCohesion * np.cos( frictionAngle ) / + ( 1.0 - np.sin( frictionAngle ) ) ) + residualTerm: npt.NDArray[ np.floating[ Any ] ] = ( 3.0 * minimumPrincipalStress - maximumPrincipalStress ) / 2.0 + return cohesiveTerm + residualTerm @@ -852,14 +854,14 @@ def shearCapacityUtilization( traction: npt.NDArray[ np.float64 ], rockCohesion: for i in range( traction.shape[ 0 ] ): tractionVec: npt.NDArray[ np.float64 ] = traction[ i ] # use -1 to agree with Geos convention (i.e., compression with negative stress) - stressNormal: npt.NDArray[ np.float64 ] = -1.0 * tractionVec[ 0 ] + stressNormal: float = -1.0 * tractionVec[ 0 ] # compute failure envelope mohrCoulomb: MohrCoulomb = MohrCoulomb( rockCohesion, frictionAngle ) tauFailure: float = float( mohrCoulomb.computeShearStress( stressNormal ) ) scu_i: float = np.nan if tauFailure > 0: - scu_i = np.abs( tractionVec[ 1 ] ) / tauFailure + scu_i = abs( tractionVec[ 1 ] ) / tauFailure # compute SCU scu[ i ] = scu_i return scu diff --git a/geos-posp/pyproject.toml b/geos-posp/pyproject.toml index 8053eb4d4..d9e9d26a9 100644 --- a/geos-posp/pyproject.toml +++ b/geos-posp/pyproject.toml @@ -29,8 +29,18 @@ keywords = [ "GEOS", "Simulation", ] -dynamic = ["dependencies"] -requires-python = ">= 3.9" + +requires-python = ">= 3.10" + +dependencies = [ + "vtk >= 9.3", + "numpy >= 1.26", + "pandas >= 2.2", + "typing_extensions >= 4.12", + "geos-utils @ file:./geos-utils", + "geos-geomechanics @ file:./geos-geomechanics", +] + [project.urls] Homepage = "https://github.com/GEOS-DEV/geosPythonPackages" diff --git a/geos-posp/setup.py b/geos-posp/setup.py deleted file mode 100644 index e08a79310..000000000 --- a/geos-posp/setup.py +++ /dev/null @@ -1,17 +0,0 @@ -from pathlib import Path - -from setuptools import setup - -# This is where you add any fancy path resolution to the local lib: -geos_geomecha_path: str = ( Path( __file__ ).parent.parent / "geos-geomechanics" ).as_uri() -geos_utils_path: str = ( Path( __file__ ).parent.parent / "geos-utils" ).as_uri() - -setup( install_requires=[ - "vtk >= 9.3", - "numpy >= 1.26", - "pandas >= 2.2", - "typing_extensions >= 4.12", - "types-setuptools >= 78.1.0", - f"geos-geomechanics @ {geos_geomecha_path}", - f"geos-utils @ {geos_utils_path}", -] ) diff --git a/geos-timehistory/pyproject.toml b/geos-timehistory/pyproject.toml index 0a2694817..d9da1cac4 100644 --- a/geos-timehistory/pyproject.toml +++ b/geos-timehistory/pyproject.toml @@ -17,7 +17,12 @@ classifiers = [ ] requires-python = ">=3.9" -dynamic = ["dependencies"] +dependencies = [ + "matplotlib", + "h5py", + "numpy", + "hdf5-wrapper @ file:./hdf5-wrapper", +] [project.scripts] plot-timehistory = "geos.timehistory.plot:main" diff --git a/geos-timehistory/setup.py b/geos-timehistory/setup.py deleted file mode 100644 index cf224cd79..000000000 --- a/geos-timehistory/setup.py +++ /dev/null @@ -1,13 +0,0 @@ -from pathlib import Path -from setuptools import setup - -# This is where you add any fancy path resolution to the local lib: -package_name = "hdf5-wrapper" -geos_utils_path: str = ( Path( __file__ ).parent.parent / package_name ).as_uri() - -setup( install_requires=[ - "matplotlib", - "h5py", - "numpy", - f"{package_name} @ {geos_utils_path}", -] )