TNO Intern

Commit c6a04dba authored by Hen Brett's avatar Hen Brett 🐔
Browse files

Merge branch '10-implement-florian-s-comments' into 'main'

Resolve "Implement Florian's comments"

Closes #10

See merge request AGS/pythermogis!14
parents f8c09e59 b0869319
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -2,3 +2,5 @@
# pixi environments
.pixi
*.egg-info
build
dist
+1 −1
Original line number Diff line number Diff line
@@ -3,5 +3,5 @@
  <component name="Black">
    <option name="sdkName" value="Python 3.13 (delphi_read_lingewaard_data)" />
  </component>
  <component name="ProjectRootManager" version="2" project-jdk-name="Python 3.13 (pythermogis) (2)" project-jdk-type="Python SDK" />
  <component name="ProjectRootManager" version="2" project-jdk-name="Python 3.13 (2)" project-jdk-type="Python SDK" />
</project>
 No newline at end of file
+1 −1
Original line number Diff line number Diff line
@@ -5,7 +5,7 @@
      <sourceFolder url="file://$MODULE_DIR$/tests/tests" isTestSource="true" />
      <excludeFolder url="file://$MODULE_DIR$/.venv" />
    </content>
    <orderEntry type="jdk" jdkName="Python 3.13 (pythermogis) (2)" jdkType="Python SDK" />
    <orderEntry type="jdk" jdkName="Python 3.13 (2)" jdkType="Python SDK" />
    <orderEntry type="sourceFolder" forTests="false" />
  </component>
  <component name="PyNamespacePackagesService">
+42 −18
Original line number Diff line number Diff line
# pyThermoGIS

pyThermoGIS is a Python package that provides API access to the ThermoGIS Geothermal simulation (https://www.thermogis.nl/en). The simulations are conducted in java and this code uses the JPype package as a python-java
pyThermoGIS is a Python package that provides API access to the [ThermoGIS](https://www.thermogis.nl/en) Geothermal simulation. The simulations are conducted in java and this code uses the JPype package as a python-java
binding.

It uses xarray (https://docs.xarray.dev/en/stable/index.html) Datasets as input to the simulation and can be combined with the pygridsio package (https://pypi.org/project/pygridsio/) to read in and process 2D rasters
It uses [xarray](https://docs.xarray.dev/en/stable/index.html) Datasets as input to the simulation and can be combined with the [pygridsio](https://pypi.org/project/pygridsio/) package  to read in and process 2D rasters
   
## Installation for usage in your own python project

@@ -20,20 +20,8 @@ Follow these steps:
- Create a new token with the **read_api** and **read_package_registry** scopes.
- Copy the token and store it securely, as it will not be visible again.

### 2. Set Up Authentication with `.pypirc`

Create a `.pypirc` file in your home directory (`~/.pypirc` on Linux/macOS or `%USERPROFILE%\.pypirc` on Windows) with the following content:

```ini
[gitlab]
repository = https://ci.tno.nl/gitlab/api/v4/projects/18271/packages/pypi
username = __token__
password = <your_personal_token>
```

Replace `<your_personal_token>` with your actual GitLab PAT. Ensure the token has the necessary permissions to access the repository.

### 3. Install the Package
### 2. Install the Package

Once the `.pypirc` file is set up, install `pyThermoGIS` using:

@@ -54,7 +42,7 @@ This will fetch the package from the specified GitLab package repository.
Here’s a simple example demonstrating how to use `pyThermoGIS` for a single set of input values:

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

# Initialize an input Dataset with the required input variables:
@@ -79,7 +67,7 @@ The API utilizes xarray's ability to efficiently calculate over multiple dimensi
dimensions:

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

@@ -107,7 +95,7 @@ print(doublet_simulation_results)

Consider utilizing the pypi package pygridsio to read in and write out 2D raster grids (with either .asc, .zmap, .nc, .tif file formats) to a xarray dataset, before applying the calculate_doublet_performance code:
```python
from pythermogis.pythermogis import calculate_doublet_performance
from pythermogis import calculate_doublet_performance
from pygridsio.pygridsio import read_grid

# Initialize an input Dataset with the required input variables:
@@ -159,3 +147,39 @@ To install `pyThermoGIS` from source using Pixi, follow these steps:
   ```sh
   pixi run python
   ```

### Publish to ci.tno.nl/gitlab

### 1. Set Up Authentication with `.pypirc`

Create a `.pypirc` file in your home directory (`~/.pypirc` on Linux/macOS or `%USERPROFILE%\.pypirc` on Windows) with the following content:

```ini
[distutils]
index-servers =
    gitlab-pythermogis

[gitlab-pythermogis]
repository = https://ci.tno.nl/gitlab/api/v4/projects/18271/packages/pypi
username = __token__
password = <your_personal_token>
```

Replace `<your_personal_token>` with your actual GitLab PAT. Ensure the token has the necessary permissions to write to repositories

### 2. download packages and build project

Using Pixi download build and twine, then run:
   ```sh
   pixi run python -m build
   ```

this will then build a .whl and a .tar.gz file and place it in the /build directory

### 3. upload to gitlab

Then run:
   ```sh
   pixi run twine upload -r gitlab-pythermogis dist/*
   ```
If the credentials have been successfully updated in the `~/.pypirc` file, this should upload the python package to the gitlab pypi package repository
 No newline at end of file

build/lib/pythermogis/__init__.py

deleted100644 → 0
+0 −0

Empty file deleted.

Loading