hydnam


Namehydnam JSON
Version 1.1.2 PyPI version JSON
download
home_pagehttps://github.com/duynguyen02/hydnam
SummaryPython implementation of NedborAfstromnings Model (NAM) lumped rainfall–runoff model
upload_time2025-01-01 17:40:19
maintainerNone
docs_urlNone
authorDuy Nguyen
requires_python<4.0,>=3.10
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # HydNAM

![PyPI - Version](https://img.shields.io/pypi/v/hydnam)

**HydNAM** is a Python implementation of the NedborAfstromnings Model (NAM), a lumped rainfall–runoff model.

This project is based on the [NAM_Model](https://github.com/hckaraman/NAM_Model) created by [hckaraman](https://github.com/hckaraman). 

## Installation

```bash
pip install hydnam
```

## Getting Started

### 1. Prepare the Dataset

The dataset must contain the following properties: Date, Temperature, Precipitation, Evapotranspiration, and Discharge.

| Date       | Temperature | Discharge | Precipitation | Evapotranspiration |
|------------|-------------|-----------|---------------|--------------------|
| 10/9/2016  | 15.4        | 0.25694   | 0             | 2.79               |
| 10/10/2016 | 14.4        | 0.25812   | 0             | 3.46               |
| 10/11/2016 | 14.9        | 0.30983   | 0             | 3.65               |
| 10/12/2016 | 16.1        | 0.31422   | 0             | 3.46               |
| 10/13/2016 | 20.1        | 0.30866   | 0             | 5.64               |
| 10/14/2016 | 13.9        | 0.30868   | 0             | 3.24               |
| 10/15/2016 | 11.1        | 0.31299   | 0             | 3.41               |
| ...        | ...         | ...       | ...           | ...                |

Ensure that the time intervals between dates are consistent (e.g., 24 hours) for accurate model performance.

### 2. Initialize the NAM Model

```python
from datetime import datetime
from hydnam.chart import plot_q
from hydnam.dataset import Dataset
from hydnam.hydnam import HydNAM
from hydnam.parameters import Parameters

dataset = Dataset(
    timeseries=[
        datetime(2016, 10, 9),
        datetime(2016, 10, 10),
        datetime(2016, 10, 11),
    ],
    temperature=[15.4, 14.4, 14.9],
    precipitation=[0.0, 0.0, 0.0],
    evapotranspiration=[2.79, 3.46, 3.65],
    discharge=[0.25694, 0.25812, 0.30983]
)

params = Parameters(
    umax=0.01,
    lmax=0.01,
    cqof=0.01,
    ckif=200.0,
    ck12=10.0,
    tof=0.0,
    tif=0.0,
    tg=0.0,
    ckbf=500.0,
    csnow=0.0,
    snowtemp=0.0
)

nam = HydNAM(
    dataset=dataset,
    parameters=params,
    area=58.8,
    interval=24.0,
    start=None,
    end=None,
    spin_off=0.0
)
print(f'Parameters: {nam.parameters}')
print(f'Statistics: {nam.statistics}')
df = nam.simulation_result.to_dataframe()
```

### 3. Optimize the Model

```
NAM.optimize()
```

The model will calculate and check which `Parameters` are optimal for the model and use it as the main `Parameters` for
the model.

### 4. Customize Parameters

```
nam.set_parameters(Parameters())
```

### 5. Show Discharge

```
from hydnam.chart import plot_q
...
plot_q(nam.simulation_result, only_obs_and_sim=False).show()
```

## 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/hydnam/issues) or
email us at [duynguyen02.dev@gmail.com](mailto:duynguyen02.dev@gmail.com).

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/duynguyen02/hydnam",
    "name": "hydnam",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.10",
    "maintainer_email": null,
    "keywords": null,
    "author": "Duy Nguyen",
    "author_email": "duynguyen02.dev@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/d1/72/8c21d1ddf714744cc6f8c52299439310189133fff5b8117d43c2125d3e0a/hydnam-1.1.2.tar.gz",
    "platform": null,
    "description": "# HydNAM\n\n![PyPI - Version](https://img.shields.io/pypi/v/hydnam)\n\n**HydNAM** is a Python implementation of the NedborAfstromnings Model (NAM), a lumped rainfall\u2013runoff model.\n\nThis project is based on the [NAM_Model](https://github.com/hckaraman/NAM_Model) created by [hckaraman](https://github.com/hckaraman). \n\n## Installation\n\n```bash\npip install hydnam\n```\n\n## Getting Started\n\n### 1. Prepare the Dataset\n\nThe dataset must contain the following properties: Date, Temperature, Precipitation, Evapotranspiration, and Discharge.\n\n| Date       | Temperature | Discharge | Precipitation | Evapotranspiration |\n|------------|-------------|-----------|---------------|--------------------|\n| 10/9/2016  | 15.4        | 0.25694   | 0             | 2.79               |\n| 10/10/2016 | 14.4        | 0.25812   | 0             | 3.46               |\n| 10/11/2016 | 14.9        | 0.30983   | 0             | 3.65               |\n| 10/12/2016 | 16.1        | 0.31422   | 0             | 3.46               |\n| 10/13/2016 | 20.1        | 0.30866   | 0             | 5.64               |\n| 10/14/2016 | 13.9        | 0.30868   | 0             | 3.24               |\n| 10/15/2016 | 11.1        | 0.31299   | 0             | 3.41               |\n| ...        | ...         | ...       | ...           | ...                |\n\nEnsure that the time intervals between dates are consistent (e.g., 24 hours) for accurate model performance.\n\n### 2. Initialize the NAM Model\n\n```python\nfrom datetime import datetime\nfrom hydnam.chart import plot_q\nfrom hydnam.dataset import Dataset\nfrom hydnam.hydnam import HydNAM\nfrom hydnam.parameters import Parameters\n\ndataset = Dataset(\n    timeseries=[\n        datetime(2016, 10, 9),\n        datetime(2016, 10, 10),\n        datetime(2016, 10, 11),\n    ],\n    temperature=[15.4, 14.4, 14.9],\n    precipitation=[0.0, 0.0, 0.0],\n    evapotranspiration=[2.79, 3.46, 3.65],\n    discharge=[0.25694, 0.25812, 0.30983]\n)\n\nparams = Parameters(\n    umax=0.01,\n    lmax=0.01,\n    cqof=0.01,\n    ckif=200.0,\n    ck12=10.0,\n    tof=0.0,\n    tif=0.0,\n    tg=0.0,\n    ckbf=500.0,\n    csnow=0.0,\n    snowtemp=0.0\n)\n\nnam = HydNAM(\n    dataset=dataset,\n    parameters=params,\n    area=58.8,\n    interval=24.0,\n    start=None,\n    end=None,\n    spin_off=0.0\n)\nprint(f'Parameters: {nam.parameters}')\nprint(f'Statistics: {nam.statistics}')\ndf = nam.simulation_result.to_dataframe()\n```\n\n### 3. Optimize the Model\n\n```\nNAM.optimize()\n```\n\nThe model will calculate and check which `Parameters` are optimal for the model and use it as the main `Parameters` for\nthe model.\n\n### 4. Customize Parameters\n\n```\nnam.set_parameters(Parameters())\n```\n\n### 5. Show Discharge\n\n```\nfrom hydnam.chart import plot_q\n...\nplot_q(nam.simulation_result, only_obs_and_sim=False).show()\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/hydnam/issues) or\nemail us at [duynguyen02.dev@gmail.com](mailto:duynguyen02.dev@gmail.com).\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Python implementation of NedborAfstromnings Model (NAM) lumped rainfall\u2013runoff model",
    "version": "1.1.2",
    "project_urls": {
        "Homepage": "https://github.com/duynguyen02/hydnam",
        "Repository": "https://github.com/duynguyen02/hydnam"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "5ac28d7258557bef0fc110a00d9502721052bab2850f97b3345ceba9da2c4122",
                "md5": "9e98d4bb5a7c6dacd667f00f986adceb",
                "sha256": "c27debb1d713cad231fb33a82ba77ab28b612a005abfd1ee335f7669f939d5a1"
            },
            "downloads": -1,
            "filename": "hydnam-1.1.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "9e98d4bb5a7c6dacd667f00f986adceb",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.10",
            "size": 8395,
            "upload_time": "2025-01-01T17:40:16",
            "upload_time_iso_8601": "2025-01-01T17:40:16.470779Z",
            "url": "https://files.pythonhosted.org/packages/5a/c2/8d7258557bef0fc110a00d9502721052bab2850f97b3345ceba9da2c4122/hydnam-1.1.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d1728c21d1ddf714744cc6f8c52299439310189133fff5b8117d43c2125d3e0a",
                "md5": "b086a90ff217a2c56250ca20778e1bb8",
                "sha256": "d5aa6dc78ae84010ac6aad404f73309e2669216ea697667b04627fcf80dbed9c"
            },
            "downloads": -1,
            "filename": "hydnam-1.1.2.tar.gz",
            "has_sig": false,
            "md5_digest": "b086a90ff217a2c56250ca20778e1bb8",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.10",
            "size": 7476,
            "upload_time": "2025-01-01T17:40:19",
            "upload_time_iso_8601": "2025-01-01T17:40:19.266151Z",
            "url": "https://files.pythonhosted.org/packages/d1/72/8c21d1ddf714744cc6f8c52299439310189133fff5b8117d43c2125d3e0a/hydnam-1.1.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-01-01 17:40:19",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "duynguyen02",
    "github_project": "hydnam",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [],
    "lcname": "hydnam"
}
        
Elapsed time: 0.40632s