TNO Intern

Commit 4ceb56e5 authored by Hen Brett's avatar Hen Brett 🐔
Browse files

Updating main

parent 8a3b7338
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -39,7 +39,7 @@ Here is an example, where the default utc_properties is used, but the UseHeatPum
`utc_properties` themselves, with the `.build()` method of the `utc_properties_builder`.

```python
from src.pythermogis import calculate_doublet_performance_probabilistic, instantiate_utc_properties_builder
from src.pythermogis import calculate_doublet_performance_stochastic, instantiate_utc_properties_builder
import xarray as xr

input_data = xr.Dataset({
@@ -53,7 +53,7 @@ input_data = xr.Dataset({
})

utc_properties = instantiate_utc_properties_builder().setUseHeatPump(True).build()
results = calculate_doublet_performance_probabilistic(input_data, utc_properties=utc_properties)
results = calculate_doublet_performance_stochastic(input_data, utc_properties=utc_properties)
print(results)
```

@@ -67,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_probabilistic, instantiate_utc_properties_from_xml
from src.pythermogis import calculate_doublet_performance_stochastic, instantiate_utc_properties_from_xml
import xarray as xr

input_data = xr.Dataset({
@@ -81,7 +81,7 @@ input_data = xr.Dataset({
})

utc_properties = instantiate_utc_properties_from_xml("path/to/valid/xml/file")
results = calculate_doublet_performance_probabilistic(input_data, utc_properties=utc_properties)
results = calculate_doublet_performance_stochastic(input_data, utc_properties=utc_properties)
print(results)
```
+6 −6
Original line number Diff line number Diff line
@@ -16,7 +16,7 @@ for a single location. The outcomes correspond to the mean values of the input p
and the results are printed to the console.

```python 
from src.pythermogis import calculate_doublet_performance_probabilistic
from src.pythermogis import calculate_doublet_performance_stochastic
import xarray as xr

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

results = calculate_doublet_performance_probabilistic(input_data)
results = calculate_doublet_performance_stochastic(input_data)
print(results)
```

@@ -42,7 +42,7 @@ for a user defined 2-d grid of locations. The outcomes correspond to the mean va
and the results are printed to the console

```python
from src.pythermogis import calculate_doublet_performance_probabilistic
from src.pythermogis import calculate_doublet_performance_stochastic
import xarray as xr
import numpy as np

@@ -56,7 +56,7 @@ input_data = xr.Dataset({
    "ln_permeability_sd": (("x", "y"), np.array([[0.5, 0.5], [0.75, 0.75]])),
}, coords={"x": [0, 1], "y": [10, 20]})

results = calculate_doublet_performance_probabilistic(input_data)
results = calculate_doublet_performance_stochastic(input_data)
print(results)
```

@@ -71,7 +71,7 @@ run a deterministic doublet simulation using the `calculate_doublet_performance`
    Example input data for some of these examples is available in the `/resources/example_data` directory

```python
from src.pythermogis import calculate_doublet_performance_probabilistic
from src.pythermogis import calculate_doublet_performance_stochastic
from pygridsio import read_grid

input_grids = read_grid("thickness.zmap").to_dataset(name="thickness_mean")
@@ -83,7 +83,7 @@ input_grids["mask"] = read_grid("hydrocarbons.zmap")
input_grids["ln_permeability_mean"] = read_grid("ln_perm.zmap")
input_grids["ln_permeability_sd"] = read_grid("ln_perm_sd.zmap")

results = calculate_doublet_performance_probabilistic(input_grids)
results = calculate_doublet_performance_stochastic(input_grids)
print(results)
x, y = 125e3, 525e3  # define location
results_loc = results.sel(x=x, y=y, method="nearest")
+2 −2
Original line number Diff line number Diff line
@@ -32,7 +32,7 @@ This example corresponds to test case `test_example5` in `test_doc_examples.py`
directory of the repository.

```python
from pythermogis import calculate_doublet_performance_probabilistic, calculate_pos
from pythermogis import calculate_doublet_performance_stochastic, calculate_pos
from pygridsio import read_grid, plot_grid, resample_xarray_grid
from matplotlib import pyplot as plt
import xarray as xr
@@ -64,7 +64,7 @@ reservoir_properties["ln_permeability_sd"] = resample_xarray_grid(read_grid(inpu
if (output_data_path / "output_results.nc").exists and not run_simulation:
    results = xr.load_dataset(output_data_path / "output_results.nc")
else:
    results = calculate_doublet_performance_probabilistic(reservoir_properties, p_values=[10, 20, 30, 40, 50, 60, 70, 80, 90])
    results = calculate_doublet_performance_stochastic(reservoir_properties, p_values=[10, 20, 30, 40, 50, 60, 70, 80, 90])
    results.to_netcdf(output_data_path / "output_results.nc")  # write doublet simulation results to file

# plot results as maps
+2 −2
Original line number Diff line number Diff line
@@ -34,7 +34,7 @@ This example corresponds to test case `test_example6` in `test_doc_examples.py`
directory of the repository.

```python
from pythermogis import calculate_doublet_performance_probabilistic, calculate_pos
from pythermogis import calculate_doublet_performance_stochastic, calculate_pos
from pygridsio import read_grid
from matplotlib import pyplot as plt
import xarray as xr
@@ -65,7 +65,7 @@ for i, (x, y) in enumerate(portfolio_coords):
    locations.append(point)
portfolio_reservoir_properties = xr.concat(locations, dim="location")

results_portfolio = calculate_doublet_performance_probabilistic(portfolio_reservoir_properties, p_values=[10, 20, 30, 40, 50, 60, 70, 80, 90])
results_portfolio = calculate_doublet_performance_stochastic(portfolio_reservoir_properties, p_values=[10, 20, 30, 40, 50, 60, 70, 80, 90])

# post process: clip the npv and calculate the probability of success
AEC = -3.5
+2 −2
Original line number Diff line number Diff line
@@ -17,7 +17,7 @@ This example corresponds to test case `test_example4` in `test_doc_examples.py`
directory of the repository.

```python
from pythermogis import calculate_doublet_performance_probabilistic
from pythermogis import calculate_doublet_performance_stochastic
from matplotlib import pyplot as plt
from pathlib import Path
from os import path
@@ -34,7 +34,7 @@ input_data = xr.Dataset({
    "ln_permeability_mean": ((), 5),
    "ln_permeability_sd": ((), 0.5),
})
results = calculate_doublet_performance_probabilistic(input_data, p_values=[1, 10, 20, 30, 40, 50, 60, 70, 80, 90, 99])
results = calculate_doublet_performance_stochastic(input_data, p_values=[1, 10, 20, 30, 40, 50, 60, 70, 80, 90, 99])
fig, axe = plt.subplots(figsize=(10, 5))
kh = results.transmissivity_with_ntg * 1.0
kh.plot(y="p_value", ax=axe)
Loading