IHEWAdataanalysis

This is the documentation of IHEWAdataanalysis.

IHEWAdataanalysis is a tool to write report by using templates. This project is fully developed by Water Accounting team at IHE-Delft.

Installation

Install from pip

IHEWAdataanalysis Python package is hosted on Python Package Index (PyPI).

Install from pip.

$ pip install IHEWAdataanalysis

Install from source code

Download source code from Github.

$ git clone https://github.com/wateraccounting/IHEWAdataanalysis.git
$ cd IHEWAdataanalysis

Install from source code.

$ python setup.py install

Uninstall IHEWAdataanalysis

$ pip uninstall IHEWAdataanalysis

Docker

Set “System -> Base Memory” to max capacity in Virtual Machine.

Set “Shared Folders” in Virtual Machine.

  • Folder Path: D:\IHEWAdataanalysis

  • Folder Name: d/IHEWAdataanalysis

  • Auto-mount: Yes

  • Make Permanent: Yes

Download source code from Github.

$ git clone https://github.com/wateraccounting/IHEWAdataanalysis.git
$ cd IHEWAdataanalysis

Restart Docker Virtual Machine image.

$ docker-machine restart

Pull the IHEWAdataanalysis image.

$ docker pull wateraccounting/ihewadataanalysis

Or build from source code.

$ docker build -t wateraccounting/ihewadataanalysis .

Check images.

$ docker images

Check ip address.

$ docker-machine env
export DOCKER_HOST="tcp://192.168.99.100:2376"

Run the image with Jupyter Notebook. To access Jupyter http://192.168.99.100:8888/

$ docker run -it --name ihewadataanalysis -p 8888:8888 -v /d/IHEWAdataanalysis:/notebooks wateraccounting/ihewadataanalysis

Check running image (container), in the new cmd window.

$ docker container list

Access to running image, in the new cmd window.

$ docker exec -it ihewadataanalysis bash

$ cd /notebooks/

$ python3 setup.py install
$ python3 ./examples/ex_CFSR_GRIB.py

Clean running cache.

$ docker system prune -f && docker volume prune -f && docker container prune -f

Remove image.

$ docker rmi wateraccounting/ihewadataanalysis

Use

Examples can be found at examples.

import os
import IHEWAdataanalysis

path = os.getcwd()
config = 'config.yml'
file_config = os.path.join(path, config)

if os.path.exists(file_config):
    IHEWAdataanalysis.Report(workspace=path,
                       config=config)

)

Development

In the PyCharm, change “Project Structure -> Source Folders” to “src”

Download source code from Github.

$ git clone https://github.com/wateraccounting/IHEWAdataanalysis.git
$ cd IHEWAdataanalysis

From the root of the project

$ python setup.py --version

Format scripts by PEP8

$ autopep8 --in-place --aggressive src/IHEWAdataanalysis/base/base.py

Flake8, pre-commit

$ pre-commit install

$ pre-commit run --all-files
[INFO] Initializing environment for git://github.com/pre-commit/pre-commit-hooks.
[INFO] Initializing environment for https://github.com/pre-commit/mirrors-isort.
[INFO] Installing environment for git://github.com/pre-commit/pre-commit-hooks.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
[INFO] Installing environment for https://github.com/pre-commit/mirrors-isort.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...

Unit test

$ python setup.py test

Read the Docs

$ python setup.py doctest

$ python setup.py docs

Upload to PyPI

  1. In IDE, commit the changes “v0.0.1

  2. In IDE, Version Control -> Log, select this commit

  3. In IDE, add version tag, select VCS -> Git -> tag

  4. In IDE, Tag window -> Tag Name, type “v0.0.1

  5. In cmd, build package, type python setup.py sdist bdist_wheel

  6. In cmd, validate build, type twine check dist/IHEWAdataanalysis-0.0.1*

  7. In cmd, upload build, type twine upload dist/IHEWAdataanalysis-0.0.1*

  8. In IDE, push the commit, with Tag label: “HEAD”, “master”, “v0.0.1

  9. In Github, select Release to “create a new release” or “Draft a new release”

  10. In Github, Tag version, type “v0.0.1

  11. In Github, @ Target, select this commit

  12. In Github, Publish release

Templates

Details can be found at Templates.

Code of Conduct

  • Be friendly and patient

  • Be welcoming

  • Be considerate

  • Be respectful

  • Be careful in the words that you choose

  • When we disagree, try to understand why

Indices and tables