TNO Intern

Update after java gui refactor

Merge request reports

Loading
+1 −1
Changes for docs/reference/utc_properties.md: 1 added line, 1 removed line.
Original line number Diff line number Diff line
# API Reference

::: pythermogis.thermogis_classes.utc_properties
 No newline at end of file
::: pythermogis.thermogis_classes.properties
 No newline at end of file
+14 −11
Changes for docs/usage/customized_props.md: 14 added lines, 11 removed lines.
Original line number Diff line number Diff line
@@ -3,7 +3,7 @@
To adjust properties of the simulation, you can pass a `utc_properties` instance 
to the calculate_doublet_performance function.
A `utc_properties` instance is a JClass implementation of the Java UTCProperties class. 
It is generated by using the `utc_properties_builder`, upon which custom properties can be set, 
It is generated by using the `thermogis_properties`, upon which custom properties can be set for all calculations in ThermoGIS, 
and used to build an instance of the `utc_properties`.

be aware: The number of parameters is large, and the default values are set to the ThermoGIS base case. 
@@ -11,8 +11,8 @@ A comprehensive list of parameters is given in [UTC properties](../theory/utcpr

There are two ways to set the properties of the simulation, by either:

1. Using the `utc_properties_builder` class to set the properties of the simulation, and then building the `utc_properties` instance.
2. Using the `instantiate_utc_properties_from_xml` function to parse a configuration file, which will return a `utc_properties` instance.
1. Using the `instantiate_thermogis_parameters` class to set the properties of the simulation, and then using the `setupUTCParameters` method.
2. Using the `instantiate_thermogis_properties_from_file` function to parse a configuration file, which will return a `thermogis_properties` method.


!!! info "customizing the thermoGIS techno-economic properties"
@@ -28,18 +28,18 @@ There are two ways to set the properties of the simulation, by either:

Common properties to change include:

- `setUseHeatPump(Boolean)`: if true, include a heat-pump when modelling
- `setUseStimulation(Boolean)`: if true, apply reservoir stimulation when simulating a doublet
- `setUseHeatpump(Boolean)`: if true, include a heat-pump when modelling
- `setUseWellStimulation(Boolean)`: if true, apply reservoir stimulation when simulating a doublet
- `setSurfaceTemperature(float)`: The temperature of the surface
- `setTempGradient(float)`: The gradient at which temperature increases with depth, in C/km
- `setDhReturnTemp(float)`: The goal of the direct heat return temperature
- `setStimKhMax(float)`: The maximum transmissivity above which no stimulation will occur (if UseStimulation = True)

Here is an example, where the default utc_properties is used, but the UseHeatPump option is set to True. this is achievied by instantiating a `utc_properties_builder` class, running `.useHeatPump(True)` on that class, and then building the 
`utc_properties` themselves, with the `.build()` method of the `utc_properties_builder`.
Here is an example, where the default utc_properties is used, but the UseHeatpump option is set to True. this is achievied by instantiating a `thermogis_properties` class, running `.useHeatpump(True)` on that class, and then building the 
`utc_properties` themselves, with the `.setupUTCParameters()` method of the `thermogis_properties`.

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

input_data = xr.Dataset({
@@ -50,7 +50,9 @@ input_data = xr.Dataset({
    "permeability": 300,
})

utc_properties = instantiate_utc_properties_builder().setUseHeatPump(True).build()
tg_parameters = instantiate_thermogis_parameters()
tg_parameters.setUseHeatpump(True)
utc_properties = tg_parameters.setupUTCParameters()
results = calculate_doublet_performance(input_data, utc_properties=utc_properties)
print(results)
```
@@ -65,7 +67,7 @@ The vast majority of the parameters in the xml are not used by this python API;
unfortunately they are still needed in the xml file to enable parsing.

```python
from src.pythermogis import calculate_doublet_performance_stochastic, instantiate_utc_properties_from_xml
from src.pythermogis import calculate_doublet_performance_stochastic, instantiate_thermogis_properties_from_file
import xarray as xr

input_data = xr.Dataset({
@@ -78,7 +80,8 @@ input_data = xr.Dataset({
    "ln_permeability_sd": 0.5,
})

utc_properties = instantiate_utc_properties_from_xml("path/to/valid/xml/file")
tg_properties = instantiate_thermogis_properties_from_file("path/to/valid/xml/file")
utc_properties = tg_properties.setupUTCParameters()
results = calculate_doublet_performance_stochastic(input_data, utc_properties=utc_properties)
print(results)
```
+4 −0
Changes for docs/changelog.md: 4 added lines, 0 removed lines.
Original line number Diff line number Diff line
# Change log

## v2.0.0 (27-2-2026)
After an essential rewrite of the java code, parts of the API of pythermoGIS had to be updated. Since these were breaking, non-backward compatible, changes, a version 2.0.0 is released. 
The most important and noticible change is that the method of setting up the input parameters has changed. Please check out the customized properties page for 

## v1.2.5 (26-1-2026)
A java 17 virtual machine is now automatically installed the first time a pythermogis simulation is run. This uses the [install-jdk](https://pypi.org/project/install-jdk/) python project.

+5 −8
Changes for src/pythermogis/doublet_simulation/deterministic_doublet.py: 5 added lines, 8 removed lines.
Original line number Diff line number Diff line
@@ -9,12 +9,12 @@ from pythermogis.dask_utils.auto_chunk import auto_chunk_dataset
from pythermogis.physics.temperature_grid_calculation import (
    calculate_temperature_from_gradient,
)
from pythermogis.thermogis_classes.utc_properties import (
    instantiate_utc_properties_builder,
from pythermogis.thermogis_classes.properties import (
    instantiate_thermogis_parameters,
)


def calculate_doublet_performance(reservoir_properties: xr.Dataset, utc_properties = None, rng_seed: int = None, chunk_size: int = None, print_execution_duration: bool = False, mask_value: float = np.nan) -> xr.Dataset:
def calculate_doublet_performance(reservoir_properties: xr.Dataset, utc_properties = None, chunk_size: int = None, print_execution_duration: bool = False, mask_value: float = np.nan) -> xr.Dataset:
    """
    Perform a deterministic Doublet performance simulation.

@@ -42,9 +42,6 @@ def calculate_doublet_performance(reservoir_properties: xr.Dataset, utc_properti
    utc_properties : JClass
        A Java class specifying the properties of the doublet being simulated

    rng_seed : int
        Random seed used for stochastic components of the simulation.

    chunk_size : int
        None by default, if set to an integer then chunking of the reservoir properties occurs.
        The chunk size is used to split up the number of simulations into "chunks" which can be processed in parallel using the dask framework.
@@ -90,7 +87,7 @@ def calculate_doublet_performance(reservoir_properties: xr.Dataset, utc_properti
    validate_input(reservoir_properties)

    if utc_properties is None:
        utc_properties = instantiate_utc_properties_builder().build()
        utc_properties = instantiate_thermogis_parameters().setupUTCParameters()

    # If no mask grid is provided, then provide a dummy mask grid with only nan
    if "mask" not in reservoir_properties:
@@ -109,7 +106,7 @@ def calculate_doublet_performance(reservoir_properties: xr.Dataset, utc_properti
        reservoir_properties = auto_chunk_dataset(reservoir_properties, chunk_size)

    output_data = reservoir_properties.copy()
    output_data = simulate_doublet(output_data, reservoir_properties, rng_seed, utc_properties, mask_value=mask_value)
    output_data = simulate_doublet(output_data, reservoir_properties, utc_properties, mask_value=mask_value)

    if chunk_size is not None:
        output_data.load() # If chunking has occurred then the data must be de-chunked
+3 −3
Changes for src/pythermogis/doublet_simulation/stochastic_doublet.py: 3 added lines, 3 removed lines.
Original line number Diff line number Diff line
@@ -7,7 +7,7 @@ from pythermogis import simulate_doublet
from pythermogis.dask_utils.auto_chunk import auto_chunk_dataset
from pythermogis.physics.temperature_grid_calculation import calculate_temperature_from_gradient
from pythermogis.transmissivity.calculate_thick_perm_trans import generate_thickness_permeability_transmissivity_for_pvalues
from pythermogis.thermogis_classes.utc_properties import instantiate_utc_properties_builder
from pythermogis.thermogis_classes.properties import instantiate_thermogis_parameters

def calculate_doublet_performance_stochastic(
        reservoir_properties: xr.Dataset,
@@ -101,7 +101,7 @@ def calculate_doublet_performance_stochastic(
    validate_input_data(reservoir_properties)

    if utc_properties is None: # Instantiate utc_properties if none is provided
        utc_properties = instantiate_utc_properties_builder().build()
        utc_properties = instantiate_thermogis_parameters().setupUTCParameters()

    # convert p_values list to a xarray DataArray; needed to ensure the dimensionality of the calculations
    p_values = xr.DataArray(
@@ -140,7 +140,7 @@ def calculate_doublet_performance_stochastic(
                                                                                                          dask="parallelized",
                                                                                                          )

    output_data = simulate_doublet(output_data, reservoir_properties, rng_seed, utc_properties, mask_value=mask_value)
    output_data = simulate_doublet(output_data, reservoir_properties, utc_properties, mask_value=mask_value)
    if chunk_size is not None: output_data.load() # If chunking has occurred then the data must be de-chunked
    if print_execution_duration: print(f"Doublet simulation took {timeit.default_timer() - start:.1f} seconds")
    return output_data
Loading
Loading