tjwb


Nametjwb JSON
Version 3.0.0 PyPI version JSON
download
home_pagehttps://github.com/duynguyen02/tjwb
SummaryPython library for reservoir water balance calculations.
upload_time2024-11-11 13:42:20
maintainerNone
docs_urlNone
authorDuy Nguyen
requires_python<4.0,>=3.9
licenseNone
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # tjwb

![PyPI - Version](https://img.shields.io/pypi/v/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:

```bash
pip install tjwb
```

## Usage

### Basic Example

```python
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])
    .pump("pump2", [0.4, 0.4])
    .box_culvert("culvert1", ComponentConfig(elevation=1.0, height=2.0), [0.7, 0.8])
    .valve_overflow(
        "overflow1", ComponentConfig(elevation=1.0, height=2.0), [
            [0.4, 0.3],  # port 0
            [0.4, 0.3],  # port 1
            [0.4, 0.3],  # port 2
        ]
    )
)

result_df = calculate(
    dataset=dataset,
    water_level_capacity_map={2.0: 100, 3.0: 200},
    round_to=None,
    nearest_mapping=False
)
```
## License

This library is released under the MIT License.

## Contact

If you have any questions or issues, please open an issue on [GitHub](https://github.com/duynguyen02/tjwb/issues) or
email us at [duynguyen02.dev@gmail.com](mailto:duynguyen02.dev@gmail.com).

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/duynguyen02/tjwb",
    "name": "tjwb",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.9",
    "maintainer_email": null,
    "keywords": null,
    "author": "Duy Nguyen",
    "author_email": "duynguyen02.dev@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/d4/36/3197b0c8ceb92c622a638d48b4e95d7d9f8330faba45605fe841c3f550ca/tjwb-3.0.0.tar.gz",
    "platform": null,
    "description": "# tjwb\n\n![PyPI - Version](https://img.shields.io/pypi/v/tjwb)\n\n`tjwb` is a Python library designed for water balance management in reservoirs. The library provides methods to\ncalculate inflow and outflow speeds of various components, such as pumps, box culverts, and valve overflows, based on\nwater level and configuration...\n\n## Overview\n\n```\nSubsequent Capacity = Previous Capacity + (Inflow Speed * \u0394T) - (Outflow Speed * \u0394T)\n```\n\nWhere:\n\n- **Subsequent Capacity**: The capacity of the reservoir after the current time step.\n- **Previous Capacity**: The capacity of the reservoir before the current time step.\n- **Inflow Speed**: The rate at which water is entering the reservoir.\n- **Outflow Speed**: The rate at which water is leaving the reservoir.\n- **\u0394T**: The time step or interval over which the inflow and outflow are measured.\n\nIf the difference between the subsequent capacity and the previous capacity is zero, then the inflow speed and outflow\nspeed\nare equal:\n\n```\nSubsequent Capacity - Previous Capacity = 0\n```\n\nIn this case:\n\n```\nInflow Speed = Outflow Speed\n```\n\nIf the difference between the subsequent capacity and the previous capacity is negative, then the outflow speed is\ngreater\nthan the inflow speed:\n\n```\nSubsequent Capacity - Previous Capacity < 0\n```\n\nIn this case:\n\n```\nOutflow Speed > Inflow Speed\n```\n\nConversely, if the difference between the subsequent capacity and the previous capacity is positive, then the inflow\nspeed\nis greater than the outflow speed:\n\n```\nSubsequent Capacity - Previous Capacity > 0\n```\n\nIn this case:\n\n```\nInflow Speed > Outflow Speed\n```\n\n## Installation\n\nTo install the library, use pip:\n\n```bash\npip install tjwb\n```\n\n## Usage\n\n### Basic Example\n\n```python\nfrom datetime import datetime\nfrom tjwb.dataset import Dataset, ComponentConfig\nfrom tjwb.tjwb import calculate\n\ndataset = (\n    Dataset()\n    .time_series([datetime(2023, 1, 1), datetime(2023, 1, 2)])\n    .water_level([2.0, 3.0])\n    .pump(\"pump1\", [0.5, 0.6])\n    .pump(\"pump2\", [0.4, 0.4])\n    .box_culvert(\"culvert1\", ComponentConfig(elevation=1.0, height=2.0), [0.7, 0.8])\n    .valve_overflow(\n        \"overflow1\", ComponentConfig(elevation=1.0, height=2.0), [\n            [0.4, 0.3],  # port 0\n            [0.4, 0.3],  # port 1\n            [0.4, 0.3],  # port 2\n        ]\n    )\n)\n\nresult_df = calculate(\n    dataset=dataset,\n    water_level_capacity_map={2.0: 100, 3.0: 200},\n    round_to=None,\n    nearest_mapping=False\n)\n```\n## License\n\nThis library is released under the MIT License.\n\n## Contact\n\nIf you have any questions or issues, please open an issue on [GitHub](https://github.com/duynguyen02/tjwb/issues) or\nemail us at [duynguyen02.dev@gmail.com](mailto:duynguyen02.dev@gmail.com).\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Python library for reservoir water balance calculations.",
    "version": "3.0.0",
    "project_urls": {
        "Homepage": "https://github.com/duynguyen02/tjwb",
        "Repository": "https://github.com/duynguyen02/tjwb"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "1bd3a6e0f9d7f984a272ce2710fcc1ae81c5e88652ff889b401b58cd3250e0aa",
                "md5": "c8e8adbb1e6818c902696bd93750f5a9",
                "sha256": "baa0aa086a893ddb579276684a450e1db7fce59acff10b27c21e472aa528de94"
            },
            "downloads": -1,
            "filename": "tjwb-3.0.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "c8e8adbb1e6818c902696bd93750f5a9",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.9",
            "size": 5744,
            "upload_time": "2024-11-11T13:42:19",
            "upload_time_iso_8601": "2024-11-11T13:42:19.714329Z",
            "url": "https://files.pythonhosted.org/packages/1b/d3/a6e0f9d7f984a272ce2710fcc1ae81c5e88652ff889b401b58cd3250e0aa/tjwb-3.0.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d4363197b0c8ceb92c622a638d48b4e95d7d9f8330faba45605fe841c3f550ca",
                "md5": "2c5bab70ddebc3b64442dd566e530b2e",
                "sha256": "141b102ac9d61be11cdb12059b19f3bf2bb602a4d6593ce6be846993cd81eeee"
            },
            "downloads": -1,
            "filename": "tjwb-3.0.0.tar.gz",
            "has_sig": false,
            "md5_digest": "2c5bab70ddebc3b64442dd566e530b2e",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.9",
            "size": 4789,
            "upload_time": "2024-11-11T13:42:20",
            "upload_time_iso_8601": "2024-11-11T13:42:20.897778Z",
            "url": "https://files.pythonhosted.org/packages/d4/36/3197b0c8ceb92c622a638d48b4e95d7d9f8330faba45605fe841c3f550ca/tjwb-3.0.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-11-11 13:42:20",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "duynguyen02",
    "github_project": "tjwb",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [],
    "lcname": "tjwb"
}
        
Elapsed time: 0.36024s