idaholab / FORCE

The Framework for Optimization of ResourCes and Economics is a collection of software tools, models, and datasets acquired and developed under the Integrated Energy Systems (IES) program to enable analysis of technical and economic viability of myriad IES configurations. FORCE is the consolidating interface and data repository for all the IES toolsets ranging from macro technoeconomic analysis to transient process modeling and experimental validation for integrated energy systems.
MIT License
6 stars 13 forks source link

[TASK] Replacing ET with TreeStructure for xml parsing #28

Open caleb-sitton-inl opened 1 month ago

caleb-sitton-inl commented 1 month ago

Issue Description

Is your feature request related to a problem? Please describe. The exclusive use of xml.etree.ElementTree (ET) in parsing input files may in the future lead to bugs or limit functionality if other non-xml trees are used for input.

Describe the solution you'd like Replacement of the ET parsing with the broader TreeStructure module in RAVEN (RAVEN/ravenframework/utils/TreeStructure.py) will limit future difficulties. Not all ET functions are available in TreeStructure, and naming of functions differs, so more than a simple find-and-replace will be necessary. One such ET function, used in FORCE/tests/unit-tests/test_heron.py, that has no counterpart in TreeStructure, is ET.fromstring(). This function parses a string with xml formatting into ET structure and is particularly useful for unit tests.

Describe alternatives you've considered


For Change Control Board: Issue Review

This review should occur before any development is performed as a response to this issue.


For Change Control Board: Issue Closure

This review should occur when the issue is imminently going to be closed.

dylanjm commented 1 month ago

@caleb-sitton-inl I may not understand fully, but from your description, it sounds like we should continue using ET over TreeStructure so we have access to all the functions provided by ET. It seems to me that we should rather rely on a python native library as much as we can before using an in-house wrapper. Also, it appears that ET seems to be used more widespread throughout RAVEN and HERON.

@PaulTalbot-INL @GabrielSoto-INL Thoughts?

PaulTalbot-INL commented 1 month ago

We did discuss this a little on a PR. While using ET is a great way to determine how the XML is used, as we look to use EDDI formats as well (with Workbench for .heron files), we may need to consider the more agnostic approach. I agree, for now ET is just fine.