-
Notifications
You must be signed in to change notification settings - Fork 0
feat: Harmonize XML tools in repository (with geos-xml-viewer) #120
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
alexbenedicto
wants to merge
36
commits into
main
Choose a base branch
from
benedicto/cleanup/harmonize_geos_xml_tools
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+2,937
−19,897
Open
Changes from all commits
Commits
Show all changes
36 commits
Select commit
Hold shift + click to select a range
f377617
Move geos-xml-viewer to geos-xml-tools
alexbenedicto 3214856
Update geos-xml-tools based scripts + test them
alexbenedicto c9b94a7
Move testCellLocator to geos-mesh as test_cell_locator
alexbenedicto 8ab37b9
Move write_wells to geos-xml-tools base functionalities
alexbenedicto fad6ed8
Remove non XML related scripts
alexbenedicto 48eb6df
Remove geosDeckReader vtk algorithm to be replaced by functionalities…
alexbenedicto 97f2c98
Remove unused code
alexbenedicto 29a42bf
Remove xsdata dependency
alexbenedicto 09c2381
yapf formatting
alexbenedicto 3e3d655
Test vtk_builder
alexbenedicto da76610
Update main.py to have access to new functionalities
alexbenedicto 37d039a
Change GEOSX to GEOS
alexbenedicto 31cf392
Better handling functions
alexbenedicto 2007fd2
Add copyrights
alexbenedicto 298d8f3
Remove write_wells because hardcoded and not used
alexbenedicto bfd01b9
Fix for mypy
alexbenedicto ec72d93
Ruff checking + yapf formatting
alexbenedicto 8a44c4c
Improve __doc__ for each file
alexbenedicto 5beb9a4
Update sphinx documentation
alexbenedicto e09e536
Avoid setting an invalid wd if an error happens in process
alexbenedicto 27f093d
Remove test_deckSource.py because is a duplicate of test_vtk_builder.py
alexbenedicto b45e0d3
Fix test isolation that would make other tests fail in the repo
alexbenedicto f6c4367
Remove duplication and fix format in test_xml_processor
alexbenedicto e941b39
Better handling of file generation anc deletion when running test_vtk…
alexbenedicto 19e6b30
Allow default region creation for VTKMesh
alexbenedicto e4ba82a
Update conf.py
alexbenedicto a2c8ea4
Add command line documentation
alexbenedicto 0f61ba5
Remove pyvista_viewer that is redundant with geos-trame
alexbenedicto dc668d1
Better naming in docs
alexbenedicto dd0db36
Remove pyvista_viewer test
alexbenedicto 20834d7
Move deckReader to geos-pv as PVGeosDeckReader
alexbenedicto ead7e5e
Remove pyvista_viewer command lines
alexbenedicto 6ef2dc2
Move doc of PVGeosDeckReader to geos-pv-docs
alexbenedicto 505e2e6
Improve geos_xml_tools_docs
alexbenedicto 653d230
yapf
alexbenedicto b6f9c48
Merge remote-tracking branch 'origin/main' into benedicto/cleanup/har…
alexbenedicto File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,82 +1,24 @@ | ||
|
||
.. _XMLToolsPackage: | ||
|
||
GEOS XML Tools | ||
-------------------------- | ||
|
||
The `geos-xml-tools` python package adds a set of advanced features to the GEOS xml format: units, parameters, and symbolic expressions. | ||
See :ref:`PythonToolsSetup` for details on setup instructions, and `Advanced XML Features <https://geosx-geosx.readthedocs-hosted.com/en/latest/coreComponents/fileIO/doc/InputXMLFiles.html#advanced-xml-features>`_ for a detailed description of the input format. | ||
The available console scripts for this package and its API are described below. | ||
|
||
|
||
convert_abaqus | ||
^^^^^^^^^^^^^^ | ||
|
||
Convert an abaqus format mesh file to gmsh or vtk format. | ||
|
||
.. argparse:: | ||
:module: geos.xml_tools.command_line_parsers | ||
:func: build_preprocessor_input_parser | ||
:prog: preprocess_xml | ||
|
||
|
||
format_xml | ||
^^^^^^^^^^^^^^ | ||
|
||
Formats an xml file. | ||
|
||
.. argparse:: | ||
:module: geos.xml_tools.command_line_parsers | ||
:func: build_xml_formatter_input_parser | ||
:prog: format_xml | ||
|
||
|
||
check_xml_attribute_coverage | ||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
Checks xml attribute coverage for files in the GEOS repository. | ||
|
||
.. argparse:: | ||
:module: geos.xml_tools.command_line_parsers | ||
:func: build_attribute_coverage_input_parser | ||
:prog: check_xml_attribute_coverage | ||
|
||
|
||
check_xml_redundancy | ||
^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
Checks for redundant attribute definitions in an xml file, such as those that duplicate the default value. | ||
|
||
.. argparse:: | ||
:module: geos.xml_tools.command_line_parsers | ||
:func: build_xml_redundancy_input_parser | ||
:prog: check_xml_redundancy | ||
|
||
==================== | ||
|
||
API | ||
^^^ | ||
**geos-xml-tools** is a Python package that adds advanced features to the GEOS XML format, including units, parameters, and symbolic expressions. | ||
|
||
.. automodule:: geos.xml_tools.main | ||
:members: | ||
See :ref:`PythonToolsSetup` for setup instructions, and `Advanced XML Features <https://geosx-geosx.readthedocs-hosted.com/en/latest/coreComponents/fileIO/doc/InputXMLFiles.html#advanced-xml-features>`_ for a detailed description of the input format. | ||
|
||
.. automodule:: geos.xml_tools.xml_processor | ||
:members: | ||
.. toctree:: | ||
:maxdepth: 1 | ||
:caption: Contents: | ||
|
||
.. automodule:: geos.xml_tools.xml_formatter | ||
:members: | ||
./geos_xml_tools_docs/command_line_interface | ||
|
||
.. automodule:: geos.xml_tools.unit_manager | ||
:members: | ||
./geos_xml_tools_docs/preprocess | ||
|
||
.. automodule:: geos.xml_tools.regex_tools | ||
:members: | ||
./geos_xml_tools_docs/format_xml | ||
|
||
.. automodule:: geos.xml_tools.xml_redundancy_check | ||
:members: | ||
./geos_xml_tools_docs/check_xml_attribute_coverage | ||
|
||
.. automodule:: geos.xml_tools.attribute_coverage | ||
:members: | ||
./geos_xml_tools_docs/check_xml_redundancy | ||
|
||
.. automodule:: geos.xml_tools.table_generator | ||
:members: | ||
./geos_xml_tools_docs/vtk_builder | ||
|
||
./geos_xml_tools_docs/api |
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
PVGeosDeckReader | ||
================ | ||
|
||
Overview | ||
-------- | ||
- `PVGeosDeckReader` is a Python-based Paraview reader that allows users to open GEOS XML files and create mesh objects for visualization and analysis. | ||
- The plugin is implemented in `PVGeosDeckReader.py` and registered as `PythonGeosDeckReader` in Paraview. | ||
- It outputs a `vtkPartitionedDataSetCollection` representing the mesh and associated regions as defined in the XML file. | ||
|
||
Key Features | ||
------------ | ||
- **Direct XML loading**: Open GEOS XML input files (`.xml`) in Paraview as native datasets. | ||
- **Region support**: The reader uses the `Region` attribute (or a user-specified attribute) to organize mesh data. | ||
- **Integration with GEOS workflows**: Enables direct inspection and analysis of simulation input decks without conversion steps. | ||
|
||
How to Use | ||
---------- | ||
1. Install the geos-pv package and ensure Paraview is set up to use Python plugins. | ||
2. In Paraview, load the plugin (typically via the Python Plugin Manager or by specifying the path to `PVGeosDeckReader.py`). | ||
3. Use the "Open" dialog in Paraview to select a GEOS XML file. Choose the `PythonGeosDeckReader` when prompted. | ||
4. The mesh and regions defined in the XML will be loaded as a multi-block dataset for visualization and further processing. | ||
|
||
Technical Details | ||
----------------- | ||
- The plugin is implemented as a subclass of `VTKPythonAlgorithmBase` and uses the `create_vtk_deck` function from geos-xml-tools to build the VTK data structure. | ||
- The plugin exposes a `FileName` property for selecting the XML file and can be extended to support additional attributes or options. | ||
|
||
Example | ||
------- | ||
.. code-block:: console | ||
|
||
paraview --python-script=path/to/PVGeosDeckReader.py | ||
# Or load via the Paraview GUI | ||
|
||
# In Paraview: | ||
# File > Open > select input.xml > choose PythonGeosDeckReader | ||
|
||
.. note:: | ||
This plugin is intended for users who want to inspect or debug GEOS input decks visually, or to prepare data for further Paraview-based workflows. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
API | ||
=== | ||
|
||
.. automodule:: geos.xml_tools.main | ||
:members: | ||
|
||
.. automodule:: geos.xml_tools.xml_processor | ||
:members: | ||
|
||
.. automodule:: geos.xml_tools.xml_formatter | ||
:members: | ||
|
||
.. automodule:: geos.xml_tools.unit_manager | ||
:members: | ||
|
||
.. automodule:: geos.xml_tools.regex_tools | ||
:members: | ||
|
||
.. automodule:: geos.xml_tools.xml_redundancy_check | ||
:members: | ||
|
||
.. automodule:: geos.xml_tools.attribute_coverage | ||
:members: | ||
|
||
.. automodule:: geos.xml_tools.table_generator | ||
:members: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
Check for attribute coverage | ||
============================ | ||
|
||
Analyzes how well a project's XML files cover the possibilities defined in an XML Schema Definition (.xsd) file. | ||
|
||
This tool parses the schema, scans XML files in the specified directory, and generates a report showing which attributes are used, their values, and their default values from the schema. | ||
Useful for identifying missing or underused attributes in a codebase. | ||
|
||
Example | ||
------- | ||
.. code-block:: console | ||
|
||
geos-xml-tools coverage -r /path/to/geos/root -o coverage_report.xml | ||
|
||
|
||
.. argparse:: | ||
:module: geos.xml_tools.command_line_parsers | ||
:func: build_attribute_coverage_input_parser | ||
:prog: check_xml_attribute_coverage |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
Check redundancy | ||
================ | ||
|
||
Checks for redundant attribute definitions in XML files, such as those that duplicate default values or are otherwise unnecessary. | ||
|
||
This tool scans XML files in the specified directory and reports attributes that are defined but do not differ from their defaults, helping to clean up and simplify XML configurations. | ||
|
||
Example | ||
------- | ||
.. code-block:: console | ||
|
||
geos-xml-tools redundancy -r /path/to/geos/root | ||
|
||
|
||
.. argparse:: | ||
:module: geos.xml_tools.command_line_parsers | ||
:func: build_xml_redundancy_input_parser | ||
:prog: check_xml_redundancy |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not write the doc in the PVGeosDeckReader.py as for the other plugins ?