From 536408f57ac404972521db3382f99e7a8497bb62 Mon Sep 17 00:00:00 2001 From: KilinW Date: Mon, 1 Jul 2024 17:02:01 +0800 Subject: [PATCH] Dev1 (#23) * Fix the probme when alpha is too low the result is incorrect. * ignore slice type limit (int) * Fix ruff syntax * add pyright config and type ignore * Fix type in rcimodel and remove responsibility of scale from Indexsnapshot * Remove floating point error in intensity. * Fix tox (mypy) * IndexedSnapshop accept nan value inside with corrsponding tests. * Tests for input data with NAN values. * Quick_start and some features in blrprx model. * Delete useless file. * Fix some typing and linting for mypy and ruff. * Fix tox and use poetry correctly. Minor text change in quick_start.py. * Testing Github workflow doc generation. * Fixing python 3.10 treated as 3.1. Now using 3.11. * Publish the 1.0.0 pyblrp. Change theme of doc. * Fix doc theme package name. * Fix the READMD url and image trasparency. * Fix s some requirements.txt files and tox.ini settings for mypy and ruff using poetry export command. * Remove hash from requirements.txt requirements-dev.txt and docs/requirements-doc.txt * Only run mypy and ruff on ubuntu-latest. * Fix github action envs. * Fix github action envs. * Fix github action.: * Fix github action. * Remove doc building from tox.ini. * Remove all requirements.txt files and rename doce building github action. * Fix Doc building with github action. * Fix tox.ini for python3.12. * Fix github action python version. Remove blue underscore of badges in README.md. * Adding Documentation link to README.md. * Fine tuning on github action for performance. * Rename the github action name. * Rename the github action name. * Rename the github action name. --- .github/workflows/docs.yml | 41 ++ .github/workflows/lint.yml | 29 + .github/workflows/{tests.yml => test.yml} | 8 +- README.md | 55 +- docs/requirements-doc.txt | 30 - docs/source/conf.py | 2 +- poetry.lock | 768 ++++++++++++---------- pyproject.toml | 8 +- requirements-dev.txt | 71 -- requirements.txt | 9 - tox.ini | 7 +- 11 files changed, 507 insertions(+), 521 deletions(-) create mode 100644 .github/workflows/docs.yml create mode 100644 .github/workflows/lint.yml rename .github/workflows/{tests.yml => test.yml} (83%) delete mode 100644 docs/requirements-doc.txt delete mode 100644 requirements-dev.txt delete mode 100644 requirements.txt diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml new file mode 100644 index 0000000..ef2cf55 --- /dev/null +++ b/.github/workflows/docs.yml @@ -0,0 +1,41 @@ +name: Docs + +on: + push: + branches: + - main + - dev1 + +jobs: + build-and-deploy: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Setup up Python + uses: actions/setup-python@v2 + with: + python-version: 3.11 + + - name: Install poetry + run: | + python -m pip install --upgrade pip + pip install poetry + + - name: Install dependencies + run: | + poetry install --only doc + + - name: Build docs + run: | + poetry run sphinx-build -M html docs/source docs/build + + - name: Deploy to GitHub Pages + if: github.ref == 'refs/heads/dev1' + uses: peaceiris/actions-gh-pages@v3 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: docs/build/html + \ No newline at end of file diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000..c80b1bb --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,29 @@ +name: Lint + +on: + - push + - pull_request + +jobs: + linting-with-mypy-and-ruff: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ['3.10'] # Adjust as necessary based on your setup + + steps: + - uses: actions/checkout@v2 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install poetry + - name: Install dependencies with Poetry + run: poetry install + - name: Run mypy + run: poetry run tox -e mypy + - name: Run ruff + run: poetry run tox -e ruff \ No newline at end of file diff --git a/.github/workflows/tests.yml b/.github/workflows/test.yml similarity index 83% rename from .github/workflows/tests.yml rename to .github/workflows/test.yml index f16313d..d4d57b5 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/test.yml @@ -1,16 +1,16 @@ -name: Tests +name: Test on: - push - pull_request jobs: - tests: + testing-with-pytest: runs-on: ${{ matrix.os }} strategy: matrix: os: [ubuntu-latest, windows-latest, macos-latest] - python-version: ['3.9', '3.10', '3.11'] + python-version: ['3.9', '3.10', '3.11', '3.12'] include: - os: ubuntu-latest envs: ruff,mypy # Specify environments to run only on Ubuntu @@ -30,4 +30,4 @@ jobs: - name: Test using poetry run tox run: | - poetry run tox \ No newline at end of file + poetry run tox -e py${{ matrix.python-version }} diff --git a/README.md b/README.md index 3e921fd..1222fa0 100644 --- a/README.md +++ b/README.md @@ -10,25 +10,21 @@

pyBL: An open-source Python package for stochastic modeling of rainfall using the Bartlett-Lewis Rectangular Pulse model.

- - - - - - + + + + +

-

- Key Features • - Model Description • - Workflow of pyBL • - Installation Guide • - Usage • - - - - References -

+## Table of Content + +- [Key Features](#key-features) +- [Model Description](#model-description) +- [Installation](#installation-guide) +- [Getting Started](#workflow-of-pyBL) +- Documentation: https://ntu-comphydromet-lab.github.io/pyBL/ + ## Key Features - **Realistic rainfall Modelling**: Simulations of rainfall time series with realistic feaytures using the Bartlett-Lewis Rectangular Pulse model. @@ -42,6 +38,11 @@ The Bartlett-Lewis Rectangular Pulses model, enhanced in this package, draws on ![fig01-RBL](https://raw.githubusercontent.com/NTU-CompHydroMet-Lab/pyBL/main/assets/fig01-RBL.png) +## Installation Guide +To install the pyBL package, simply install with `pip`. +```bash + pip install pyblrp +``` ## Workflow of pyBL @@ -55,34 +56,20 @@ The pyBL package employs a systematic workflow to generate synthetic rainfall ti - Sampling storms and generating synthetic rainfall time series. - Rescaling and validating the synthesized time series. +You can refer to the tutorial in [**`examples/quick_start`**](https://github.com/NTU-CompHydroMet-Lab/pyBL/blob/main/examples/quick_start/quick_start.ipynb). + ![fig02-package-workflow](https://raw.githubusercontent.com/NTU-CompHydroMet-Lab/pyBL/main/assets/fig02-package-workflow.png) -## Installation Guide - -To install the pyBL package, follow these steps: - -1. **Clone the project:** - - ```sh - git clone https://github.com/NTU-CompHydroMet-Lab/pyBL.git - cd pyBL - ``` -2. **Install dependencies:** - - ```sh - pip install -r requirements.txt - ``` - ## Usage Here's a simple example of how to use the pyBL package: -1. **Start quickly**: Begin with `quick_start.py`, which demonstrates the end-to-end process using historical rainfall data from Bochum, Germany. +1. **Start quickly**: Begin with [**`examples/quick_start`**](https://github.com/NTU-CompHydroMet-Lab/pyBL/blob/main/examples/quick_start/quick_start.ipynb), which demonstrates the end-to-end process using historical rainfall data from Bochum, Germany.