# Parsing \*.prj with ogstools

**URL:** <https://discourse.opengeosys.org/t/parsing-prj-with-ogstools/1664>\
**Category:** Help & Support\
**Tags:** ogs6\
**Created:** [July 17, 2025, 8:27am UTC](https://discourse.opengeosys.org/t/parsing-prj-with-ogstools/1664 "2025-07-17T08:27:36Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![carlos](https://discourse.opengeosys.org/letter_avatar_proxy/v4/letter/c/ecae2f/32.png) [@carlos](https://discourse.opengeosys.org/u/carlos)\
**Post date:** [July 17, 2025, 8:27am UTC](https://discourse.opengeosys.org/t/parsing-prj-with-ogstools/1664/1 "2025-07-17T08:27:36Z")

</div>

Hi,

is it possible to parse the \*.prj file using ogs tools?

For example, using the TH2M process, get all parameters (i.e parameter values) for the given phases?

Thanks in advance.

Cheers,

Carlos

---

<div class="post-metadata">

**Author:** ![FZill](https://discourse.opengeosys.org/user_avatar/discourse.opengeosys.org/fzill/32/562_2.png) [@FZill](https://discourse.opengeosys.org/u/FZill)\
**Post date:** [July 17, 2025, 9:19am UTC](https://discourse.opengeosys.org/t/parsing-prj-with-ogstools/1664/2 "2025-07-17T09:19:44Z")

</div>

Hi, you can read in a prj with ogs6py (from ogstools) to modify an run said prj file, but it doesn’t yet have the functionality to easily read out all the data. But you can do so with lxml (which ogs6py uses too):  
to read out all parameters:

```python
from lxml import etree as ET
import pandas as pd

tree = ET.parse('/path/to/you/file.prj')
root = tree.getroot()
params = root.xpath('//parameters/parameter')
parameters = [{child.tag: child.text for child in param} for param in params]
columns = list({key for param in parameters for key in param})
param_df = pd.DataFrame(parameters, columns=columns)
display(param_df)

```

or to read out all properties of the different phases:

```python
for phase in ["AqueousLiquid", "Solid"]:
    props = root.xpath(f".//phase[type='{phase}']/properties/property")
    properties = [{child.tag: child.text for child in prop} for prop in props]
    columns = list({key for prop in properties for key in prop})
    prop_df = pd.DataFrame(properties, columns=columns)
    print(phase)
    display(prop_df)

```

The latter won’t collect the information of e.g. Linear properties with independent variables due to the nesting (this code only collect first level children of each property). I hope this helps.  
Best, Florian

---

<div class="post-metadata">

**Author:** ![chleh](https://discourse.opengeosys.org/user_avatar/discourse.opengeosys.org/chleh/32/854_2.png) [@chleh](https://discourse.opengeosys.org/u/chleh)\
**Post date:** [July 17, 2025, 10:54am UTC](https://discourse.opengeosys.org/t/parsing-prj-with-ogstools/1664/3 "2025-07-17T10:54:58Z")

</div>

Hi Carlos,

maybe [`property_dataframe()`](https://ogstools.opengeosys.org/stable/reference/ogstools.ogs6py.html#ogstools.ogs6py.Project.property_dataframe) already contains most of the information you want.

Best regards,  
Christoph

---

<div class="post-metadata">

**Author:** ![carlos](https://discourse.opengeosys.org/letter_avatar_proxy/v4/letter/c/ecae2f/32.png) [@carlos](https://discourse.opengeosys.org/u/carlos)\
**Post date:** [July 17, 2025, 11:08am UTC](https://discourse.opengeosys.org/t/parsing-prj-with-ogstools/1664/4 "2025-07-17T11:08:13Z")

</div>

Thanks. It sure helps!

---

<div class="post-metadata">

**Author:** ![carlos](https://discourse.opengeosys.org/letter_avatar_proxy/v4/letter/c/ecae2f/32.png) [@carlos](https://discourse.opengeosys.org/u/carlos)\
**Post date:** [July 17, 2025, 11:08am UTC](https://discourse.opengeosys.org/t/parsing-prj-with-ogstools/1664/5 "2025-07-17T11:08:35Z")

</div>

I will try it. Thanks as well.

---

<div class="post-metadata">

**Author:** ![carlos](https://discourse.opengeosys.org/letter_avatar_proxy/v4/letter/c/ecae2f/32.png) [@carlos](https://discourse.opengeosys.org/u/carlos)\
**Post date:** [July 17, 2025, 11:52am UTC](https://discourse.opengeosys.org/t/parsing-prj-with-ogstools/1664/6 "2025-07-17T11:52:44Z")

</div>

Hi,

just as a quick observation for the community: this approach will give the medium properties, but in case one needs the properties from the phases (or the components from the phases) one would have to use the approach from @FZill

Cheers,

Carlos
