talsimpy 3.0.0a1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- talsimpy-3.0.0a1/.github/workflows/docs.yml +47 -0
- talsimpy-3.0.0a1/.github/workflows/publish.yml +46 -0
- talsimpy-3.0.0a1/.gitignore +31 -0
- talsimpy-3.0.0a1/CHANGELOG.md +34 -0
- talsimpy-3.0.0a1/LICENSE +42 -0
- talsimpy-3.0.0a1/PKG-INFO +88 -0
- talsimpy-3.0.0a1/README.md +25 -0
- talsimpy-3.0.0a1/docs/Makefile +20 -0
- talsimpy-3.0.0a1/docs/api.rst +17 -0
- talsimpy-3.0.0a1/docs/conf.py +37 -0
- talsimpy-3.0.0a1/docs/index.rst +19 -0
- talsimpy-3.0.0a1/docs/make.bat +35 -0
- talsimpy-3.0.0a1/pyproject.toml +44 -0
- talsimpy-3.0.0a1/requirements.txt +31 -0
- talsimpy-3.0.0a1/src/talsimpy/__init__.py +24 -0
- talsimpy-3.0.0a1/src/talsimpy/talsimdatabase.py +52 -0
- talsimpy-3.0.0a1/src/talsimpy/talsimdataset.py +645 -0
- talsimpy-3.0.0a1/src/talsimpy/talsimengine.py +310 -0
- talsimpy-3.0.0a1/src/talsimpy/talsimscenario.py +299 -0
- talsimpy-3.0.0a1/src/talsimpy/timeseries.py +1232 -0
- talsimpy-3.0.0a1/uv.lock +3070 -0
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
name: Docs
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
workflow_dispatch:
|
|
7
|
+
|
|
8
|
+
permissions:
|
|
9
|
+
contents: read
|
|
10
|
+
pages: write
|
|
11
|
+
id-token: write
|
|
12
|
+
|
|
13
|
+
concurrency:
|
|
14
|
+
group: "pages"
|
|
15
|
+
cancel-in-progress: false
|
|
16
|
+
|
|
17
|
+
jobs:
|
|
18
|
+
build:
|
|
19
|
+
runs-on: ubuntu-latest
|
|
20
|
+
steps:
|
|
21
|
+
- uses: actions/checkout@v4
|
|
22
|
+
|
|
23
|
+
- name: Install uv
|
|
24
|
+
uses: astral-sh/setup-uv@v5
|
|
25
|
+
with:
|
|
26
|
+
python-version: "3.x"
|
|
27
|
+
|
|
28
|
+
- name: Install project and docs dependencies
|
|
29
|
+
run: uv sync --group docs
|
|
30
|
+
|
|
31
|
+
- name: Build docs
|
|
32
|
+
run: uv run sphinx-build -b html docs docs/_build/html
|
|
33
|
+
|
|
34
|
+
- uses: actions/upload-pages-artifact@v3
|
|
35
|
+
with:
|
|
36
|
+
path: docs/_build/html
|
|
37
|
+
|
|
38
|
+
deploy:
|
|
39
|
+
needs: build
|
|
40
|
+
runs-on: ubuntu-latest
|
|
41
|
+
environment:
|
|
42
|
+
name: github-pages
|
|
43
|
+
url: ${{ steps.deployment.outputs.page_url }}
|
|
44
|
+
steps:
|
|
45
|
+
- name: Deploy to GitHub Pages
|
|
46
|
+
id: deployment
|
|
47
|
+
uses: actions/deploy-pages@v4
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
name: Publish to PyPI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types: [published]
|
|
6
|
+
|
|
7
|
+
permissions:
|
|
8
|
+
contents: read
|
|
9
|
+
|
|
10
|
+
jobs:
|
|
11
|
+
build:
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
steps:
|
|
14
|
+
- uses: actions/checkout@v4
|
|
15
|
+
|
|
16
|
+
- uses: actions/setup-python@v5
|
|
17
|
+
with:
|
|
18
|
+
python-version: "3.x"
|
|
19
|
+
|
|
20
|
+
- name: Install build tool
|
|
21
|
+
run: python -m pip install --upgrade build
|
|
22
|
+
|
|
23
|
+
- name: Build sdist and wheel
|
|
24
|
+
run: python -m build
|
|
25
|
+
|
|
26
|
+
- uses: actions/upload-artifact@v4
|
|
27
|
+
with:
|
|
28
|
+
name: dist
|
|
29
|
+
path: dist/
|
|
30
|
+
|
|
31
|
+
publish:
|
|
32
|
+
needs: build
|
|
33
|
+
runs-on: ubuntu-latest
|
|
34
|
+
environment:
|
|
35
|
+
name: pypi
|
|
36
|
+
url: https://pypi.org/p/talsimpy
|
|
37
|
+
permissions:
|
|
38
|
+
id-token: write
|
|
39
|
+
steps:
|
|
40
|
+
- uses: actions/download-artifact@v4
|
|
41
|
+
with:
|
|
42
|
+
name: dist
|
|
43
|
+
path: dist/
|
|
44
|
+
|
|
45
|
+
- name: Publish to PyPI
|
|
46
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Byte-compiled / cache
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
|
|
5
|
+
# Distribution / packaging
|
|
6
|
+
build/
|
|
7
|
+
dist/
|
|
8
|
+
*.egg-info/
|
|
9
|
+
.eggs/
|
|
10
|
+
|
|
11
|
+
# Testing
|
|
12
|
+
.pytest_cache/
|
|
13
|
+
.coverage
|
|
14
|
+
htmlcov/
|
|
15
|
+
|
|
16
|
+
# Docs
|
|
17
|
+
docs/_build/
|
|
18
|
+
docs/generated/
|
|
19
|
+
|
|
20
|
+
# Virtual environments
|
|
21
|
+
.venv/
|
|
22
|
+
venv/
|
|
23
|
+
env/
|
|
24
|
+
|
|
25
|
+
# Editors / IDE
|
|
26
|
+
.vscode/
|
|
27
|
+
.idea/
|
|
28
|
+
|
|
29
|
+
# OS
|
|
30
|
+
.DS_Store
|
|
31
|
+
Thumbs.db
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# talsim package
|
|
2
|
+
|
|
3
|
+
Version 3.0.0a1
|
|
4
|
+
----------------
|
|
5
|
+
CHANGED:
|
|
6
|
+
* First release under the new name "talsimpy"
|
|
7
|
+
|
|
8
|
+
Version 2.1.3
|
|
9
|
+
-------------
|
|
10
|
+
FIXED:
|
|
11
|
+
* Fix error handling when trying to open a nonexistant scenario
|
|
12
|
+
|
|
13
|
+
Version 2.1.2
|
|
14
|
+
-------------
|
|
15
|
+
FIXED:
|
|
16
|
+
* Improved handling of different combinations of engine path and run file, disallow using UNC paths as the location of the engine
|
|
17
|
+
|
|
18
|
+
Version 2.1.1
|
|
19
|
+
-------------
|
|
20
|
+
FIXED:
|
|
21
|
+
* Fixed `TalsimEngine.simulate()` not using the passed `sim_id` argument as the simulation id (was using the active simulation id as set in the database instead)
|
|
22
|
+
|
|
23
|
+
Version 2.1.0
|
|
24
|
+
-------------
|
|
25
|
+
NEW:
|
|
26
|
+
* New static method `TalsimEngine.launch()` for launching a simulation using an existing run file
|
|
27
|
+
* New static method `TalsimEngine.read_runfile()` for reading a run file
|
|
28
|
+
* `TalsimEngine.simulate()` now has an additional optional parameter `name` for specifying the output filenames (only relevant for TalsimScenario instances)
|
|
29
|
+
|
|
30
|
+
FIXED:
|
|
31
|
+
* Fixed `TalsimDataset.file_to_dataframe()` not working for EFL version 1.2 files
|
|
32
|
+
|
|
33
|
+
REMOVED:
|
|
34
|
+
* Removed method `TalsimScenario.copy_simulation()` because it doesn't deal with calibrations and calibration mapping which would need to be copied/adjusted as well
|
talsimpy-3.0.0a1/LICENSE
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
Copyright (c) 2026 SYDRO Consult GmbH
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a
|
|
4
|
+
copy of this software (the "Software"), to use the Software for any
|
|
5
|
+
purpose, including commercial purposes, in particular for preparing,
|
|
6
|
+
transforming, or manipulating data intended for use with the
|
|
7
|
+
proprietary Talsim software, subject to the following conditions:
|
|
8
|
+
|
|
9
|
+
1. Modification. The Software may not be modified, and no derivative
|
|
10
|
+
works may be created based on the Software, in whole or in part.
|
|
11
|
+
|
|
12
|
+
2. No incorporation into other products. The Software's source code,
|
|
13
|
+
in whole or in part, may not be extracted, embedded, repackaged, or
|
|
14
|
+
otherwise incorporated into any other software product or service
|
|
15
|
+
that you distribute, sell, or otherwise make available to third
|
|
16
|
+
parties, whether offered commercially or free of charge. For the
|
|
17
|
+
avoidance of doubt, this condition does not restrict using the
|
|
18
|
+
Software as an unmodified dependency of your own scripts,
|
|
19
|
+
applications, or internal tools (for example, via a Python `import`
|
|
20
|
+
statement) for your own purposes, including preparing data for use
|
|
21
|
+
with the Talsim software; such use is expressly permitted under
|
|
22
|
+
these terms.
|
|
23
|
+
|
|
24
|
+
3. Redistribution. The Software may not be redistributed, sublicensed,
|
|
25
|
+
or otherwise made available to third parties, except in unmodified
|
|
26
|
+
form via the official distribution channel
|
|
27
|
+
(https://pypi.org/project/pytalsim/).
|
|
28
|
+
|
|
29
|
+
4. Notice. The above copyright notice and this permission notice shall
|
|
30
|
+
be included, unmodified, in all copies of the Software.
|
|
31
|
+
|
|
32
|
+
5. Termination. This license terminates automatically if you breach
|
|
33
|
+
any of the conditions above. Upon termination, you must cease all
|
|
34
|
+
use of the Software and destroy all copies in your possession.
|
|
35
|
+
|
|
36
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|
37
|
+
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
38
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
39
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
40
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
41
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
42
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: talsimpy
|
|
3
|
+
Version: 3.0.0a1
|
|
4
|
+
Summary: Python interface for Talsim4 datasets, Talsim5 databases
|
|
5
|
+
Project-URL: Homepage, https://github.com/sydroconsult/talsimpy
|
|
6
|
+
Project-URL: Changelog, https://github.com/sydroconsult/talsimpy/blob/main/CHANGELOG.md
|
|
7
|
+
Author-email: SYDRO Consult GmbH <mail@sydro.de>
|
|
8
|
+
License: Copyright (c) 2026 SYDRO Consult GmbH
|
|
9
|
+
|
|
10
|
+
Permission is hereby granted, free of charge, to any person obtaining a
|
|
11
|
+
copy of this software (the "Software"), to use the Software for any
|
|
12
|
+
purpose, including commercial purposes, in particular for preparing,
|
|
13
|
+
transforming, or manipulating data intended for use with the
|
|
14
|
+
proprietary Talsim software, subject to the following conditions:
|
|
15
|
+
|
|
16
|
+
1. Modification. The Software may not be modified, and no derivative
|
|
17
|
+
works may be created based on the Software, in whole or in part.
|
|
18
|
+
|
|
19
|
+
2. No incorporation into other products. The Software's source code,
|
|
20
|
+
in whole or in part, may not be extracted, embedded, repackaged, or
|
|
21
|
+
otherwise incorporated into any other software product or service
|
|
22
|
+
that you distribute, sell, or otherwise make available to third
|
|
23
|
+
parties, whether offered commercially or free of charge. For the
|
|
24
|
+
avoidance of doubt, this condition does not restrict using the
|
|
25
|
+
Software as an unmodified dependency of your own scripts,
|
|
26
|
+
applications, or internal tools (for example, via a Python `import`
|
|
27
|
+
statement) for your own purposes, including preparing data for use
|
|
28
|
+
with the Talsim software; such use is expressly permitted under
|
|
29
|
+
these terms.
|
|
30
|
+
|
|
31
|
+
3. Redistribution. The Software may not be redistributed, sublicensed,
|
|
32
|
+
or otherwise made available to third parties, except in unmodified
|
|
33
|
+
form via the official distribution channel
|
|
34
|
+
(https://pypi.org/project/pytalsim/).
|
|
35
|
+
|
|
36
|
+
4. Notice. The above copyright notice and this permission notice shall
|
|
37
|
+
be included, unmodified, in all copies of the Software.
|
|
38
|
+
|
|
39
|
+
5. Termination. This license terminates automatically if you breach
|
|
40
|
+
any of the conditions above. Upon termination, you must cease all
|
|
41
|
+
use of the Software and destroy all copies in your possession.
|
|
42
|
+
|
|
43
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|
44
|
+
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
45
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
46
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
47
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
48
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
49
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
50
|
+
License-File: LICENSE
|
|
51
|
+
Classifier: License :: Other/Proprietary License
|
|
52
|
+
Classifier: Operating System :: OS Independent
|
|
53
|
+
Classifier: Programming Language :: Python :: 3
|
|
54
|
+
Requires-Python: >=3.9
|
|
55
|
+
Requires-Dist: numpy
|
|
56
|
+
Requires-Dist: pandas
|
|
57
|
+
Provides-Extra: plot
|
|
58
|
+
Requires-Dist: matplotlib; extra == 'plot'
|
|
59
|
+
Provides-Extra: raster
|
|
60
|
+
Requires-Dist: rioxarray; extra == 'raster'
|
|
61
|
+
Requires-Dist: xarray; extra == 'raster'
|
|
62
|
+
Description-Content-Type: text/markdown
|
|
63
|
+
|
|
64
|
+
# talsimpy
|
|
65
|
+
|
|
66
|
+
Python interface for Talsim datasets, databases, scenarios, simulation runs and time series processing.
|
|
67
|
+
|
|
68
|
+
## Installation
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
pip install talsimpy
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## Features
|
|
75
|
+
|
|
76
|
+
* `TalsimDataset` – read and edit Talsim ASCII datasets
|
|
77
|
+
* `TalsimDatabase` – interact with a Talsim 5 database
|
|
78
|
+
* `TalsimScenario` – manage a scenario within a database
|
|
79
|
+
* `TalsimEngine` – run simulations
|
|
80
|
+
* `Timeseries` – process time series
|
|
81
|
+
|
|
82
|
+
## Example
|
|
83
|
+
|
|
84
|
+
```python
|
|
85
|
+
from talsimpy import TalsimDatabase
|
|
86
|
+
|
|
87
|
+
db = TalsimDatabase("path/to/database.db")
|
|
88
|
+
```
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# talsimpy
|
|
2
|
+
|
|
3
|
+
Python interface for Talsim datasets, databases, scenarios, simulation runs and time series processing.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pip install talsimpy
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Features
|
|
12
|
+
|
|
13
|
+
* `TalsimDataset` – read and edit Talsim ASCII datasets
|
|
14
|
+
* `TalsimDatabase` – interact with a Talsim 5 database
|
|
15
|
+
* `TalsimScenario` – manage a scenario within a database
|
|
16
|
+
* `TalsimEngine` – run simulations
|
|
17
|
+
* `Timeseries` – process time series
|
|
18
|
+
|
|
19
|
+
## Example
|
|
20
|
+
|
|
21
|
+
```python
|
|
22
|
+
from talsimpy import TalsimDatabase
|
|
23
|
+
|
|
24
|
+
db = TalsimDatabase("path/to/database.db")
|
|
25
|
+
```
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# Minimal makefile for Sphinx documentation
|
|
2
|
+
#
|
|
3
|
+
|
|
4
|
+
# You can set these variables from the command line, and also
|
|
5
|
+
# from the environment for the first two.
|
|
6
|
+
SPHINXOPTS ?=
|
|
7
|
+
SPHINXBUILD ?= sphinx-build
|
|
8
|
+
SOURCEDIR = .
|
|
9
|
+
BUILDDIR = _build
|
|
10
|
+
|
|
11
|
+
# Put it first so that "make" without argument is like "make help".
|
|
12
|
+
help:
|
|
13
|
+
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
|
|
14
|
+
|
|
15
|
+
.PHONY: help Makefile
|
|
16
|
+
|
|
17
|
+
# Catch-all target: route all unknown targets to Sphinx using the new
|
|
18
|
+
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
|
|
19
|
+
%: Makefile
|
|
20
|
+
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
API Reference
|
|
2
|
+
=============
|
|
3
|
+
|
|
4
|
+
.. autoclass:: talsimpy.TalsimDataset
|
|
5
|
+
:members:
|
|
6
|
+
|
|
7
|
+
.. autoclass:: talsimpy.TalsimDatabase
|
|
8
|
+
:members:
|
|
9
|
+
|
|
10
|
+
.. autoclass:: talsimpy.TalsimScenario
|
|
11
|
+
:members:
|
|
12
|
+
|
|
13
|
+
.. autoclass:: talsimpy.TalsimEngine
|
|
14
|
+
:members:
|
|
15
|
+
|
|
16
|
+
.. autoclass:: talsimpy.Timeseries
|
|
17
|
+
:members:
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# Configuration file for the Sphinx documentation builder.
|
|
2
|
+
#
|
|
3
|
+
# For the full list of built-in configuration values, see the documentation:
|
|
4
|
+
# https://www.sphinx-doc.org/en/master/usage/configuration.html
|
|
5
|
+
|
|
6
|
+
import sys
|
|
7
|
+
from pathlib import Path
|
|
8
|
+
|
|
9
|
+
sys.path.insert(0, str(Path(__file__).parent.parent / "src"))
|
|
10
|
+
|
|
11
|
+
# -- Project information -----------------------------------------------------
|
|
12
|
+
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
|
|
13
|
+
|
|
14
|
+
project = 'talsimpy'
|
|
15
|
+
copyright = '2026, Sydro Consult GmbH'
|
|
16
|
+
author = 'Sydro Consult GmbH'
|
|
17
|
+
release = '3.0.0'
|
|
18
|
+
|
|
19
|
+
# -- General configuration ---------------------------------------------------
|
|
20
|
+
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
|
|
21
|
+
|
|
22
|
+
extensions = [
|
|
23
|
+
'sphinx.ext.autodoc',
|
|
24
|
+
'sphinx.ext.napoleon',
|
|
25
|
+
'sphinx.ext.viewcode',
|
|
26
|
+
]
|
|
27
|
+
|
|
28
|
+
templates_path = ['_templates']
|
|
29
|
+
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
# -- Options for HTML output -------------------------------------------------
|
|
34
|
+
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
|
|
35
|
+
|
|
36
|
+
html_theme = 'alabaster'
|
|
37
|
+
html_static_path = ['_static']
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
.. talsimpy documentation master file, created by
|
|
2
|
+
sphinx-quickstart on Fri Aug 21 09:46:52 2026.
|
|
3
|
+
You can adapt this file completely to your liking, but it should at least
|
|
4
|
+
contain the root `toctree` directive.
|
|
5
|
+
|
|
6
|
+
talsimpy documentation
|
|
7
|
+
======================
|
|
8
|
+
|
|
9
|
+
Add your content using ``reStructuredText`` syntax. See the
|
|
10
|
+
`reStructuredText <https://www.sphinx-doc.org/en/master/usage/restructuredtext/index.html>`_
|
|
11
|
+
documentation for details.
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
.. toctree::
|
|
15
|
+
:maxdepth: 2
|
|
16
|
+
:caption: Contents:
|
|
17
|
+
|
|
18
|
+
api
|
|
19
|
+
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
@ECHO OFF
|
|
2
|
+
|
|
3
|
+
pushd %~dp0
|
|
4
|
+
|
|
5
|
+
REM Command file for Sphinx documentation
|
|
6
|
+
|
|
7
|
+
if "%SPHINXBUILD%" == "" (
|
|
8
|
+
set SPHINXBUILD=sphinx-build
|
|
9
|
+
)
|
|
10
|
+
set SOURCEDIR=.
|
|
11
|
+
set BUILDDIR=_build
|
|
12
|
+
|
|
13
|
+
%SPHINXBUILD% >NUL 2>NUL
|
|
14
|
+
if errorlevel 9009 (
|
|
15
|
+
echo.
|
|
16
|
+
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
|
|
17
|
+
echo.installed, then set the SPHINXBUILD environment variable to point
|
|
18
|
+
echo.to the full path of the 'sphinx-build' executable. Alternatively you
|
|
19
|
+
echo.may add the Sphinx directory to PATH.
|
|
20
|
+
echo.
|
|
21
|
+
echo.If you don't have Sphinx installed, grab it from
|
|
22
|
+
echo.https://www.sphinx-doc.org/
|
|
23
|
+
exit /b 1
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
if "%1" == "" goto help
|
|
27
|
+
|
|
28
|
+
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
|
|
29
|
+
goto end
|
|
30
|
+
|
|
31
|
+
:help
|
|
32
|
+
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
|
|
33
|
+
|
|
34
|
+
:end
|
|
35
|
+
popd
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "talsimpy"
|
|
7
|
+
dynamic = ["version"]
|
|
8
|
+
description = "Python interface for Talsim4 datasets, Talsim5 databases"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.9"
|
|
11
|
+
license = { file = "LICENSE" }
|
|
12
|
+
authors = [
|
|
13
|
+
{ name = "SYDRO Consult GmbH", email = "mail@sydro.de" },
|
|
14
|
+
]
|
|
15
|
+
classifiers = [
|
|
16
|
+
"Programming Language :: Python :: 3",
|
|
17
|
+
"License :: Other/Proprietary License",
|
|
18
|
+
"Operating System :: OS Independent",
|
|
19
|
+
]
|
|
20
|
+
dependencies = [
|
|
21
|
+
"numpy",
|
|
22
|
+
"pandas",
|
|
23
|
+
]
|
|
24
|
+
|
|
25
|
+
[project.optional-dependencies]
|
|
26
|
+
plot = ["matplotlib"]
|
|
27
|
+
raster = ["xarray", "rioxarray"]
|
|
28
|
+
|
|
29
|
+
[dependency-groups]
|
|
30
|
+
test = ["pytest"]
|
|
31
|
+
docs = ["sphinx"]
|
|
32
|
+
|
|
33
|
+
[project.urls]
|
|
34
|
+
Homepage = "https://github.com/sydroconsult/talsimpy"
|
|
35
|
+
Changelog = "https://github.com/sydroconsult/talsimpy/blob/main/CHANGELOG.md"
|
|
36
|
+
|
|
37
|
+
[tool.hatch.version]
|
|
38
|
+
path = "src/talsimpy/__init__.py"
|
|
39
|
+
|
|
40
|
+
[tool.hatch.build.targets.wheel]
|
|
41
|
+
packages = ["src/talsimpy"]
|
|
42
|
+
|
|
43
|
+
[tool.pytest.ini_options]
|
|
44
|
+
testpaths = ["tests"]
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# This file was autogenerated by uv via the following command:
|
|
2
|
+
# uv export --no-hashes -o requirements.txt
|
|
3
|
+
-e .
|
|
4
|
+
numpy==2.0.2 ; python_full_version < '3.10'
|
|
5
|
+
# via
|
|
6
|
+
# pandas
|
|
7
|
+
# talsimpy
|
|
8
|
+
numpy==2.2.6 ; python_full_version == '3.10.*'
|
|
9
|
+
# via
|
|
10
|
+
# pandas
|
|
11
|
+
# talsimpy
|
|
12
|
+
numpy==2.4.6 ; python_full_version == '3.11.*'
|
|
13
|
+
# via
|
|
14
|
+
# pandas
|
|
15
|
+
# talsimpy
|
|
16
|
+
numpy==2.5.2 ; python_full_version >= '3.12'
|
|
17
|
+
# via
|
|
18
|
+
# pandas
|
|
19
|
+
# talsimpy
|
|
20
|
+
pandas==2.3.3 ; python_full_version < '3.11'
|
|
21
|
+
# via talsimpy
|
|
22
|
+
pandas==3.0.5 ; python_full_version >= '3.11'
|
|
23
|
+
# via talsimpy
|
|
24
|
+
python-dateutil==2.9.0.post0
|
|
25
|
+
# via pandas
|
|
26
|
+
pytz==2026.3.post1 ; python_full_version < '3.11'
|
|
27
|
+
# via pandas
|
|
28
|
+
six==1.17.0
|
|
29
|
+
# via python-dateutil
|
|
30
|
+
tzdata==2026.3 ; python_full_version < '3.11' or sys_platform == 'emscripten' or sys_platform == 'win32'
|
|
31
|
+
# via pandas
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
# ---------------------------------------------------------
|
|
3
|
+
# Copyright (C) SYDRO Consult GmbH, <mail@sydro.de>
|
|
4
|
+
# This file may not be copied, modified and/or distributed
|
|
5
|
+
# without the express permission of SYDRO Consult GmbH
|
|
6
|
+
# ---------------------------------------------------------
|
|
7
|
+
"""
|
|
8
|
+
Package talsim
|
|
9
|
+
|
|
10
|
+
This package contains the following classes:
|
|
11
|
+
* `TalsimDataset` for handling and manipulating a Talsim ASCII dataset
|
|
12
|
+
* `TalsimDatabase` for handling a Talsim 5 database
|
|
13
|
+
* `TalsimScenario` for handling and manipulating a scenario in a database
|
|
14
|
+
* `TalsimEngine` for carrying out simulations with Talsim
|
|
15
|
+
* `Timeseries` for handling and manipulating time series
|
|
16
|
+
"""
|
|
17
|
+
|
|
18
|
+
__version__ = "3.0.0a1"
|
|
19
|
+
|
|
20
|
+
from .talsimdatabase import TalsimDatabase
|
|
21
|
+
from .talsimdataset import TalsimDataset
|
|
22
|
+
from .talsimscenario import TalsimScenario
|
|
23
|
+
from .talsimengine import TalsimEngine
|
|
24
|
+
from .timeseries import Timeseries
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
# ---------------------------------------------------------
|
|
3
|
+
# Copyright (C) SYDRO Consult GmbH, <mail@sydro.de>
|
|
4
|
+
# This file may not be copied, modified and/or distributed
|
|
5
|
+
# without the express permission of SYDRO Consult GmbH
|
|
6
|
+
# ---------------------------------------------------------
|
|
7
|
+
"""
|
|
8
|
+
Package talsim
|
|
9
|
+
"""
|
|
10
|
+
from __future__ import annotations
|
|
11
|
+
import logging
|
|
12
|
+
from pathlib import Path
|
|
13
|
+
import sqlite3
|
|
14
|
+
|
|
15
|
+
from .talsimscenario import TalsimScenario
|
|
16
|
+
|
|
17
|
+
logger = logging.getLogger(__name__)
|
|
18
|
+
|
|
19
|
+
class TalsimDatabase():
|
|
20
|
+
"""
|
|
21
|
+
CLass for handling a Talsim 5 database
|
|
22
|
+
"""
|
|
23
|
+
|
|
24
|
+
def __init__(self, path: Path|str):
|
|
25
|
+
|
|
26
|
+
self.path = Path(path)
|
|
27
|
+
self.scenarios: dict[int, str] = {} # {id: name, ...}
|
|
28
|
+
|
|
29
|
+
try:
|
|
30
|
+
conn = sqlite3.Connection(path)
|
|
31
|
+
# read scenarios
|
|
32
|
+
result = conn.execute("SELECT Id, Name FROM Scenario ORDER BY Id;")
|
|
33
|
+
for id, name in result:
|
|
34
|
+
self.scenarios[id] = name
|
|
35
|
+
|
|
36
|
+
except Exception as e:
|
|
37
|
+
logger.error(f"Error while reading Talsim database: {e}")
|
|
38
|
+
|
|
39
|
+
finally:
|
|
40
|
+
result.close()
|
|
41
|
+
conn.close()
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def open_scenario(self, scenario_id: int) -> TalsimScenario:
|
|
45
|
+
"""
|
|
46
|
+
Opens a scenario from the database, returning a corresponding TalsimScenario instance
|
|
47
|
+
"""
|
|
48
|
+
return TalsimScenario(self.path, scenario_id)
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
def __repr__(self) -> str:
|
|
52
|
+
return f"Talsim database at {self.path}"
|