TNO Intern

Commit 68cb08af authored by Hen Brett's avatar Hen Brett 🐔
Browse files

Merge branch '37-write-a-function-which-plots-the-results-of-a-pythermogis-run' into 'main'

Resolve "write a function which plots the results of a pythermogis run"

Closes #37

See merge request AGS/pythermogis!39
parents 36968946 4f6f6b34
Loading
Loading
Loading
Loading
+29 −0
Original line number Diff line number Diff line
@@ -236,6 +236,35 @@ results = calculate_doublet_performance(input_data, utc_properties=utc_propertie
print(results)
```

### plotting the results of a pythermoigs simulation
It is expected that the user knows how to plot using matplotlib and xarrays, such that they can make plots of the inputs and outputs to suit their needs.
That being said, a plotting function is provided which will produce a plot of a results DataSet, provided it either:
 - has dimensions = ["p_value"] and processes more than 1 p_value
 - has dimensions = ["p_value", "x", "y"], in which case the results will be plotted as maps
Check out the definition of `plot_doublet_performance_results` for more details.

```python
from pythermogis import calculate_doublet_performance, instantiate_utc_properties_builder, plot_doublet_performance_results
import xarray as xr

input_data = xr.Dataset({
    "thickness_mean": ((), 300),
    "thickness_sd": ((), 50),
    "ntg": ((), 0.5),
    "porosity": ((), 0.5),
    "depth": ((), 5000),
    "ln_permeability_mean": ((), 5),
    "ln_permeability_sd": ((), 0.5),
})

utc_properties = instantiate_utc_properties_builder().setUseHeatPump(True).build()
results = calculate_doublet_performance(input_data, utc_properties=utc_properties)
plot_doublet_performance_results(results, outfile = "path/to/outfile")

```



## ThermoGIS Scenario Configuration Files

If you have a valid configuration file, you can parse a utc_properties class using the method: `instantiate_utc_properties_from_xml`.
+2 −2
Original line number Diff line number Diff line
@@ -2293,8 +2293,8 @@ packages:
  timestamp: 1740946648058
- pypi: .
  name: pythermogis
  version: 0.1.26
  sha256: 9b1767ad9ca9e30a6ce1446b7fc61351f08f4bb2048143ce754d7e848911b850
  version: 0.1.27
  sha256: 476b714058c996bda97b090a03da3514ff9d217f532bce8487e59c76fa952d62
  requires_dist:
  - jpype1>=1.5.2,<2
  - xarray==2024.9.0.*
+1 −1
Original line number Diff line number Diff line
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "pythermogis"
version = "0.1.26"
version = "0.1.27"
description = "This repository is used as a python API for the ThermoGIS Doublet simulations"
authors = [
    { name = "Hen Brett", email = "hen.brett@tno.nl" },
+2 −1
Original line number Diff line number Diff line
from thermogis_classes.doublet import *
from thermogis_classes.utc_properties import *
from plotting.plot_doublet_performance_results import plot_doublet_performance_results
 No newline at end of file
+0 −0

Empty file added.

Loading