tjwb
tjwb is a Python library designed for water balance management in reservoirs. The library provides methods to
calculate inflow and outflow speeds of various components, such as pumps, box culverts, and valve overflows, based on
water level and configuration...
Overview
Subsequent Capacity = Previous Capacity + (Inflow Speed * ΔT) - (Outflow Speed * ΔT)
Where:
- Subsequent Capacity: The capacity of the reservoir after the current time step.
- Previous Capacity: The capacity of the reservoir before the current time step.
- Inflow Speed: The rate at which water is entering the reservoir.
- Outflow Speed: The rate at which water is leaving the reservoir.
- ΔT: The time step or interval over which the inflow and outflow are measured.
If the difference between the subsequent capacity and the previous capacity is zero, then the inflow speed and outflow speed are equal:
Subsequent Capacity - Previous Capacity = 0
In this case:
Inflow Speed = Outflow Speed
If the difference between the subsequent capacity and the previous capacity is negative, then the outflow speed is greater than the inflow speed:
Subsequent Capacity - Previous Capacity < 0
In this case:
Outflow Speed > Inflow Speed
Conversely, if the difference between the subsequent capacity and the previous capacity is positive, then the inflow speed is greater than the outflow speed:
Subsequent Capacity - Previous Capacity > 0
In this case:
Inflow Speed > Outflow Speed
Installation
To install the library, use pip:
pip install tjwb
Usage
Basic Example
from datetime import datetime
from tjwb.dataset import Dataset, ComponentConfig
from tjwb.tjwb import calculate
dataset = (
Dataset()
.time_series([datetime(2023, 1, 1), datetime(2023, 1, 2)])
.water_level([2.0, 3.0])
.pump("pump1", [0.5, 0.6]) # (m3/s)
.pump("pump2", [0.4, 0.4]) # (m3/s)
.box_culvert("culvert1", ComponentConfig(elevation=1.0, height=2.0), [0.7, 0.8]) # (m)
.valve_overflow(
"overflow1", ComponentConfig(elevation=1.0, height=2.0), [
[0.4, 0.3], # port 0 (m)
[0.4, 0.3], # port 1 (m)
[0.4, 0.3], # port 2 (m)
]
)
.custom_outflows('custom1', [0.4, 0.7]) # v3.1.0 (m3/s)
.capacity([2.0, 3.0]) # v3.1.0
)
result_df = calculate(
dataset=dataset,
water_level_capacity_map={2.0: 100, 3.0: 200},
round_to=None,
nearest_mapping=False,
capacity_from_dataset_first=True # v3.1.0 set True if you want to use the capacity in dataset instead of water_level_capacity_map
)
License
This library is released under the MIT License.
Contact
If you have any questions or issues, please open an issue on GitHub or email us at duynguyen02.dev@gmail.com.
Metadata
Release files for tjwb 3.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| tjwb-3.1.0.tar.gz | 5.1 kB | Without provenance | Details for tjwb-3.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| tjwb-3.1.0-py3-none-any.whl | Python 3 | none | any | Details for tjwb-3.1.0-py3-none-any.whl |
Total release size: 11.2 kB
Release files / tjwb-3.1.0.tar.gz
| Download URL | tjwb-3.1.0.tar.gz |
|---|---|
| Size | 5.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
df5aa9c2aa3e20fbf92f8a1125bdd901dc1e77789b06f52a1d84575e378f00e2
|
|
BLAKE2b-256 checksum How to use checksums |
b6c8e6e9ea03efb7f450f1045dcbc070625635b4b415af63b7ca098237b5e71d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.4 CPython/3.12.3 Linux/6.8.0-49-generic
|
Release files / tjwb-3.1.0-py3-none-any.whl
| Download URL | tjwb-3.1.0-py3-none-any.whl |
|---|---|
| Size | 6.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
47855c4f1a42e5091ab2d59af83102190d209e4365cb175da03b0f5735bb8e2a
|
|
BLAKE2b-256 checksum How to use checksums |
31553b6a280c7f5f8cc1fe3482c0ae02a7d29af65d15e11a24b69fcbb6469784
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.4 CPython/3.12.3 Linux/6.8.0-49-generic
|
Security for tjwb 3.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.