Python implementation of NedborAfstromnings Model (NAM) lumped rainfall–runoff model
Project description
HydNAM
HydNAM is a Python implementation of the NedborAfstromnings Model (NAM), a lumped rainfall–runoff model.
This project is based on the NAM_Model created by hckaraman.
Installation
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
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,
ignore_snow=False
)
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 or email us at duynguyen02.dev@gmail.com.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file hydnam-1.0.1.tar.gz.
File metadata
- Download URL: hydnam-1.0.1.tar.gz
- Upload date:
- Size: 8.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.4 CPython/3.12.3 Linux/6.8.0-49-generic
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cfbb72e8ce9866e9bf6dd5d991323c32c339a5c27f4c84fc6c94b8e7c906da43
|
|
| MD5 |
38c4e423b0648d8b351c330d0759c933
|
|
| BLAKE2b-256 |
6e38f30ac9e4f2eb638c10f0d4f3e46d1cb8d7938edb728d98a60eed620455ef
|
File details
Details for the file hydnam-1.0.1-py3-none-any.whl.
File metadata
- Download URL: hydnam-1.0.1-py3-none-any.whl
- Upload date:
- Size: 9.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.4 CPython/3.12.3 Linux/6.8.0-49-generic
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e454644e6644fd3bdf5872becd5e6a09239f66135f9ed0c8dc43e80696ee175e
|
|
| MD5 |
d625c1e3593576f9a1cb2ee434c09756
|
|
| BLAKE2b-256 |
096e0a404da306704c2ed0b94c48274753d10fd9d6a88f793915670606e9cc00
|