A tool to calculate time weighted average for water level / flow.
Project description
Time weighted average for water
It is a tool to calculate time weighted average for gauged water level, flow, or something similar.
Table of contents
Installation, update and uninstallation
To install
Quick installation with pip
:
pip install time-weighted-average-for-water
Or from github:
pip install git+https://github.com/longavailable/time-weighted-average-for-water
Also, you can just copy related functions from twaw/twaw.py to your work.
To update
pip install --upgrade time-weighted-average-for-water
To uninstall
pip uninstall time-weighted-average-for-water
Usage
See tests/001-daily-average.py.
import pandas as pd
from twaw import dailyAverage
# load data
url_demodata = 'https://raw.githubusercontent.com/longavailable/datarepo02/main/data/twaw/test-data-for-twaw.csv'
data = pd.read_csv(url_demodata)
data['time'] = pd.to_datetime(data['time'])
# usages
items = ['Z', 'Q']
results1 = dailyAverage(data, itemHeader=items, timeHeader='time')
results2 = dailyAverage(data, itemHeader=['Z'], timeHeader='time')
results3 = dailyAverage(data, itemHeader='Q', timeHeader='time')
# export
newdata = pd.DataFrame(data=results1)
newdata2 = newdata.dropna(subset=items, how='all').sort_values(by=['year', 'month', 'day'])
if len(newdata2) > 0:
filename = 'test-o.csv'
newdata2.to_csv(filename, index=False)
else:
print('No data to export!')
How to cite
If this tool is useful to your research, star and cite it as below:
Xiaolong Liu. (2023, March 02). longavailable/time-weighted-average-for-water. Zenodo.
https://doi.org/10.5281/zenodo.7691849
Easily, you can import it to Mendeley.
Changelog
v0.1.0
- First release.
Todo
- Add a method description.
Project details
Release history Release notifications | RSS feed
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
Close
Hashes for time-weighted-average-for-water-0.1.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | db641464a08c8d86ee5f6e78574cd32f90dd71306f64817f989a3a44a699a93d |
|
MD5 | 621610273875dddfefe01d37e1bf3ba3 |
|
BLAKE2b-256 | 6ab54bbd5366a9a57ac16a78bea45886d552aab40621e0010d9e5a5f9807cf8d |
Close
Hashes for time_weighted_average_for_water-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5277ac2f8d128cb44970970f71cd1269d8defba5973ce7a9bf63d81a9e0c6321 |
|
MD5 | ee946da579ce54414b261198ffcc01b1 |
|
BLAKE2b-256 | 5d55f0b790a93b17b3cf8c21155cc18ecc7ab97dbc8d23381cb62bf70f0b5394 |