TNO Intern

Commit 6f9d04be authored by Hen Brett's avatar Hen Brett 🐔
Browse files

Adding a typer CLI to pyThermoGIS

parent cc3c130d
Loading
Loading
Loading
Loading
+6 −6
Original line number Diff line number Diff line
@@ -97,7 +97,7 @@ pip install pythermogis --index-url https://__token__:<your_personal_token>@ci.t
### 🧪 Basic Example

```python
from src import calculate_doublet_performance
from pythermogis import calculate_doublet_performance
import xarray as xr

input_data = xr.Dataset({
@@ -119,7 +119,7 @@ print(results)
### 🌍 2D Grid Example

```python
from src import calculate_doublet_performance
from pythermogis import calculate_doublet_performance
import xarray as xr
import numpy as np

@@ -142,7 +142,7 @@ print(results)
### 🗺️ Reading Raster Grids with pygridsio

```python
from src import calculate_doublet_performance
from pythermogis import calculate_doublet_performance
from pygridsio.pygridsio import read_grid

input_grids = read_grid("thickness.zmap").to_dataset(name="thickness_mean")
@@ -176,7 +176,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 import calculate_doublet_performance, instantiate_utc_properties_builder
from pythermogis import calculate_doublet_performance, instantiate_utc_properties_builder
import xarray as xr

input_data = xr.Dataset({
@@ -197,7 +197,7 @@ print(results)
If you have a valid configuration file, you can parse a utc_properties class using the method: `instantiate_utc_properties_from_xml`, some example configuration xml files are found in `tests/resources/scenarios`.

```python
from src import calculate_doublet_performance, instantiate_utc_properties_from_xml
from pythermogis import calculate_doublet_performance, instantiate_utc_properties_from_xml
import xarray as xr

input_data = xr.Dataset({
@@ -235,7 +235,7 @@ This project is licensed under the MIT License. See the `LICENSE` file for detai

```bash
git clone https://gitlab.com/your-repo/pythermogis.git
cd src
cd pythermogis
pixi install
```

+1 −1
Original line number Diff line number Diff line
@@ -2143,7 +2143,7 @@ packages:
- pypi: .
  name: pythermogis
  version: 0.1.16
  sha256: cfe7329f1fd1c04f23ca9d94611744f97af558a871019e4ae500fcfc43b94ffa
  sha256: dd2a33fbc2e874adf284964e5d506123121a633c11fa41c03fa1cfd957c35340
  requires_dist:
  - jpype1>=1.5.2,<2
  - xarray==2024.9.0.*
+1 −1
Original line number Diff line number Diff line
@@ -37,7 +37,7 @@ package-dir = {"" = "src"}
where = ["src"]

[project.scripts]
calculate = "main:calculate"
tg = "main:calculate"

[tool.pixi.project]
channels = ["conda-forge"]

src/__init__.py

0 → 100644
+2 −0
Original line number Diff line number Diff line
from .thermogis_classes.doublet import *
from .thermogis_classes.utc_properties import *
 No newline at end of file
+13 −7
Original line number Diff line number Diff line
@@ -41,15 +41,21 @@ def info():

@calculate.command()
def simulate_doublet(
        depth: float,
        thickness_mean: float,
        thickness_sd: float,
        ntg: float,
        porosity: float,
        permeability:float
) -> None:
    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),
        "depth": ((), depth),
        "thickness_mean": ((), thickness_mean),
        "thickness_sd": ((), thickness_sd),
        "ntg": ((), ntg),
        "porosity": ((), porosity),
        "ln_permeability_mean": ((), permeability),
        "ln_permeability_sd": ((), 0.0),
    })
    run_script(calculate_doublet_performance, input_data)

Loading