Skip to content
forked from VForWaTer/hydrobox

hydrological preprocessing and analysis toolbox build upon pandas and numpy

License

Notifications You must be signed in to change notification settings

xyt556/hydrobox

 
 

Repository files navigation

HydroBox

Stable branch

Build Status Documentation Status codecov

Development branch

Build Status Documentation Status codecov

The HydroBox is mainly a toolbox used in the V-FOR-WaTer Project. It will be expanded to serve general hydrological data exploration with a future release.

Chair of Hydrology at the Karlsruhe Institute of Technology (KIT). The HydroBox has a submodule called toolbox, which is a collection of functions and classes that accept common numpy and pandas input formats and wrap around scipy functionality. This way can:

  • speed up common hydrological data analysis tasks
  • integrate fully with custom numpy/pandas/scipy code

Installation

Install the Hydrobox using pip. The latest version on PyPI can be installed using pip:

pip install hydrobox

There might be a more recent version on GitHub available. This can be installed like:

git clone https://github.com/mmaelicke/hydrobox.git
cd hydrobox
pip install -r requirements.txt
pip install -e .

Tests

The hydrobox module uses unittest for setting up some test. All the different TestCases are grouped into different submodules. Each of them is executable and can run the unit tests for this part of the toolbox. In case you just want to run the test of the decorators, run just that script in the tests folder.

python /path/to/hydrobox/tests/decorators.py 

    ...
    Ran 5 tests in 0.081s

    OK

Alternatively, nose is integrated to run either nosetests in the repository root or run the setup.py with the test keyword like:

python setup.py test

    ...
    ----------------------------------------------------------------------
    Ran 10 tests in 1.792s

    OK

Getting Started

Most of the tools are available either as a function or a class importet into the toolbox module. Most tools accept numpy types as input and will use them for return, as well. This way the HydroBox should integrate with your common data analysis tools. The non-plotted flow duration curve could for example be used like:

from hydrobox.toolbox import flow_duration_curve
import numpy as np

# set the seed and generate random data
np.random.seed(42)
gamma = np.random.gamma(2,2,size=20)

# run the flow duration curve without plotting
probs = flow_duration_curve(gamma, plot=False)

print('Type:', type(probs))
print(probs)
Type: numpy.ndarray
array([0.04761905, 0.0952381, 0.14285714, 0.19047619, 0.23809524, 0.28571429,  0.33333333,
    0.38095238, 0.42857143, 0.47619048, 0.52380952, 0.57142857,  0.61904762,  0.66666667,
    0.71428571, 0.76190476, 0.80952381, 0.85714286, 0.9047619,  0.95238095])

About

hydrological preprocessing and analysis toolbox build upon pandas and numpy

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%