From 87b96c0faff0148afe5b722b1ca79fd250e1c049 Mon Sep 17 00:00:00 2001 From: Paloma Martinez <104762252+paloma-martinez@users.noreply.github.com> Date: Fri, 14 Nov 2025 17:19:44 +0100 Subject: [PATCH 1/4] Move pyvista tools --- docs/geos-posp.rst | 2 - docs/geos_mesh_docs/utils.rst | 12 ++++- docs/geos_posp_docs/modules.rst | 7 --- docs/geos_posp_docs/pyvistaTools.rst | 13 ------ .../src/geos/mesh/utils/pyvistaTools.py | 46 ++++++++++--------- 5 files changed, 36 insertions(+), 44 deletions(-) delete mode 100644 docs/geos_posp_docs/modules.rst delete mode 100644 docs/geos_posp_docs/pyvistaTools.rst rename geos-posp/src/geos_posp/pyvistaTools/pyvistaUtils.py => geos-mesh/src/geos/mesh/utils/pyvistaTools.py (73%) diff --git a/docs/geos-posp.rst b/docs/geos-posp.rst index 19e5c205..5445d0ea 100644 --- a/docs/geos-posp.rst +++ b/docs/geos-posp.rst @@ -7,6 +7,4 @@ GEOS Post-Processing tools ./geos_posp_docs/home.rst - ./geos_posp_docs/modules.rst - ./geos_posp_docs/visualization.rst diff --git a/docs/geos_mesh_docs/utils.rst b/docs/geos_mesh_docs/utils.rst index 31f83c3f..4ab64428 100644 --- a/docs/geos_mesh_docs/utils.rst +++ b/docs/geos_mesh_docs/utils.rst @@ -46,4 +46,14 @@ geos.mesh.utils.multiblockModifiers module .. automodule:: geos.mesh.utils.multiblockModifiers :members: :undoc-members: - :show-inheritance: \ No newline at end of file + :show-inheritance: + + + +geos.mesh.utils.pyvistaTools module +----------------------------------------------- + +.. automodule:: geos.mesh.utils.pyvistaTools.pyvistaTools + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/geos_posp_docs/modules.rst b/docs/geos_posp_docs/modules.rst deleted file mode 100644 index a87e24eb..00000000 --- a/docs/geos_posp_docs/modules.rst +++ /dev/null @@ -1,7 +0,0 @@ -Processing -========== - -.. toctree:: - :maxdepth: 5 - - pyvistaTools diff --git a/docs/geos_posp_docs/pyvistaTools.rst b/docs/geos_posp_docs/pyvistaTools.rst deleted file mode 100644 index d9a4a40f..00000000 --- a/docs/geos_posp_docs/pyvistaTools.rst +++ /dev/null @@ -1,13 +0,0 @@ -pyvistaTools -============ - -This packages defines utilities using pyvista. - - -geos_posp.pyvistaTools.pyvistaUtils module ------------------------------------------------ - -.. automodule:: geos_posp.pyvistaTools.pyvistaUtils - :members: - :undoc-members: - :show-inheritance: \ No newline at end of file diff --git a/geos-posp/src/geos_posp/pyvistaTools/pyvistaUtils.py b/geos-mesh/src/geos/mesh/utils/pyvistaTools.py similarity index 73% rename from geos-posp/src/geos_posp/pyvistaTools/pyvistaUtils.py rename to geos-mesh/src/geos/mesh/utils/pyvistaTools.py index 7c17e3ef..79e636f3 100644 --- a/geos-posp/src/geos_posp/pyvistaTools/pyvistaUtils.py +++ b/geos-mesh/src/geos/mesh/utils/pyvistaTools.py @@ -1,7 +1,7 @@ # SPDX-License-Identifier: Apache-2.0 # SPDX-FileCopyrightText: Copyright 2023-2024 TotalEnergies. # SPDX-FileContributor: Martin Lemay -from typing import Optional, Union, cast +from typing import Optional, Union import numpy as np import numpy.typing as npt @@ -16,9 +16,8 @@ from geos.mesh.utils.arrayHelpers import ( getAttributeValuesAsDF, computeCellCenterCoordinates ) from geos.mesh.utils.arrayModifiers import transferPointDataToCellData -__doc__ = r""" +__doc__ = """ This module contains utilities to process meshes using pyvista. - """ @@ -31,14 +30,14 @@ def loadDataSet( """Load the data using pyvista and extract properties from horizontal slice. Args: - reader (pv.PVDReader): pyvista pvd reader - timeStepIndexes (list[int]): list of time step indexes to load. - elevation (float): elevation (m) of horizontal slice - properties (tuple[str]): list of properties to extract + reader (pv.PVDReader): Pyvista pvd reader. + timeStepIndexes (list[int]): List of time step indexes to load. + elevation (float): Elevation (m) of horizontal slice. + properties (tuple[str]): List of properties to extract. Returns: - tuple[dict[str, pd.DataFrame], npt.NDArray[np.float64]]: tuple containing - a dictionnary with times as keys and dataframe with properties as + tuple[dict[str, pd.DataFrame], npt.NDArray[np.float64]]: Tuple containing + a dictionary with times as keys and dataframe with properties as values, and an array with cell center coordinates of the slice. """ @@ -46,7 +45,8 @@ def loadDataSet( surface: vtkPolyData timeValues: list[ float ] = reader.time_values for index in timeStepIndexes: - assert index < len( timeValues ), "Time step index is out of range." + if index >= len( timeValues ): + raise IndexError( "Time step index is out of range." ) time: float = timeValues[ index ] reader.set_active_time_value( time ) @@ -54,23 +54,27 @@ def loadDataSet( volMesh: Optional[ Union[ pv.MultiBlock, pv.UnstructuredGrid ] ] = getBlockByName( inputMesh, GeosDomainNameEnum.VOLUME_DOMAIN_NAME.value ) - assert volMesh is not None, "Volumic mesh was not found." + if not volMesh: + raise AttributeError( "Volumic mesh was not found." ) # Merge volume block mergedMesh: pv.UnstructuredGrid = volMesh.combine( merge_points=True ) if isinstance( volMesh, pv.MultiBlock ) else volMesh - assert mergedMesh is not None, "Merged mesh is undefined." + if not mergedMesh: + raise ValueError( "Merged mesh is undefined." ) - # extract data + # Extract data surface = extractSurfaceFromElevation( mergedMesh, elevation ) - # transfer point data to cell center - surface = cast( vtkPolyData, transferPointDataToCellData( surface ) ) + # Transfer point data to cell center + surface = vtkPolyData.SafeDownCast( transferPointDataToCellData( surface ) ) timeToPropertyMap[ str( time ) ] = getAttributeValuesAsDF( surface, properties ) - # get cell center coordinates - assert surface is not None, "Surface are undefined." + # Get cell center coordinates + if not surface: + raise ValueError( "Surface are undefined." ) pointsCoords: vtkDataArray = computeCellCenterCoordinates( surface ) - assert pointsCoords is not None, "Cell center are undefined." + if not pointsCoords: + raise ValueError( "Cell center are undefined." ) pointsCoordsNp: npt.NDArray[ np.float64 ] = vnp.vtk_to_numpy( pointsCoords ) return ( timeToPropertyMap, pointsCoordsNp ) @@ -93,14 +97,14 @@ def getBlockByName( multiBlockMesh: Union[ pv.MultiBlock, pv.UnstructuredGrid ], mesh: Optional[ Union[ pv.MultiBlock, pv.UnstructuredGrid ] ] for i, mbMesh in enumerate( multiBlockMesh ): - # if one of the block of multiBlockMesh is the volumic mesh, + # If one of the block of multiBlockMesh is the volumic mesh, # then save the mesh and break if multiBlockMesh.get_block_name( i ) == blockName: mesh = mbMesh break - # else look at its internal mesh(es) + # Else look at its internal mesh(es) mesh = getBlockByName( mbMesh, blockName ) - # if mesh is not None, it is the searched one + # If mesh is not None, it is the searched one if mesh is not None: break return mesh From 5e1381113fa219124b673b2c73af76ffc028a304 Mon Sep 17 00:00:00 2001 From: Paloma Martinez <104762252+paloma-martinez@users.noreply.github.com> Date: Fri, 14 Nov 2025 17:26:35 +0100 Subject: [PATCH 2/4] fix doc --- docs/geos_mesh_docs/utils.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/geos_mesh_docs/utils.rst b/docs/geos_mesh_docs/utils.rst index 4ab64428..7c15213c 100644 --- a/docs/geos_mesh_docs/utils.rst +++ b/docs/geos_mesh_docs/utils.rst @@ -53,7 +53,7 @@ geos.mesh.utils.multiblockModifiers module geos.mesh.utils.pyvistaTools module ----------------------------------------------- -.. automodule:: geos.mesh.utils.pyvistaTools.pyvistaTools +.. automodule:: geos.mesh.utils.pyvistaTools :members: :undoc-members: :show-inheritance: From 12a3b9ac93a8c676abdbcae9c9a3f17fb6403921 Mon Sep 17 00:00:00 2001 From: Paloma Martinez <104762252+paloma-martinez@users.noreply.github.com> Date: Mon, 17 Nov 2025 16:27:36 +0100 Subject: [PATCH 3/4] Removing geos-posp --- docs/index.rst | 2 - geos-posp/pyproject.toml | 93 ------------------- geos-posp/src/geos_posp/__init__.py | 0 geos-posp/src/geos_posp/py.typed | 0 .../src/geos_posp/pyvistaTools/__init__.py | 0 install_packages.sh | 1 - 6 files changed, 96 deletions(-) delete mode 100644 geos-posp/pyproject.toml delete mode 100644 geos-posp/src/geos_posp/__init__.py delete mode 100644 geos-posp/src/geos_posp/py.typed delete mode 100644 geos-posp/src/geos_posp/pyvistaTools/__init__.py diff --git a/docs/index.rst b/docs/index.rst index b7175f8d..3f7b66d5 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -86,8 +86,6 @@ Packages geos-mesh - geos-posp - geos-processing geos-pv diff --git a/geos-posp/pyproject.toml b/geos-posp/pyproject.toml deleted file mode 100644 index e1c05a89..00000000 --- a/geos-posp/pyproject.toml +++ /dev/null @@ -1,93 +0,0 @@ -[build-system] -requires = ["setuptools>=61.2", "wheel >= 0.37.1"] -build-backend = "setuptools.build_meta" - -[tool.setuptools] -include-package-data = true - -[tool.setuptools.packages.find] -where = ["src"] -include = ["geos_posp*"] -exclude = ['tests*'] - -[project] -name = "geos-posp" -version = "1.0.0" -description = "The Python package geos-posp is dedicated to post-process data from the geos simulation tool." -authors = [{name = "GEOS Contributors" }] -maintainers = [{name = "Alexandre Benedicto", email = "alexandre.benedicto@external.totalenergies.com" }, - {name = "Romain Baville", email = "romain.baville@external.totalenergies.com" }, - {name = "Paloma Martinez", email = "paloma.martinez@external.totalenergies.com" }] -license = {text = "Apache-2.0"} -classifiers = [ - "Intended Audience :: Developers", - "Development Status :: 4 - Beta", - "License :: OSI Approved :: Apache Software License ", - "Natural Language :: English", - "Operating System :: OS Independent", - "Programming Language :: Python :: 3 :: Only", - "Topic :: Scientific/Engineering :: Visualization", -] -keywords = [ - "GEOS", - "Simulation", -] - -requires-python = ">= 3.10" - -dependencies = [ - "geos-geomechanics", - "geos-utils", - "geos-mesh", - "geos-processing", - "vtk >= 9.3", - "numpy >= 2.2", - "pandas >= 2.2", - "typing_extensions >= 4.12", -] - - -[project.urls] -Homepage = "https://github.com/GEOS-DEV/geosPythonPackages" -Documentation = "https://geosx-geosx.readthedocs-hosted.com/projects/geosx-geospythonpackages/en/latest/" -Repository = "https://github.com/GEOS-DEV/geosPythonPackages.git" -"Bug Tracker" = "https://github.com/GEOS-DEV/geosPythonPackages/issues" - -[project.optional-dependencies] -build = [ - "build ~= 1.2" -] -dev = [ - "mypy", - "yapf", -] -test = [ - "pytest-cov", - "pytest" -] - -[tool.bumpversion] -current_version = "1.0.0" - -[[tool.bumpversion.files]] -filename = "pyproject.toml" -search = 'version = "{current_version}"' - -[tool.pytest.ini_options] -addopts = "--import-mode=importlib" -console_output_style = "count" -pythonpath = [".", "src"] -python_classes = "Test" -python_files = "test*.py" -python_functions = "test*" -testpaths = ["tests"] -norecursedirs = "bin" -filterwarnings = [] - -[tool.coverage.run] -branch = true -source = ["geos-posp"] -omit = [ - "*/pyvistaUtils/*", - "*/visu/*", -] \ No newline at end of file diff --git a/geos-posp/src/geos_posp/__init__.py b/geos-posp/src/geos_posp/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/geos-posp/src/geos_posp/py.typed b/geos-posp/src/geos_posp/py.typed deleted file mode 100644 index e69de29b..00000000 diff --git a/geos-posp/src/geos_posp/pyvistaTools/__init__.py b/geos-posp/src/geos_posp/pyvistaTools/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/install_packages.sh b/install_packages.sh index b6726ef7..bc6b6a13 100755 --- a/install_packages.sh +++ b/install_packages.sh @@ -3,7 +3,6 @@ python -m pip install --upgrade ./geos-utils python -m pip install --upgrade ./geos-geomechanics python -m pip install --upgrade ./geos-mesh python -m pip install --upgrade ./geos-processing -python -m pip install --upgrade ./geos-posp python -m pip install --upgrade ./geos-xml-tools python -m pip install --upgrade ./geos-xml-viewer python -m pip install --upgrade ./hdf5-wrapper From b22679ee16f2617ee1d35dcd0ffe018c0cd29008 Mon Sep 17 00:00:00 2001 From: Paloma Martinez <104762252+paloma-martinez@users.noreply.github.com> Date: Mon, 17 Nov 2025 16:57:41 +0100 Subject: [PATCH 4/4] Removing geos-posp from ci --- .github/workflows/README.md | 8 +++---- .github/workflows/python-package.yml | 33 +++++++++++++--------------- .github/workflows/typing-check.yml | 2 +- docs/conf.py | 2 +- geos-pv/requirements.txt | 1 - 5 files changed, 21 insertions(+), 25 deletions(-) diff --git a/.github/workflows/README.md b/.github/workflows/README.md index 1ac7d02a..3f823457 100644 --- a/.github/workflows/README.md +++ b/.github/workflows/README.md @@ -22,7 +22,7 @@ Tests each Python package independently to ensure: - `geos-ats` - Automated Testing System for GEOS - `geos-geomechanics` - Geomechanics analysis tools - `geos-mesh` - Mesh conversion and validation tools -- `geos-posp` - Post-processing utilities +- `geos-processing` - Post-processing utilities - `geos-timehistory` - Time history analysis - `geos-trame` - Trame-based visualization - `geos-utils` - Utility functions @@ -62,7 +62,7 @@ build: ```yaml check_integration_label: - Checks for 'test-geos-integration' label - + check_force_integration_label: - Checks for 'force-geos-integration' label ``` @@ -141,7 +141,7 @@ Tests that geosPythonPackages integrates correctly with GEOS by: - Patches script to search `/usr/local/bin/` for pip-installed tools - Installs Python packages via the GEOS setup script - Creates symlinks to tools in `bin_direct/` -- **Validates**: +- **Validates**: - ✅ Python packages install correctly - ✅ Scripts are findable and linkable - ✅ All required tools are available @@ -262,7 +262,7 @@ Tests are automatically skipped when changes only affect: #### Non-Integrated Packages - `geos-geomechanics/` - Standalone geomechanics tools -- `geos-posp/` - Post-processing utilities +- `geos-processing/` - Post-processing utilities - `geos-pv/` - ParaView utilities - `geos-timehistory/` - Time history analysis - `geos-trame/` - Trame visualization diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 10d5e513..9c668d1b 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -58,12 +58,11 @@ jobs: max-parallel: 3 matrix: python-version: ["3.10","3.11","3.12"] - package-name: + package-name: - geos-ats - geos-utils - geos-geomechanics - geos-mesh - - geos-posp - geos-processing - geos-timehistory - geos-trame @@ -78,8 +77,6 @@ jobs: dependencies: "geos-utils geos-geomechanics" - package-name: geos-processing dependencies: "geos-utils geos-mesh geos-geomechanics" - - package-name: geos-posp - dependencies: "geos-utils geos-mesh geos-geomechanics geos-processing" - package-name: pygeos-tools dependencies: "geos-utils geos-mesh" - package-name: geos-timehistory @@ -92,11 +89,11 @@ jobs: with: python-version: ${{ matrix.python-version }} cache: 'pip' - + - name: Install OSMesa and GL run: | sudo apt-get update - sudo apt-get install -y libosmesa6 + sudo apt-get install -y libosmesa6 sudo apt-get install -y \ libegl1-mesa-dev \ libgles2-mesa-dev \ @@ -151,7 +148,7 @@ jobs: echo "Label '${{ env.LABEL_TEST_GEOS_INTEGRATION }}' found" fi echo "has_label=$LABEL_FOUND" >> $GITHUB_OUTPUT - + check_force_integration_label: runs-on: ubuntu-latest needs: [build] @@ -281,11 +278,11 @@ jobs: echo "required=false" >> "$GITHUB_OUTPUT" echo "skip_reason=no-geos-integrated-changes" >> "$GITHUB_OUTPUT" fi - + geos_ci_dispatch: name: Dispatch cases of GEOS CI runs-on: ubuntu-latest - outputs: + outputs: is_GEOS_CI_skipped: ${{ steps.dispatch.outputs.skipped }} fwd_geos_integration_required: ${{ steps.dispatch.outputs.fwd_geos_integration_required }} fwd_skip_reason: ${{ steps.dispatch.outputs.skip_reason }} @@ -298,23 +295,23 @@ jobs: HAS_TEST_LABEL="${{ needs.check_integration_label.outputs.has_geos_integration_label }}" HAS_FORCE_LABEL="${{ needs.check_force_integration_label.outputs.has_geos_integration_force_label }}" SKIP_REASON="${{ needs.check_geos_integration_required.outputs.skip_reason }}" - + echo "fwd_geos_integration_required=${GEOS_REQUIRED}" >> "$GITHUB_OUTPUT" echo "fwd_skip_reason=${SKIP_REASON}" >> "$GITHUB_OUTPUT" - + echo "=== GEOS Integration Dispatch ===" echo "GEOS Required (by file changes): ${GEOS_REQUIRED}" echo "Has '${{ env.LABEL_TEST_GEOS_INTEGRATION }}' label: ${HAS_TEST_LABEL}" echo "Has '${{ env.LABEL_FORCE_GEOS_INTEGRATION }}' label: ${HAS_FORCE_LABEL}" echo "" - + # Case 1: Force label - always run tests if [[ "$HAS_FORCE_LABEL" == "true" ]]; then echo "✓ '${{ env.LABEL_FORCE_GEOS_INTEGRATION }}' label present - forcing GEOS integration tests" echo "skipped=false" >> "$GITHUB_OUTPUT" exit 0 fi - + # Case 2: GEOS required AND test label present - run tests if [[ "$GEOS_REQUIRED" == "true" && "$HAS_TEST_LABEL" == "true" ]]; then echo "✓ GEOS integration required and '${{ env.LABEL_TEST_GEOS_INTEGRATION }}' label present" @@ -322,7 +319,7 @@ jobs: echo "skipped=false" >> "$GITHUB_OUTPUT" exit 0 fi - + # Case 3: GEOS required BUT test label missing - ERROR if [[ "$GEOS_REQUIRED" == "true" && "$HAS_TEST_LABEL" == "false" ]]; then echo "✗ ERROR: GEOS integration is required but '${{ env.LABEL_TEST_GEOS_INTEGRATION }}' label is missing" @@ -334,7 +331,7 @@ jobs: echo "Action required: Add the '${{ env.LABEL_TEST_GEOS_INTEGRATION }}' label to this PR" exit 1 fi - + # Case 4: GEOS NOT required BUT test label present - SKIP TESTS if [[ "$GEOS_REQUIRED" == "false" && "$HAS_TEST_LABEL" == "true" ]]; then echo "⊘ SKIPPED: '${{ env.LABEL_TEST_GEOS_INTEGRATION }}' label present but GEOS integration is not required" @@ -348,7 +345,7 @@ jobs: echo "skipped=true" >> "$GITHUB_OUTPUT" exit 0 fi - + # Case 5: GEOS NOT required AND no labels - SKIP TESTS if [[ "$GEOS_REQUIRED" == "false" && "$HAS_TEST_LABEL" == "false" ]]; then echo "⊘ GEOS integration not required and no labels present" @@ -357,7 +354,7 @@ jobs: echo "skipped=true" >> "$GITHUB_OUTPUT" exit 0 fi - + # Should never reach here echo "✗ ERROR: Unexpected state in dispatch logic" exit 1 @@ -383,7 +380,7 @@ jobs: GEOS_REQUIRED="${{ needs.geos_ci_dispatch.outputs.fwd_geos_integration_required }}" SKIP_REASON="${{ needs.geos_ci_dispatch.outputs.fwd_skip_reason }}" - + GEOS_RESULT="${{ needs.geos_integration_test.result }}" if [[ "$GEOS_REQUIRED" == "true" ]]; then diff --git a/.github/workflows/typing-check.yml b/.github/workflows/typing-check.yml index 0a00276d..2cd6a7c9 100644 --- a/.github/workflows/typing-check.yml +++ b/.github/workflows/typing-check.yml @@ -16,7 +16,7 @@ jobs: max-parallel: 3 matrix: # add packages to check typing - package-name: ["geos-geomechanics", "geos-posp", "geos-processing", "geos-timehistory", "geos-utils", "geos-trame", "geos-xml-tools", "hdf5-wrapper"] + package-name: ["geos-geomechanics", "geos-processing", "geos-timehistory", "geos-utils", "geos-trame", "geos-xml-tools", "hdf5-wrapper"] steps: - uses: actions/checkout@v4 diff --git a/docs/conf.py b/docs/conf.py index 7f9197b0..79fc5152 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -17,7 +17,7 @@ # Add python modules to be documented python_root = '..' -python_modules = ( 'geos-ats', 'geos-geomechanics', 'geos-mesh', 'geos-posp', 'geos-processing', 'geos-pv', 'geos-timehistory', +python_modules = ( 'geos-ats', 'geos-geomechanics', 'geos-mesh', 'geos-processing', 'geos-pv', 'geos-timehistory', 'geos-utils', 'geos-xml-tools', 'geos-xml-viewer', 'hdf5-wrapper', 'pygeos-tools' ) diff --git a/geos-pv/requirements.txt b/geos-pv/requirements.txt index 6ec1b5a9..f17109a7 100644 --- a/geos-pv/requirements.txt +++ b/geos-pv/requirements.txt @@ -1,5 +1,4 @@ geos-geomechanics geos-mesh -geos-posp geos-utils geos-processing \ No newline at end of file