|
1 | | -# hydroforecastingdemo |
| 1 | +# Hydro Forecasting Demonstrations |
2 | 2 |
|
3 | | -[](https://codecov.io/gh/fre171csiro/hydroforecastingdemo) |
4 | | -[](https://github.com/fre171csiro/hydroforecastingdemo/actions/workflows/main.yml) |
| 3 | +[](https://codecov.io/gh/hydroforecastingdemo) |
| 4 | +[](https://github.com/hydroforecastingdemo/actions/workflows/main.yml) |
5 | 5 |
|
6 | | -Awesome hydroforecastingdemo created by fre171csiro |
| 6 | +Click the [](https://mybinder.org/v2/gh/csiro-hydroinformatics/hydroforecastingdemo/main) button to run the notebooks online! |
| 7 | + |
7 | 8 |
|
8 | | -## Install it from PyPI |
| 9 | +These notebooks are demonstrations of the tools built by the [CSIRO Hydro Forecasting](https://research.csiro.au/swbo/water-forecasting-2/) - [Team](https://research.csiro.au/swbo/our-team/water_forecasting/). |
9 | 10 |
|
10 | | -```bash |
11 | | -pip install hydroforecastingdemo |
12 | | -``` |
| 11 | +The tools can be found on PYPI: |
| 12 | +- [normtransform](https://pypi.org/project/normtransform/) |
| 13 | +- [bypmodel](https://pypi.org/project/bjpmodel/) |
13 | 14 |
|
14 | | -## Usage |
15 | | - |
16 | | -```py |
17 | | -from hydroforecastingdemo import BaseClass |
18 | | -from hydroforecastingdemo import base_function |
19 | | - |
20 | | -BaseClass().base_method() |
21 | | -base_function() |
22 | | -``` |
23 | | - |
24 | | -```bash |
25 | | -$ python -m hydroforecastingdemo |
26 | | -#or |
27 | | -$ hydroforecastingdemo |
28 | | -``` |
29 | | - |
30 | | -## Development |
31 | | -### Getting Started |
32 | | -**Dev setup** |
33 | | -1. Install `pyenv` if not already installed on your dev machine (see steps below), this is optional however it makes managing python easier |
34 | | -1. Install `poetry` (see steps below). `poetry` is used to manage the python environment and is a alternative to `conda` |
35 | | -1. Setup the project environment |
36 | | - 1. Using the `cmd` change directory to your code parent directory and: |
37 | | - 1. Using `pyenv` install python 3.10.10, e.g. `pyenv install 3.10.10` |
38 | | - 1. Set the local version of python - `pyenv local 3.10.10` |
39 | | - 1. Build the python environment - `poetry install` |
40 | | - 1. Activate the environment - `poetry shell` |
41 | | - 1. Open a `.ipynb` file and set the kernel to `.venv/Scripts/python.exe` |
42 | | -1. Run the unit tests (make sure the existing code is passing all tests prior to use) |
43 | | - 1. Set the workspace interpreter to `.venv/Scripts/python.exe` |
44 | | - 1. ctrl+shift+p "Select Interpreter" and select '.venv':poetry |
45 | | - 1. Open the 'tests' directory or use the VS Code test extension to run all tests |
46 | | - |
47 | | -### Installation process (Dev env) |
48 | | - |
49 | | -Python Package Manager is a Python utility intended to simplify the tasks of locating, installing, upgrading and removing Python packages. It can determine if the most recent version of a software package is installed on a system, and can install or upgrade that package from a local or remote host. [Wikipedia](https://en.wikipedia.org/wiki/Python_Package_Manager) |
50 | | - |
51 | | -1. Install (optional, but helpful) `pyenv` to manage python version for different scenarios |
52 | | ->>>'pyenv lets you easily switch between multiple versions of Python. It's simple, unobtrusive, and follows the UNIX tradition of single-purpose tools that do one thing well.' |
53 | | ->>>- [pyenv overview](https://github.com/pyenv/pyenv#getting-pyenv) |
54 | | ->>>- [pyenv linux installer](https://github.com/pyenv/pyenv-installer) |
55 | | ->>>- [pyenv windows installer](https://github.com/pyenv-win/pyenv-win) Don't forget to put pyenv in you [PATH](https://github.com/pyenv-win/pyenv-win/blob/master/docs/installation.md#add-system-settings) |
56 | | -
|
57 | | -[This](https://blog.teclado.com/how-to-use-pyenv-manage-python-versions/) is a useful page explaining the use of pyenv. |
58 | | - |
59 | | -2. Install `poetry` to manage project/venv dependencies |
60 | | ->>We use [poetry](https://python-poetry.org/docs/) to manage the python environment and dependencies. If you don't have poetry installed please [install](https://python-poetry.org/docs/#installing-with-the-official-installer) it in your base environment and add poetry to your PATH. |
61 | | -
|
62 | | ->>[Basic usage](https://python-poetry.org/docs/basic-usage/) will help get you started using poetry. If `pyproject.toml` does not exist in the project directory you can use `poetry init`. If the project already has a `pyproject.toml` file you can just use `poetry install` and all dependencies will be installed in a environment folder `.venv` and a local lock file (`poetry.lock`) generated. To add further dependencies run `poetry add [a package name]` or to remove an existing package/dependency `postry remove [package name to remove]`. |
63 | | -
|
64 | | -I like to keep the `.venv` in my project directory so I use `poetry config --local virtualenvs.in-project true` |
65 | | - |
66 | | -You can specify a package to add in the following forms: |
67 | | - - A single name (requests): this will search for matches on PyPI |
68 | | - - A name and a constraint (requests@^2.23.0) |
69 | | - - A git url (git+https://github.com/python-poetry/poetry.git) |
70 | | - - A git url with a revision (git+https://github.com/python-poetry/poetry.git#develop) |
71 | | - - A file path (../my-package/my-package.whl) |
72 | | - - A directory (../my-package/) |
73 | | - - A url (https://example.com/packages/my-package-0.1.0.tar.gz) |
74 | | - |
75 | | -*Note*: Some systems will use a `requirements.txt` to build a python environment, therefore to easily generate a the `requirements.txt` run `refresh_requirements.sh` after any changes to the packages made with `poetry` |
76 | | - |
77 | | -## Notebooks/Lab books |
78 | | -These can be used within Visual Studio Code or run in your local browser |
79 | | - |
80 | | -If running in a Web browser users will need to install the kernel with `python -m ipykernel install --user --name .venv --display-name outlook-hydro`, which needs to be executed from the command prompt prior to opening the notebook. Then when loading the notebook select the named `outlook-hydro` kernal. |
81 | | - |
82 | | -To run in your browser open a terminal (make sure you have activated your environment) with the root folder and type `jupyter notebook` this will load a Jupyter Notebook in your browser. If you replace the url ending 'tree' with 'lab' the server should load a lab book which is more user friendly |
83 | | - |
84 | | -Read the [CONTRIBUTING.md](CONTRIBUTING.md) file. |
85 | | - |
86 | | -## Acknowledgments |
87 | | -[rockacbruno](https://github.com/rochacbruno) and his template https://github.com/rochacbruno/python-project-template |
0 commit comments