diff --git a/.github/workflows/build-test-conda.yml b/.github/workflows/build-test-conda.yml new file mode 100644 index 0000000..abcfb82 --- /dev/null +++ b/.github/workflows/build-test-conda.yml @@ -0,0 +1,38 @@ +name: Build and test using Conda + +on: + push: + branches: [ main, development ] + pull_request: + branches: [ main, development ] + +jobs: + build-linux: + runs-on: ubuntu-latest + strategy: + max-parallel: 5 + + steps: + - uses: actions/checkout@v2 + - name: Set up Python 3.9 + uses: actions/setup-python@v2 + with: + python-version: 3.9 + - name: Add conda to system path + run: | + # $CONDA is an environment variable pointing to the root of the miniconda directory + echo $CONDA/bin >> $GITHUB_PATH + - name: Install dependencies + run: | + conda env update --file env-prod.yml --name base + - name: Lint with flake8 + run: | + conda install flake8 + # stop the build if there are Python syntax errors or undefined names + flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics + # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide + flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics + - name: Test with pytest + run: | + conda install pytest + pytest diff --git a/.github/workflows/codecov-conda.yml b/.github/workflows/codecov-conda.yml new file mode 100644 index 0000000..92b0b6d --- /dev/null +++ b/.github/workflows/codecov-conda.yml @@ -0,0 +1,39 @@ +name: Upload coverage to Codecov + +on: [push] + +jobs: + run: + runs-on: ubuntu-latest + env: + OS: ubuntu-latest + PYTHON: '3.9' + steps: + - uses: actions/checkout@master + - name: Setup Python + uses: actions/setup-python@master + with: + python-version: 3.9 + - name: Add conda to system path + run: | + # $CONDA is an environment variable pointing to the root of the miniconda directory + echo $CONDA/bin >> $GITHUB_PATH + - name: Install dependencies + run: | + conda env update --file env-prod.yml --name base + - name: Generate coverage report + run: | + conda install -c conda-forge pytest pytest-cov -y + pytest --cov=./ --cov-report=xml + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v2 + with: + token: ${{ secrets.CODECOV_TOKEN }} + directory: ./coverage/reports/ + env_vars: OS,PYTHON + fail_ci_if_error: true + files: ./coverage1.xml,./coverage2.xml + flags: unittests + name: codecov-umbrella + path_to_write_report: ./coverage/codecov_report.txt + verbose: true diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml new file mode 100644 index 0000000..a4d6fc8 --- /dev/null +++ b/.github/workflows/codeql-analysis.yml @@ -0,0 +1,70 @@ +# For most projects, this workflow file will not need changing; you simply need +# to commit it to your repository. +# +# You may wish to alter this file to override the set of languages analyzed, +# or to provide custom queries or build logic. +# +# ******** NOTE ******** +# We have attempted to detect the languages in your repository. Please check +# the `language` matrix defined below to confirm you have the correct set of +# supported CodeQL languages. +# +name: "CodeQL" + +on: + push: + branches: [ main ] + pull_request: + # The branches below must be a subset of the branches above + branches: [ main ] + schedule: + - cron: '19 17 * * 6' + +jobs: + analyze: + name: Analyze + runs-on: ubuntu-latest + permissions: + actions: read + contents: read + security-events: write + + strategy: + fail-fast: false + matrix: + language: [ 'python' ] + # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ] + # Learn more about CodeQL language support at https://git.io/codeql-language-support + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@v1 + with: + languages: ${{ matrix.language }} + # If you wish to specify custom queries, you can do so here or in a config file. + # By default, queries listed here will override any specified in a config file. + # Prefix the list here with "+" to use these queries and those in the config file. + # queries: ./path/to/local/query, your-org/your-repo/queries@main + + # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). + # If this step fails, then you should remove it and run the build manually (see below) + - name: Autobuild + uses: github/codeql-action/autobuild@v1 + + # ℹ️ Command-line programs to run using the OS shell. + # 📚 https://git.io/JvXDl + + # ✏️ If the Autobuild fails above, remove it and uncomment the following three lines + # and modify them (or add more) to build your code if your project + # uses a compiled language + + #- run: | + # make bootstrap + # make release + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v1 diff --git a/.github/workflows/greetings.yml b/.github/workflows/greetings.yml new file mode 100644 index 0000000..52a50f6 --- /dev/null +++ b/.github/workflows/greetings.yml @@ -0,0 +1,16 @@ +name: Greetings + +on: [pull_request, issues] + +jobs: + greeting: + runs-on: ubuntu-latest + permissions: + issues: write + pull-requests: write + steps: + - uses: actions/first-interaction@v1 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + issue-message: 'Welcome to RUBEM community! Thanks so much for creating your first issue :)' + pr-message: 'Thanks so much for creating your first PR, the RUBEM community thanks you :)' diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml new file mode 100644 index 0000000..ff96bf3 --- /dev/null +++ b/.github/workflows/stale.yml @@ -0,0 +1,25 @@ +name: Close inactive issues +on: + schedule: + - cron: "30 1 * * *" + +jobs: + close-issues: + runs-on: ubuntu-latest + permissions: + issues: write + pull-requests: write + steps: + - uses: actions/stale@v3 + with: + days-before-issue-stale: 30 + days-before-issue-close: 14 + stale-issue-label: "stale" + stale-pr-label: 'stale' + stale-issue-message: "This issue is stale because it has been open for 30 days with no activity." + close-issue-message: "This issue was closed because it has been inactive for 14 days since being marked as stale." + stale-pr-message: "This pull request is stale because it has been open for 45 days with no activity." + close-pr-message: "This pull request was closed because it has been inactive for 30 days since being marked as stale." + days-before-pr-stale: 45 + days-before-pr-close: 30 + repo-token: ${{ secrets.GITHUB_TOKEN }} diff --git a/LICENSE.md b/LICENSE similarity index 98% rename from LICENSE.md rename to LICENSE index bf4af6f..2512c00 100644 --- a/LICENSE.md +++ b/LICENSE @@ -631,9 +631,14 @@ to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. +<<<<<<< HEAD:LICENSE.md RUBEM is a distributed hydrological model to calculate monthly flows with changes in land use over time. Copyright (C) 2020-2022 LabSid PHA EPUSP +======= + Rainfall rUnoff Balance Enhanced Model distributed hydrological model + Copyright (C) 2020-2021 LabSid-PHA-EPUSP +>>>>>>> 75-update-datasets-download-links-on-the-doc-pages:LICENSE This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -653,7 +658,11 @@ Also add information on how to contact you by electronic and paper mail. If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: +<<<<<<< HEAD:LICENSE.md RUBEM Copyright (C) 2020-2022 LabSid PHA EPUSP +======= + RUBEM Copyright (C) 2020-2021 LabSid-PHA-EPUSP +>>>>>>> 75-update-datasets-download-links-on-the-doc-pages:LICENSE This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. @@ -672,4 +681,4 @@ into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read -. \ No newline at end of file +. diff --git a/README.md b/README.md index 7a21c24..20f3d5e 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,12 @@ [![Documentation Status][readthedocs-shield]][readthedocs-url] +[![Contributors][contributors-shield]][contributors-url] +[![GitHub Commit Activity][commit-activity-shield]][commit-activity-url] +[![Forks][forks-shield]][forks-url] +[![Stargazers][stars-shield]][stars-url] +[![Issues][issues-shield]][issues-url] +[![LabSid YouTube Channel][youtube-shield]][youtube-url] +
@@ -7,10 +14,7 @@ Logo - -

RUBEM

-

Rainfall rUnoff Balance Enhanced Model

- +

RUBEM
Rainfall rUnoff Balance Enhanced Model

RUBEM is a distributed hydrological model to calculate monthly flows with changes in land use over time.
@@ -42,7 +46,6 @@

  • Usage
  • @@ -166,4 +169,18 @@ In any of our communication channels please abide by the [RUBEM Code of Conduct] [readthedocs-shield]: https://readthedocs.org/projects/rubem/badge/?version=latest -[readthedocs-url]: https://rubem.readthedocs.io/en/latest/?badge=latest \ No newline at end of file +[readthedocs-url]: https://rubem.readthedocs.io/en/latest/?badge=latest +[contributors-shield]: https://img.shields.io/github/contributors/LabSid-USP/RUBEM +[contributors-url]: https://github.com/LabSid-USP/RUBEM/graphs/contributors +[commit-activity-shield]: https://img.shields.io/github/commit-activity/m/LabSid-USP/RUBEM +[commit-activity-url]: https://github.com/LabSid-USP/RUBEM/pulse +[forks-shield]: https://img.shields.io/github/forks/LabSid-USP/RUBEM +[forks-url]: https://github.com/LabSid-USP/RUBEM/network/members +[stars-shield]: https://img.shields.io/github/stars/LabSid-USP/RUBEM +[stars-url]: https://github.com/LabSid-USP/RUBEM/stargazers +[issues-shield]: https://img.shields.io/github/issues/LabSid-USP/RUBEM +[issues-url]: https://github.com/LabSid-USP/RUBEM/issues +[license-shield]: https://img.shields.io/github/license/LabSid-USP/RUBEM +[license-url]: https://github.com/LabSid-USP/RUBEM/blob/master/LICENSE.md +[youtube-shield]: https://img.shields.io/youtube/channel/subscribers/UCZOGKRCW5mQOY9_w8L7lKJg +[youtube-url]: https://www.youtube.com/user/labsidengbr diff --git a/doc/requirements.txt b/doc/requirements.txt index a1ed411..f55bc2a 100644 --- a/doc/requirements.txt +++ b/doc/requirements.txt @@ -2,4 +2,4 @@ Sphinx==4.2.0 sphinx-rtd-theme==1.0.0 sphinxcontrib-email==0.3.5 sphinxcontrib-youtube==1.0.1 -sphinx-autodoc-typehints=1.12.0 \ No newline at end of file +sphinx-autodoc-typehints==1.12.0 diff --git a/doc/source/datasets.rst b/doc/source/datasets.rst index 7239ecf..0ed9341 100644 --- a/doc/source/datasets.rst +++ b/doc/source/datasets.rst @@ -12,7 +12,7 @@ Upper Iguaçu River Basin (UIRB) Upper Iguaçu basin is located in the south portion of Brazil. The Iguaçu River is a tributary of the Paraná River and is also the longest river in the state of Paraná. It is formed by the meeting of the Iraí and Atuba rivers, in the eastern part of the Paraná municipality of Curitiba. Among the main tributaries are: Itaqui, Piraquara, Atuba, Palmital, Barigui, Miringuava, Passaúna and Verde rivers. The basin provides the water consumed in the metropolitan area of Curitiba. -`Download here `__ | `Alternative link `__ +`Download here `__ | `Alternative link `__ - **Data Format:** GeoTIFF and PCRaster raster files, .txt; - **Size:** 222 MB @@ -42,7 +42,7 @@ Piracicaba River Basin (PRB) The Piracicaba River Basin is located in the southeastern portion of Brazil in a continental plateau regime. The Piracicaba River is a tributary of the Tietê River, and is an interstate river as some sources of the rivers that make up its basin are found in the State of Minas Gerais. The Piracicaba river basin is formed by the sub-basins of the Jaguari, Atibaia, Piracicaba, Camanducaia and Corumbataí rivers. Three important dams located at the basin, provide an expressive portion of the water consumed in the metropolitan area of Sao Paulo. -`Download here `__ | `Alternative link `__ +`Download here `__ | `Alternative link `__ - **Data Format:** GeoTIFF and PCRaster raster files, .txt; - **Size:** 1,73 GB @@ -75,7 +75,7 @@ The route of the Ipojuca River, with about 320 km, oriented in the west-east dir Its main tributaries, on the right bank, are Liberal stream, Taquara stream and Mel stream and, on the left bank, Coutinho stream, Mocós stream, Muxoxo stream and Pata Choca stream. Liberal creek, its most important tributary, has its sources in the municipality of Alagoinha. It drains along its 47km of extension, areas of the municipalities of Alagoinha, Pesqueira and Sanharó, and flows into the Ipojuca river.The basin provides an expressive portion of the water consumed in the metropolitan area of Recife. -`Download here `__ | `Alternative link `__ +`Download here `__ | `Alternative link `__ - **Data Format:** GeoTIFF and PCRaster raster files, .txt; @@ -97,4 +97,4 @@ Its main tributaries, on the right bank, are Liberal stream, Taquara stream and - Maps of Gridded Basin Characteristics (Land use maps, Soil map, DEM); - Tables of soil and landuse parameters. -- **References:** :any:`Mello Júnior et al. 2021 ` \ No newline at end of file +- **References:** :any:`Mello Júnior et al. 2021 ` diff --git a/doc/source/index.rst b/doc/source/index.rst index 89f658e..8116d17 100644 --- a/doc/source/index.rst +++ b/doc/source/index.rst @@ -12,7 +12,7 @@ Welcome to Rainfall rUnoff Balance Enhanced Model (RUBEM)'s documentation! RUBEM stands for "Rainfall rUnoff Balance Enhanced Model". It is a distributed hydrological model to calculate the hydrological mass balance. The physical process of the mass balance in the soil layer is described to calculate the recharge, interception, evapotranspiration, and runoff. -Development and maintenance of the current official version of the RUBEM is led by the `Laboratório de Sistemas de Suporte a Decisões em Engenharia Ambiental e Recursos Hídricos (LabSid) `_ in the `Departamento de Engenharia Hidráulica e Ambiental `_ at the `Escola Politécnica da Universidade de São Paulo `_. The RUBEM Hydrological plugin for QGIS is an open source development project, which means that contributions are welcome, including to the plugin documentation. +Development and maintenance of the current official version of the RUBEM is led by the `Laboratório de Sistemas de Suporte a Decisões em Engenharia Ambiental e Recursos Hídricos (LabSid) `_ in the `Departamento de Engenharia Hidráulica e Ambiental `_ at the `Escola Politécnica da Universidade de São Paulo `_. The RUBEM distributed hydrological model is an open source development project, which means that contributions are welcome, including to the plugin documentation. All development activity is coordinated via the `RUBEM Github page `_, where you can also find all archived, current, beta, and development versions of this model. diff --git a/env-dev.yml b/env-dev.yml new file mode 100644 index 0000000..953a045 --- /dev/null +++ b/env-dev.yml @@ -0,0 +1,8 @@ +channels: + - conda-forge + - defaults +dependencies: + - python=3.10 + - gdal + - pandas + - pcraster \ No newline at end of file diff --git a/env-prod.yml b/env-prod.yml new file mode 100644 index 0000000..cdefcb8 --- /dev/null +++ b/env-prod.yml @@ -0,0 +1,8 @@ +channels: + - conda-forge + - defaults +dependencies: + - python=3.9 + - gdal=3.* + - pandas=1.* + - pcraster=4.* \ No newline at end of file