Deterministic doublet
Deterministic Doublet Performance Calculations¶
This is a simple example of how to run a deterministic (without uncertainty quantification) doublet performance calculation.
xarray is at the heart of data handling in pythermogis
Xarray is a very powerfull tool. Pythermogis is build using xarray, and leverages its powers. For basic 1D usage, no xarray knowledge is required. For 2D the Aquifer class expects xarray DataArrays. For more information on how to use xarray, see the xarray documentation.
π§ͺ Basic 1D Example¶
This example demonstrates how to run a deterministic doublet simulation using the Aquifer and ThermoGISDoublet classes for a single location. The outcomes are deterministic, meaning there is no stochastic sampling or probabilities associated with this simulation, the results are printed to the console.
from pythermogis.aquifer import Aquifer
from pythermogis.doublet import ThermoGISDoublet
def test_example_1():
aquifer = Aquifer(
thickness=300, ntg=0.5, porosity=0.2, depth=2000, permeability=300
)
results = ThermoGISDoublet(aquifer=aquifer).simulate().to_dataset()
print(results)
π 2D Grid Example¶
This example demonstrates how a deterministic doublet simulation using the Aquifer and ThermoGISDoublet classes for a a user defined 2-d grid of locations. The outcomes are deterministic, meaning there is no stochastic sampling or probabilities associated with this simulation, the results are printed to the console.
from pythermogis.aquifer import Aquifer
from pythermogis.doublet import ThermoGISDoublet
import numpy as np
import xarray as xr
input_dataset = xr.Dataset(
{
"thickness": (("x", "y"), np.array([[300, 300], [200, 200]])),
"ntg": (("x", "y"), np.array([[0.5, 0.5], [0.25, 0.25]])),
"porosity": (("x", "y"), np.array([[0.2, 0.2], [0.3, 0.3]])),
"depth": (("x", "y"), np.array([[5000, 5000], [4500, 4500]])),
"permeability": (("x", "y"), np.array([[300, 300], [450, 450]])),
},
coords={"x": [0, 1], "y": [10, 20]},
)
aquifer = Aquifer.from_dataset(input_dataset)
results = ThermoGISDoublet(aquifer=aquifer).simulate().to_dataset()
print(results)
πΊοΈ Reading Raster Grids with pygridsio¶
This example demonstrates how to read raster grids using the pygridsio package and
run a deterministic doublet simulation using the Aquifer and ThermoGISDoublet classes.
Example Input Data
Example input data for some of these examples is available in the /resources/example_data directory
from pythermogis.aquifer import Aquifer
from pythermogis.doublet import ThermoGISDoublet
from pygridsio import read_grid
import numpy as np
thickness = read_grid("thickness.zmap").to_dataset(name="thickness")
ntg = read_grid("ntg.zmap")
porosity = read_grid("porosity.zmap")
depth = read_grid("top_depth.zmap")
mask = read_grid("hydrocarbons.zmap")
permeability = np.exp(read_grid("ln_perm.zmap")) # convert to natural space permeability
aquifer = Aquifer(
thickness=thickness,
ntg=ntg,
porosity=porosity,
depth=depth,
mask=mask,
permeability=permeability
)
results = ThermoGISDoublet(aquifer=aquifer).simulate().to_dataset()
print(results)
x, y = 125e3, 525e3 # define location
results_loc = results.sel(x=x, y=y, method="nearest")
print(results_loc)
Selecting values from a dataset
You get the results for a specific location by using xarray function sel to select the desired location from the results Dataset, see here for more details.