From 6ca7d21d56eeca25192ec8e24f02ab833816a004 Mon Sep 17 00:00:00 2001 From: Paloma Martinez <104762252+paloma-martinez@users.noreply.github.com> Date: Wed, 29 Oct 2025 16:54:16 +0100 Subject: [PATCH 1/2] DBG --- docs/geos_posp_docs/PVplugins.rst | 4 --- docs/geos_pv_docs/processing.rst | 6 ++++ docs/geos_pv_docs/pyplotUtils.rst | 2 +- .../src/geos/pv/plugins}/PVMohrCirclePlot.py | 33 ++++++++++++------- .../geos/pv/utils}/mohrCircles/__init__.py | 0 .../utils}/mohrCircles/functionsMohrCircle.py | 0 .../pv/utils}/mohrCircles/mainMohrCircles.py | 0 .../pv/utils}/mohrCircles/plotMohrCircles.py | 0 8 files changed, 28 insertions(+), 17 deletions(-) rename {geos-posp/src/PVplugins => geos-pv/src/geos/pv/plugins}/PVMohrCirclePlot.py (96%) rename {geos-posp/src/geos_posp/visu => geos-pv/src/geos/pv/utils}/mohrCircles/__init__.py (100%) rename {geos-posp/src/geos_posp/visu => geos-pv/src/geos/pv/utils}/mohrCircles/functionsMohrCircle.py (100%) rename {geos-posp/src/geos_posp/visu => geos-pv/src/geos/pv/utils}/mohrCircles/mainMohrCircles.py (100%) rename {geos-posp/src/geos_posp/visu => geos-pv/src/geos/pv/utils}/mohrCircles/plotMohrCircles.py (100%) diff --git a/docs/geos_posp_docs/PVplugins.rst b/docs/geos_posp_docs/PVplugins.rst index 8f41728b..63a1e91e 100644 --- a/docs/geos_posp_docs/PVplugins.rst +++ b/docs/geos_posp_docs/PVplugins.rst @@ -58,10 +58,6 @@ PVGeomechanicsWorkflowVolumeWell plugin .. automodule:: PVplugins.PVGeomechanicsWorkflowVolumeWell -PVMohrCirclePlot plugin ---------------------------------- - -.. automodule:: PVplugins.PVMohrCirclePlot PVplugins.PVSurfaceGeomechanics module -------------------------------------- diff --git a/docs/geos_pv_docs/processing.rst b/docs/geos_pv_docs/processing.rst index 7b3753b6..9a321d98 100644 --- a/docs/geos_pv_docs/processing.rst +++ b/docs/geos_pv_docs/processing.rst @@ -25,6 +25,12 @@ PVGeomechanicsCalculator plugin .. automodule:: geos.pv.plugins.PVGeomechanicsCalculator +PVMohrCirclePlot plugin +--------------------------------- + +.. automodule:: PVplugins.PVMohrCirclePlot + + PVSplitMesh ---------------------------------- diff --git a/docs/geos_pv_docs/pyplotUtils.rst b/docs/geos_pv_docs/pyplotUtils.rst index 6b2b36c4..155eea78 100644 --- a/docs/geos_pv_docs/pyplotUtils.rst +++ b/docs/geos_pv_docs/pyplotUtils.rst @@ -10,4 +10,4 @@ geos.pv.pyplotUtils.matplotlibOptions module .. automodule:: geos.pv.pyplotUtils.matplotlibOptions :members: :undoc-members: - :show-inheritance: \ No newline at end of file + :show-inheritance: diff --git a/geos-posp/src/PVplugins/PVMohrCirclePlot.py b/geos-pv/src/geos/pv/plugins/PVMohrCirclePlot.py similarity index 96% rename from geos-posp/src/PVplugins/PVMohrCirclePlot.py rename to geos-pv/src/geos/pv/plugins/PVMohrCirclePlot.py index 5a04106c..b8f23800 100644 --- a/geos-posp/src/PVplugins/PVMohrCirclePlot.py +++ b/geos-pv/src/geos/pv/plugins/PVMohrCirclePlot.py @@ -2,8 +2,8 @@ # SPDX-FileCopyrightText: Copyright 2023-2024 TotalEnergies. # SPDX-FileContributor: Alexandre Benedicto, Martin Lemay # ruff: noqa: E402 # disable Module level import not at top of file -import os import sys +from pathlib import Path from enum import Enum from typing import Any, Union, cast @@ -22,15 +22,14 @@ vtkUnstructuredGrid, ) -dir_path = os.path.dirname( os.path.realpath( __file__ ) ) -parent_dir_path = os.path.dirname( dir_path ) -if parent_dir_path not in sys.path: - sys.path.append( parent_dir_path ) +# update sys.path to load all GEOS Python Package dependencies +geos_pv_path: Path = Path( __file__ ).parent.parent.parent.parent.parent +sys.path.insert( 0, str( geos_pv_path / "src" ) ) +from geos.pv.utils.config import update_paths + +update_paths() -import PVplugins # noqa: F401 -import geos_posp.visu.mohrCircles.functionsMohrCircle as mcf -import geos_posp.visu.PVUtils.paraviewTreatments as pvt from geos.geomechanics.model.MohrCircle import MohrCircle from geos.utils.enumUnits import Pressure, enumerationDomainUnit from geos.utils.GeosOutputsConstants import ( @@ -45,11 +44,20 @@ ) from geos.mesh.utils.arrayHelpers import getArrayInObject from geos.mesh.utils.multiblockModifiers import mergeBlocks -from geos_posp.visu.PVUtils.checkboxFunction import ( # type: ignore[attr-defined] + + +# import geos_posp.visu.mohrCircles.functionsMohrCircle as mcf +import geos.pv.utils.mohrCircles.functionsMohrCircle as mcf +# import geos_posp.visu.PVUtils.paraviewTreatments as pvt +import geos.pv.utils.paraviewTreatments as pvt +from geos.pv.utils.checkboxFunction import ( # type: ignore[attr-defined] +# from geos_posp.visu.PVUtils.checkboxFunction import ( # type: ignore[attr-defined] createModifiedCallback, ) -from geos_posp.visu.PVUtils.DisplayOrganizationParaview import ( +# from geos_posp.visu.PVUtils.DisplayOrganizationParaview import ( +from geos.pv.utils.DisplayOrganizationParaview import ( buildNewLayoutWithPythonView, ) -from geos_posp.visu.PVUtils.matplotlibOptions import ( +# from geos_posp.visu.PVUtils.matplotlibOptions import ( +from geos.pv.pyplotUtils.matplotlibOptions import ( FontStyleEnum, FontWeightEnum, LegendLocationEnum, @@ -84,7 +92,8 @@ @smproxy.filter( name="PVMohrCirclePlot", label="Plot Mohr's Circles" ) @smhint.xml( """ - + # + """ ) @smproperty.input( name="Input", port_index=0 ) diff --git a/geos-posp/src/geos_posp/visu/mohrCircles/__init__.py b/geos-pv/src/geos/pv/utils/mohrCircles/__init__.py similarity index 100% rename from geos-posp/src/geos_posp/visu/mohrCircles/__init__.py rename to geos-pv/src/geos/pv/utils/mohrCircles/__init__.py diff --git a/geos-posp/src/geos_posp/visu/mohrCircles/functionsMohrCircle.py b/geos-pv/src/geos/pv/utils/mohrCircles/functionsMohrCircle.py similarity index 100% rename from geos-posp/src/geos_posp/visu/mohrCircles/functionsMohrCircle.py rename to geos-pv/src/geos/pv/utils/mohrCircles/functionsMohrCircle.py diff --git a/geos-posp/src/geos_posp/visu/mohrCircles/mainMohrCircles.py b/geos-pv/src/geos/pv/utils/mohrCircles/mainMohrCircles.py similarity index 100% rename from geos-posp/src/geos_posp/visu/mohrCircles/mainMohrCircles.py rename to geos-pv/src/geos/pv/utils/mohrCircles/mainMohrCircles.py diff --git a/geos-posp/src/geos_posp/visu/mohrCircles/plotMohrCircles.py b/geos-pv/src/geos/pv/utils/mohrCircles/plotMohrCircles.py similarity index 100% rename from geos-posp/src/geos_posp/visu/mohrCircles/plotMohrCircles.py rename to geos-pv/src/geos/pv/utils/mohrCircles/plotMohrCircles.py From 1e0c1d95c9ced04c1d8b5942cff2ebd5419d7c83 Mon Sep 17 00:00:00 2001 From: Paloma Martinez <104762252+paloma-martinez@users.noreply.github.com> Date: Mon, 3 Nov 2025 16:50:32 +0100 Subject: [PATCH 2/2] Fix import after moving files --- docs/geos_posp_docs/visu.PVUtils.rst | 37 ------ docs/geos_posp_docs/visualization.rst | 9 -- .../mohrCircles.rst} | 8 +- docs/geos_pv_docs/utilities.rst | 2 + geos-pv/examples/PVproxyWidgetsDynamic.py | 2 +- .../utils/mohrCircles/functionsMohrCircle.py | 2 +- .../pv/utils/mohrCircles/mainMohrCircles.py | 4 +- .../pv/utils/mohrCircles/plotMohrCircles.py | 4 +- geos-pv/tests/testsFunctionsGeosLogReader.py | 116 +++++++++--------- .../tests/testsGeosLogReaderConvergence.py | 2 +- geos-pv/tests/testsGeosLogReaderFlow.py | 2 +- geos-pv/tests/testsGeosLogReaderWells.py | 2 +- geos-pv/tests/testsInvalidLogs.py | 8 +- 13 files changed, 77 insertions(+), 121 deletions(-) delete mode 100644 docs/geos_posp_docs/visu.PVUtils.rst delete mode 100644 docs/geos_posp_docs/visualization.rst rename docs/{geos_posp_docs/visu.mohrCircles.rst => geos_pv_docs/mohrCircles.rst} (62%) diff --git a/docs/geos_posp_docs/visu.PVUtils.rst b/docs/geos_posp_docs/visu.PVUtils.rst deleted file mode 100644 index 6603a216..00000000 --- a/docs/geos_posp_docs/visu.PVUtils.rst +++ /dev/null @@ -1,37 +0,0 @@ -PVUtils Package -=============== - -This packages consists of utilities for Paraview. - - -geos_posp.visu.PVUtils.DisplayOrganizationParaview module ------------------------------------------------------------- - -.. automodule:: geos_posp.visu.PVUtils.DisplayOrganizationParaview - :members: - :undoc-members: - :show-inheritance: - -geos_posp.visu.PVUtils.checkboxFunction module -------------------------------------------------- - -.. automodule:: geos_posp.visu.PVUtils.checkboxFunction - :members: - :undoc-members: - :show-inheritance: - -geos_posp.visu.PVUtils.paraviewTreatments module ---------------------------------------------------- - -.. automodule:: geos_posp.visu.PVUtils.paraviewTreatments - :members: - :undoc-members: - :show-inheritance: - -geos_posp.visu.PVUtils.matplotlibOptions module ----------------------------------------------------------- - -.. automodule:: geos_posp.visu.PVUtils.matplotlibOptions - :members: - :undoc-members: - :show-inheritance: \ No newline at end of file diff --git a/docs/geos_posp_docs/visualization.rst b/docs/geos_posp_docs/visualization.rst deleted file mode 100644 index f63db3ec..00000000 --- a/docs/geos_posp_docs/visualization.rst +++ /dev/null @@ -1,9 +0,0 @@ -Visualization -============= - -.. toctree:: - :maxdepth: 4 - - PVplugins - - visu \ No newline at end of file diff --git a/docs/geos_posp_docs/visu.mohrCircles.rst b/docs/geos_pv_docs/mohrCircles.rst similarity index 62% rename from docs/geos_posp_docs/visu.mohrCircles.rst rename to docs/geos_pv_docs/mohrCircles.rst index 30e9a721..4a72b422 100644 --- a/docs/geos_posp_docs/visu.mohrCircles.rst +++ b/docs/geos_pv_docs/mohrCircles.rst @@ -3,18 +3,18 @@ Mohr's Circle Package This package includes utilities to compute and plot Mohr's Circles using the Python View from Paraview. -geos_posp.visu.mohrCircles.functionsMohrCircle module +geos.pv.utils.mohrCircles.functionsMohrCircle module -------------------------------------------------------- -.. automodule:: geos_posp.visu.mohrCircles.functionsMohrCircle +.. automodule:: geos.pv.utils.mohrCircles.functionsMohrCircle :members: :undoc-members: :show-inheritance: -geos_posp.visu.mohrCircles.plotMohrCircles module +geos.pv.utils.mohrCircles.plotMohrCircles module -------------------------------------------------- -.. automodule:: geos_posp.visu.mohrCircles.plotMohrCircles +.. automodule:: geos.pv.utils.mohrCircles.plotMohrCircles :members: :undoc-members: :show-inheritance: diff --git a/docs/geos_pv_docs/utilities.rst b/docs/geos_pv_docs/utilities.rst index 052d49e6..c3d83c45 100644 --- a/docs/geos_pv_docs/utilities.rst +++ b/docs/geos_pv_docs/utilities.rst @@ -11,3 +11,5 @@ Utilities pythonViewUtils utils + + mohrCircles diff --git a/geos-pv/examples/PVproxyWidgetsDynamic.py b/geos-pv/examples/PVproxyWidgetsDynamic.py index 257d05dd..b0e6d81b 100644 --- a/geos-pv/examples/PVproxyWidgetsDynamic.py +++ b/geos-pv/examples/PVproxyWidgetsDynamic.py @@ -16,7 +16,7 @@ from geos.pv.utils.paraviewTreatments import ( strListToEnumerationDomainXml, strEnumToEnumerationDomainXml, getArrayChoices ) -from geos_posp.visu.PVUtils.checkboxFunction import ( # type: ignore[attr-defined] +from geos.pv.utils.checkboxFunction import ( # type: ignore[attr-defined] createModifiedCallback, ) from vtkmodules.util.vtkAlgorithm import VTKPythonAlgorithmBase diff --git a/geos-pv/src/geos/pv/utils/mohrCircles/functionsMohrCircle.py b/geos-pv/src/geos/pv/utils/mohrCircles/functionsMohrCircle.py index 0d4042e3..a4f56481 100644 --- a/geos-pv/src/geos/pv/utils/mohrCircles/functionsMohrCircle.py +++ b/geos-pv/src/geos/pv/utils/mohrCircles/functionsMohrCircle.py @@ -9,7 +9,7 @@ from geos.geomechanics.model.MohrCircle import MohrCircle from geos.geomechanics.model.MohrCoulomb import MohrCoulomb -from geos_posp.visu.mohrCircles import ( +from geos.pv.utils.mohrCircles import ( MOHR_CIRCLE_ANALYSIS_MAIN, MOHR_CIRCLE_PATH, ) diff --git a/geos-pv/src/geos/pv/utils/mohrCircles/mainMohrCircles.py b/geos-pv/src/geos/pv/utils/mohrCircles/mainMohrCircles.py index 7eb27a13..8b341d7f 100644 --- a/geos-pv/src/geos/pv/utils/mohrCircles/mainMohrCircles.py +++ b/geos-pv/src/geos/pv/utils/mohrCircles/mainMohrCircles.py @@ -7,8 +7,8 @@ import matplotlib.pyplot as plt from paraview import python_view - import geos_posp.visu.mohrCircles.functionsMohrCircle as mcf - import geos_posp.visu.mohrCircles.plotMohrCircles as pmc + import geos.pv.utils.mohrCircles.functionsMohrCircle as mcf + import geos.pv.utils.mohrCircles.plotMohrCircles as pmc plt.close() diff --git a/geos-pv/src/geos/pv/utils/mohrCircles/plotMohrCircles.py b/geos-pv/src/geos/pv/utils/mohrCircles/plotMohrCircles.py index d7c21c6c..37ecf022 100644 --- a/geos-pv/src/geos/pv/utils/mohrCircles/plotMohrCircles.py +++ b/geos-pv/src/geos/pv/utils/mohrCircles/plotMohrCircles.py @@ -15,8 +15,8 @@ from matplotlib.figure import Figure # type: ignore[import-untyped] from matplotlib.lines import Line2D # type: ignore[import-untyped] -import geos_posp.visu.mohrCircles.functionsMohrCircle as mcf -from geos_posp.visu.PVUtils.matplotlibOptions import ( +import geos.pv.utils.mohrCircles.functionsMohrCircle as mcf +from geos.pv.pyplotUtils.matplotlibOptions import ( FontStyleEnum, FontWeightEnum, LegendLocationEnum, diff --git a/geos-pv/tests/testsFunctionsGeosLogReader.py b/geos-pv/tests/testsFunctionsGeosLogReader.py index 24f9f8d2..cd615d15 100644 --- a/geos-pv/tests/testsFunctionsGeosLogReader.py +++ b/geos-pv/tests/testsFunctionsGeosLogReader.py @@ -15,7 +15,7 @@ if parent_dir_path not in sys.path: sys.path.append( parent_dir_path ) -from geos_posp.processing import geosLogReaderFunctions as utils +from geos.pv import geosLogReaderFunctions as lrf from geos.utils.enumUnits import Unit, getSIUnits @@ -25,14 +25,14 @@ def test_replaceSpecialCharactersWithWhitespace( self: Self ) -> None: """Test replaceSpecialCharactersWithWhitespace function.""" example: str = "hi '(_there(''&*$^,:;'" expected: str = "hi there " - obtained: str = utils.replaceSpecialCharactersWithWhitespace( example ) + obtained: str = lrf.replaceSpecialCharactersWithWhitespace( example ) self.assertEqual( expected, obtained ) def test_formatPropertyName( self: Self ) -> None: """Test formatPropertyName function.""" example: str = " Delta pressure min" expected: str = "DeltaPressureMin" - obtained: str = utils.formatPropertyName( example ) + obtained: str = lrf.formatPropertyName( example ) self.assertEqual( expected, obtained ) def test_extractRegion( self: Self ) -> None: @@ -40,7 +40,7 @@ def test_extractRegion( self: Self ) -> None: example: str = ( "Adding Object CellElementRegion named Reservoir from" " ObjectManager::Catalog." ) expected: str = "Reservoir" - obtained: str = utils.extractRegion( example ) + obtained: str = lrf.extractRegion( example ) self.assertEqual( expected, obtained ) def test_extractStatsName( self: Self ) -> None: @@ -48,7 +48,7 @@ def test_extractStatsName( self: Self ) -> None: example: str = ( "compflowStatistics, Reservoir: Pressure (min, average, max): " "2.86419e+07, 2.93341e+07, 3.006e+07 Pa" ) expected: str = "compflowStatistics" - obtained: str = utils.extractStatsName( example ) + obtained: str = lrf.extractStatsName( example ) self.assertEqual( expected, obtained ) def test_extractPhaseModel( self: Self ) -> None: @@ -56,7 +56,7 @@ def test_extractPhaseModel( self: Self ) -> None: example: str = ( " TableFunction: " "fluid_phaseModel1_PhillipsBrineDensity_table" ) expected: str = "PhillipsBrineDensity" - obtained: str = utils.extractPhaseModel( example ) + obtained: str = lrf.extractPhaseModel( example ) self.assertEqual( expected, obtained ) def test_buildPropertiesNameForPhases( self: Self ) -> None: @@ -64,7 +64,7 @@ def test_buildPropertiesNameForPhases( self: Self ) -> None: example_block: str = " Mobile phase mass" example_phases: list[ str ] = [ "CO2", "Water" ] expected: list[ str ] = [ " Mobile CO2 mass", " Mobile Water mass" ] - obtained: list[ str ] = utils.buildPropertiesNameForPhases( example_block, example_phases ) + obtained: list[ str ] = lrf.buildPropertiesNameForPhases( example_block, example_phases ) self.assertEqual( expected, obtained ) def test_buildPropertiesNameForComponents( self: Self ) -> None: @@ -76,7 +76,7 @@ def test_buildPropertiesNameForComponents( self: Self ) -> None: "Dissolved mass CO2 in Water", "Dissolved mass Water in Water", ] - obtained: list[ str ] = utils.buildPropertiesNameForComponents( example ) + obtained: list[ str ] = lrf.buildPropertiesNameForComponents( example ) self.assertEqual( expected, obtained ) def test_buildPropertiesNameNoPhases( self: Self ) -> None: @@ -84,14 +84,14 @@ def test_buildPropertiesNameNoPhases( self: Self ) -> None: example_name_block: str = " Delta pressure " example_extensions: str = "min, max)" expected: list[ str ] = [ " Delta pressure min", " Delta pressure max" ] - obtained: list[ str ] = utils.buildPropertiesNameNoPhases( example_name_block, example_extensions ) + obtained: list[ str ] = lrf.buildPropertiesNameNoPhases( example_name_block, example_extensions ) self.assertEqual( expected, obtained ) def test_buildPropertiesNameNoPhases2( self: Self ) -> None: """Test buildPropertiesNameNoPhases function.""" example: str = " Delta pressure " expected: list[ str ] = [ " Delta pressure " ] - obtained: list[ str ] = utils.buildPropertiesNameNoPhases( example ) + obtained: list[ str ] = lrf.buildPropertiesNameNoPhases( example ) self.assertEqual( expected, obtained ) def test_buildPropertiesNameFromGeosProperties( self: Self ) -> None: @@ -99,17 +99,17 @@ def test_buildPropertiesNameFromGeosProperties( self: Self ) -> None: examples_phases: list[ str ] = [ "CO2", "Water" ] example: str = " Pressure (min, average, max)" expected: list[ str ] = [ " Pressure min", " Pressure average", " Pressure max" ] - obtained: list[ str ] = utils.buildPropertiesNameFromGeosProperties( example, examples_phases ) + obtained: list[ str ] = lrf.buildPropertiesNameFromGeosProperties( example, examples_phases ) self.assertEqual( expected, obtained ) example = " Total dynamic pore volume" expected = [ " Total dynamic pore volume" ] - obtained = utils.buildPropertiesNameFromGeosProperties( example, examples_phases ) + obtained = lrf.buildPropertiesNameFromGeosProperties( example, examples_phases ) self.assertEqual( expected, obtained ) example = " Non-trapped phase mass (metric 1)" expected = [ " Non-trapped CO2 mass ", " Non-trapped Water mass " ] - obtained = utils.buildPropertiesNameFromGeosProperties( example, examples_phases ) + obtained = lrf.buildPropertiesNameFromGeosProperties( example, examples_phases ) self.assertEqual( expected, obtained ) example = " Dissolved component mass" @@ -119,7 +119,7 @@ def test_buildPropertiesNameFromGeosProperties( self: Self ) -> None: "Dissolved mass CO2 in Water", "Dissolved mass Water in Water", ] - obtained = utils.buildPropertiesNameFromGeosProperties( example, examples_phases ) + obtained = lrf.buildPropertiesNameFromGeosProperties( example, examples_phases ) self.assertEqual( expected, obtained ) example = " Component mass" @@ -129,7 +129,7 @@ def test_buildPropertiesNameFromGeosProperties( self: Self ) -> None: "Dissolved mass CO2 in Water", "Dissolved mass Water in Water", ] - obtained = utils.buildPropertiesNameFromGeosProperties( example, examples_phases ) + obtained = lrf.buildPropertiesNameFromGeosProperties( example, examples_phases ) self.assertEqual( expected, obtained ) def test_extractPropertiesFlow( self: Self ) -> None: @@ -141,13 +141,13 @@ def test_extractPropertiesFlow( self: Self ) -> None: "Reservoir__TrappedCO2Mass", "Reservoir__TrappedWaterMass", ] - obtained: list[ str ] = utils.extractPropertiesFlow( example_block, examples_phases ) + obtained: list[ str ] = lrf.extractPropertiesFlow( example_block, examples_phases ) self.assertEqual( expected, obtained ) example_block = ( "compflowStatistics, Reservoir: Phase mass:" " { 0, 1.01274e+14 } kg" ) expected = [ "Reservoir__CO2Mass", "Reservoir__WaterMass" ] - obtained = utils.extractPropertiesFlow( example_block, examples_phases ) + obtained = lrf.extractPropertiesFlow( example_block, examples_phases ) self.assertEqual( expected, obtained ) example_block = ( "compflowStatistics, Region1 (time 4320000 s): Pressure" @@ -158,14 +158,14 @@ def test_extractPropertiesFlow( self: Self ) -> None: "Region1__PressureAverage", "Region1__PressureMax", ] - obtained = utils.extractPropertiesFlow( example_block, examples_phases ) + obtained = lrf.extractPropertiesFlow( example_block, examples_phases ) self.assertEqual( expected, obtained ) def test_countNumberLines( self: Self ) -> None: """Test countNumberLines function.""" log1: str = os.path.join( dir_path, "Data/job_GEOS_825200.out" ) expected1: int = 24307 - obtained1: int = utils.countNumberLines( log1 ) + obtained1: int = lrf.countNumberLines( log1 ) self.assertEqual( expected1, obtained1 ) def test_extractValuesFlow( self: Self ) -> None: @@ -173,38 +173,38 @@ def test_extractValuesFlow( self: Self ) -> None: example: str = ( "compflowStatistics, Reservoir: Pressure (min, average, max):" " 1.25e+07, 1.25e+07, 1.25e+07 Pa" ) expected: list[ float ] = [ 1.25e07, 1.25e07, 1.25e07 ] - obtained: list[ float ] = utils.extractValuesFlow( example ) + obtained: list[ float ] = lrf.extractValuesFlow( example ) self.assertEqual( expected, obtained ) example = ( "compflowStatistics, Reservoir: Phase dynamic pore volumes:" " { 0, 6.61331e+07 } rm^3" ) expected = [ 0.0, 6.61331e07 ] - obtained = utils.extractValuesFlow( example ) + obtained = lrf.extractValuesFlow( example ) self.assertEqual( expected, obtained ) example = ( "compflowStatistics, Reservoir: Dissolved component mass:" " { { 0, 0 }, { 0, 6.38235e+10 } } kg" ) expected = [ 0.0, 0.0, 0.0, 6.38235e10 ] - obtained = utils.extractValuesFlow( example ) + obtained = lrf.extractValuesFlow( example ) self.assertEqual( expected, obtained ) example = ( "compflowStatistics, Reservoir: Cell fluid mass" " (min, max): 10765.1, 2.2694e+10 kg" ) expected = [ 10765.1, 2.2694e10 ] - obtained = utils.extractValuesFlow( example ) + obtained = lrf.extractValuesFlow( example ) self.assertEqual( expected, obtained ) example = ( "compflowStatistics, Region1 (time 256800000 s): Pressure" " (min, average, max): 10023287.92961521, 10271543.591259222," " 10525096.98374942 Pa" ) expected = [ 10023287.92961521, 10271543.591259222, 10525096.98374942 ] - obtained = utils.extractValuesFlow( example ) + obtained = lrf.extractValuesFlow( example ) self.assertEqual( expected, obtained ) example = ( "compflowStatistics, Region1 (time 4320000 s): Phase dynamic" " pore volume: [0, 799999924.1499865] rm^3" ) expected = [ 0, 799999924.1499865 ] - obtained = utils.extractValuesFlow( example ) + obtained = lrf.extractValuesFlow( example ) self.assertEqual( expected, obtained ) def test_convertValues( self: Self ) -> None: @@ -213,20 +213,20 @@ def test_convertValues( self: Self ) -> None: propertyValues: list[ float ] = [ 1e6, 2e8 ] propertyUnits: dict[ str, Unit ] = getSIUnits() expected: list[ float ] = [ 1e6, 2e8 ] - obtained: list[ float ] = utils.convertValues( propertyNames, propertyValues, propertyUnits ) + obtained: list[ float ] = lrf.convertValues( propertyNames, propertyValues, propertyUnits ) self.assertEqual( expected, obtained ) propertyNames = [ "WellControls__TotalFluidDensity" ] propertyValues = [ 1e4 ] expected = [ 1e4 ] - obtained = utils.convertValues( propertyNames, propertyValues, propertyUnits ) + obtained = lrf.convertValues( propertyNames, propertyValues, propertyUnits ) self.assertEqual( expected, obtained ) def test_extractWell( self: Self ) -> None: """Test extractWell function.""" line = " TableFunction: well.CO2001_ConstantBHP_table" expected = "well.CO2001" - obtained = utils.extractWell( line ) + obtained = lrf.extractWell( line ) self.assertEqual( expected, obtained ) def test_identifyCurrentWell( self: Self ) -> None: @@ -234,52 +234,52 @@ def test_identifyCurrentWell( self: Self ) -> None: lastWellName: str = "well1" line: str = ( "The total rate is 0 kg/s, which corresponds to a" + "total surface volumetric rate of 0 sm3/s" ) expected: str = "well1" - obtained: str = utils.identifyCurrentWell( line, lastWellName ) + obtained: str = lrf.identifyCurrentWell( line, lastWellName ) self.assertEqual( expected, obtained ) line = ( "Rank 18: well.CO2001: BHP (at the specified reference" + " elevation): 19318538.400682557 Pa" ) expected = "well.CO2001" - obtained = utils.identifyCurrentWell( line, lastWellName ) + obtained = lrf.identifyCurrentWell( line, lastWellName ) self.assertEqual( expected, obtained ) line = ( "wellControls1: BHP (at the specified reference" + " elevation): 12337146.157562563 Pa" ) expected = "wellControls1" - obtained = utils.identifyCurrentWell( line, lastWellName ) + obtained = lrf.identifyCurrentWell( line, lastWellName ) self.assertEqual( expected, obtained ) def test_extractWellTags( self: Self ) -> None: """Test extractWellTags function.""" line: str = ( "Rank 18: well.CO2001: BHP " + "(at the specified reference elevation): 193000 Pa" ) expected: list[ str ] = [ "BHP" ] - obtained: list[ str ] = utils.extractWellTags( line ) + obtained: list[ str ] = lrf.extractWellTags( line ) self.assertEqual( expected, obtained ) line = ( "The total rate is 0 kg/s, which corresponds" + " to a total surface volumetric rate of 0 sm3/s" ) expected = [ "total massRate", "total surface volumetricRate" ] - obtained = utils.extractWellTags( line ) + obtained = lrf.extractWellTags( line ) self.assertEqual( expected, obtained ) def test_extractValuesWell( self: Self ) -> None: """Test extractValuesWell function.""" line: str = ( "Rank 18: well.CO2001: BHP " + "(at the specified reference elevation): 193000 Pa" ) expected: list[ float ] = [ 193000.0 ] - obtained: list[ float ] = utils.extractValuesWell( line, 1 ) + obtained: list[ float ] = lrf.extractValuesWell( line, 1 ) self.assertEqual( expected, obtained ) line = ( "The total rate is 0 kg/s, which corresponds" + " to a total surface volumetric rate of 0 sm3/s" ) expected = [ 0.0, 0.0 ] - obtained = utils.extractValuesWell( line, 2 ) + obtained = lrf.extractValuesWell( line, 2 ) self.assertEqual( expected, obtained ) line = "The phase surface volumetric rate is" + " 1.9466968733035026e-12 sm3/s" expected = [ 1.9466968733035026e-12 ] - obtained = utils.extractValuesWell( line, 1 ) + obtained = lrf.extractValuesWell( line, 1 ) self.assertEqual( expected, obtained ) def test_extractAquifer( self: Self ) -> None: """Test extractAquifer function.""" line: str = " TableFunction:aquifer1_pressureInfluence_table" expected: str = "aquifer1" - obtained: str = utils.extractAquifer( line ) + obtained: str = lrf.extractAquifer( line ) self.assertEqual( expected, obtained ) def test_extractValueAndNameAquifer( self: Self ) -> None: @@ -289,7 +289,7 @@ def test_extractValueAndNameAquifer( self: Self ) -> None: " boundary condition 'aquifer1' produces a flux of" + " -0.6181975187076816 kg (or moles if useMass=0)." ) expected: tuple[ str, float ] = ( "aquifer1", -0.6181975187076816 ) - obtained: tuple[ str, float ] = utils.extractValueAndNameAquifer( line ) + obtained: tuple[ str, float ] = lrf.extractValueAndNameAquifer( line ) self.assertEqual( expected, obtained ) line = ( "FlowSolverBase compositionalMultiphaseFVMSolver" + @@ -298,14 +298,14 @@ def test_extractValueAndNameAquifer( self: Self ) -> None: " boundary condition 'Aquifer3' produces a flux of" + " -0.8441759009606705 kg (or moles if useMass=0). " ) expected = ( "Aquifer3", -0.8441759009606705 ) - obtained = utils.extractValueAndNameAquifer( line ) + obtained = lrf.extractValueAndNameAquifer( line ) self.assertEqual( expected, obtained ) def test_extractNewtonIter( self: Self ) -> None: """Test extractNewtonIter function.""" line: str = " Attempt: 2, ConfigurationIter: 1, NewtonIter: 8" expected: int = 8 - obtained: int = utils.extractNewtonIter( line ) + obtained: int = lrf.extractNewtonIter( line ) self.assertEqual( expected, obtained ) def test_extractLinearIter( self: Self ) -> None: @@ -314,7 +314,7 @@ def test_extractLinearIter( self: Self ) -> None: " 5.96636e-05 | Make Restrictor Time: 0 | Compute Auu Time: 0 |" + " SC Filter Time: 0 | Setup Time: 1.5156 s | Solve Time:" + " 0.041093 s" ) expected: int = 23 - obtained: int = utils.extractLinearIter( line ) + obtained: int = lrf.extractLinearIter( line ) self.assertEqual( expected, obtained ) def test_timeInSecond( self: Self ) -> None: @@ -327,56 +327,56 @@ def test_timeInSecond( self: Self ) -> None: "s": 0, } expected: float = 0.0 - obtained: float = utils.timeInSecond( timeCounter ) + obtained: float = lrf.timeInSecond( timeCounter ) self.assertEqual( expected, obtained ) timeCounter = { "years": 1, "days": 1, "hrs": 1, "min": 1, "s": 1 } expected = 31647661.0 - obtained = utils.timeInSecond( timeCounter ) + obtained = lrf.timeInSecond( timeCounter ) self.assertEqual( expected, obtained ) def test_extractTimeAndDt( self: Self ) -> None: """Test extractTimeAndDt function.""" line: str = "Time: 1 s, dt: 1 s, Cycle: 0" expected: tuple[ float, float ] = ( 1.0, 1.0 ) - obtained: tuple[ float, float ] = utils.extractTimeAndDt( line ) + obtained: tuple[ float, float ] = lrf.extractTimeAndDt( line ) self.assertEqual( expected, obtained ) line = "Time: 1s, dt: 1s, Cycle: 0" expected = ( 1.0, 1.0 ) - obtained = utils.extractTimeAndDt( line ) + obtained = lrf.extractTimeAndDt( line ) self.assertEqual( expected, obtained ) line = "Time: 1e5s, dt: 1e6s, Cycle: 0" expected = ( 1.0e5, 1.0e6 ) - obtained = utils.extractTimeAndDt( line ) + obtained = lrf.extractTimeAndDt( line ) self.assertEqual( expected, obtained ) line = "Time: 1 min, dt: 1 s, Cycle: 0" expected = ( 60.0, 1.0 ) - obtained = utils.extractTimeAndDt( line ) + obtained = lrf.extractTimeAndDt( line ) self.assertEqual( expected, obtained ) line = "Time: 1 hrs, dt: 1 s, Cycle: 0" expected = ( 3600.0, 1.0 ) - obtained = utils.extractTimeAndDt( line ) + obtained = lrf.extractTimeAndDt( line ) self.assertEqual( expected, obtained ) line = "Time: 1 days, dt: 1 s, Cycle: 0" expected = ( 86400.0, 1.0 ) - obtained = utils.extractTimeAndDt( line ) + obtained = lrf.extractTimeAndDt( line ) self.assertEqual( expected, obtained ) line = "Time: 1 years, 1 days, 1 hrs, 1 min, 1 s, dt: 1 s, Cycle: 1" expected = ( 31647661.0, 1.0 ) - obtained = utils.extractTimeAndDt( line ) + obtained = lrf.extractTimeAndDt( line ) self.assertEqual( expected, obtained ) def test_identifyProperties( self: Self ) -> None: """Test identifyProperties function.""" properties: list[ str ] = [ "WellControls_TotalFluidDensity" ] expected: list[ str ] = [ "35:WellControls_TotalFluidDensity" ] - obtained: list[ str ] = utils.identifyProperties( properties ) + obtained: list[ str ] = lrf.identifyProperties( properties ) self.assertEqual( expected, obtained ) def test_findNumberPhasesSimulation( self: Self ) -> None: @@ -385,26 +385,26 @@ def test_findNumberPhasesSimulation( self: Self ) -> None: pathToFile: str = os.path.join( dir_path, "Data/" ) filepath: str = os.path.join( pathToFile, filename ) expected: int = 2 - obtained: int = utils.findNumberPhasesSimulation( filepath ) + obtained: int = lrf.findNumberPhasesSimulation( filepath ) self.assertEqual( expected, obtained ) def test_transformUserChoiceToListPhases( self: Self ) -> None: """Test phaseNameBuilder function with 3 phases.""" userChoice: str = "phase0 phase1 phase2" expected: list[ str ] = [ "phase0", "phase1", "phase2" ] - obtained: list[ str ] = utils.transformUserChoiceToListPhases( userChoice ) + obtained: list[ str ] = lrf.transformUserChoiceToListPhases( userChoice ) self.assertEqual( expected, obtained ) userChoice = "phase0, phase1, phase2" expected = [ "phase0", "phase1", "phase2" ] - obtained = utils.transformUserChoiceToListPhases( userChoice ) + obtained = lrf.transformUserChoiceToListPhases( userChoice ) self.assertEqual( expected, obtained ) userChoice = "phase0; phase1; phase2" expected = [] capturedOutput = io.StringIO() with contextlib.redirect_stdout( capturedOutput ): - obtained = utils.transformUserChoiceToListPhases( userChoice ) + obtained = lrf.transformUserChoiceToListPhases( userChoice ) self.assertEqual( expected, obtained ) self.assertGreater( len( capturedOutput.getvalue() ), 0 ) @@ -412,17 +412,17 @@ def test_phaseNamesBuilder( self: Self ) -> None: """Test phaseNameBuilder function with 4 phases.""" phasesFromUser: list[ str ] = [] expected: list[ str ] = [ "phase0", "phase1", "phase2", "phase3" ] - obtained: list[ str ] = utils.phaseNamesBuilder( 4, phasesFromUser ) + obtained: list[ str ] = lrf.phaseNamesBuilder( 4, phasesFromUser ) self.assertEqual( expected, obtained ) phasesFromUser = [ "water", "gas" ] expected = [ "water", "gas", "phase2", "phase3" ] - obtained = utils.phaseNamesBuilder( 4, phasesFromUser ) + obtained = lrf.phaseNamesBuilder( 4, phasesFromUser ) self.assertEqual( expected, obtained ) phasesFromUser = [ "water", "CO2", "N2", "H2", "CH4" ] expected = [ "water", "CO2", "N2", "H2" ] - obtained = utils.phaseNamesBuilder( 4, phasesFromUser ) + obtained = lrf.phaseNamesBuilder( 4, phasesFromUser ) self.assertEqual( expected, obtained ) # TODO def test_extractValuesFromBlockWhenMultipleComponents(self :Self) diff --git a/geos-pv/tests/testsGeosLogReaderConvergence.py b/geos-pv/tests/testsGeosLogReaderConvergence.py index 1c2e2897..c41d2ab9 100644 --- a/geos-pv/tests/testsGeosLogReaderConvergence.py +++ b/geos-pv/tests/testsGeosLogReaderConvergence.py @@ -14,7 +14,7 @@ if parent_dir_path not in sys.path: sys.path.append( parent_dir_path ) -from geos_posp.readers.GeosLogReaderConvergence import GeosLogReaderConvergence +from geos.pv.geosLogReaderUtils.GeosLogReaderConvergence import GeosLogReaderConvergence from geos.utils.UnitRepository import Unit, UnitRepository unitsObjSI: UnitRepository = UnitRepository() diff --git a/geos-pv/tests/testsGeosLogReaderFlow.py b/geos-pv/tests/testsGeosLogReaderFlow.py index 2c9b0ba8..977a1558 100644 --- a/geos-pv/tests/testsGeosLogReaderFlow.py +++ b/geos-pv/tests/testsGeosLogReaderFlow.py @@ -15,7 +15,7 @@ sys.path.append( parent_dir_path ) from geos.utils.UnitRepository import Unit, UnitRepository -from geos_posp.readers.GeosLogReaderFlow import GeosLogReaderFlow +from geos.pv.geosLogReaderUtils.GeosLogReaderFlow import GeosLogReaderFlow unitsObjSI: UnitRepository = UnitRepository() conversionFactors: dict[ str, Unit ] = unitsObjSI.getPropertiesUnit() diff --git a/geos-pv/tests/testsGeosLogReaderWells.py b/geos-pv/tests/testsGeosLogReaderWells.py index ee2b21d7..8d7fe719 100644 --- a/geos-pv/tests/testsGeosLogReaderWells.py +++ b/geos-pv/tests/testsGeosLogReaderWells.py @@ -17,7 +17,7 @@ import pandas as pd # type: ignore[import-untyped] -from geos_posp.readers.GeosLogReaderWells import GeosLogReaderWells +from geos.pv.geosLogReaderUtils.GeosLogReaderWells import GeosLogReaderWells from geos.utils.UnitRepository import Unit, UnitRepository unitsObjSI = UnitRepository() diff --git a/geos-pv/tests/testsInvalidLogs.py b/geos-pv/tests/testsInvalidLogs.py index fb9cce2c..c09e4169 100644 --- a/geos-pv/tests/testsInvalidLogs.py +++ b/geos-pv/tests/testsInvalidLogs.py @@ -15,10 +15,10 @@ if parent_dir_path not in sys.path: sys.path.append( parent_dir_path ) -from geos_posp.readers.GeosLogReaderAquifers import GeosLogReaderAquifers -from geos_posp.readers.GeosLogReaderConvergence import GeosLogReaderConvergence -from geos_posp.readers.GeosLogReaderFlow import GeosLogReaderFlow -from geos_posp.readers.GeosLogReaderWells import GeosLogReaderWells +from geos.pv.geosLogReaderUtils.GeosLogReaderAquifers import GeosLogReaderAquifers +from geos.pv.geosLogReaderUtils.GeosLogReaderConvergence import GeosLogReaderConvergence +from geos.pv.geosLogReaderUtils.GeosLogReaderFlow import GeosLogReaderFlow +from geos.pv.geosLogReaderUtils.GeosLogReaderWells import GeosLogReaderWells from geos.utils.UnitRepository import Unit, UnitRepository unitsObjSI: UnitRepository = UnitRepository()