Skip to content

Commit

Permalink
Merge pull request #1 from storm-fsv-cvut/alternative_dt_change_design
Browse files Browse the repository at this point in the history
Alternative dt change design
  • Loading branch information
kubsta authored Mar 19, 2024
2 parents bee8ae2 + 13bb7d4 commit d34333f
Show file tree
Hide file tree
Showing 638 changed files with 80,457 additions and 70,550 deletions.
68 changes: 43 additions & 25 deletions .github/workflows/cmd_provider.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,40 +9,58 @@ on:
- master

jobs:
smoderp2d-quicktest:
strategy:
matrix:
python-version:
# - "2.7"
- "3.8"
- "3.11.2"
smoderp2d-quicktest-sheet:
uses: ./.github/workflows/cmd_template.yml
with:
pytest-suite: tests/test_cmd.py --config config_files/quicktest_sheet.ini

smoderp2d-quicktest-rill:
uses: ./.github/workflows/cmd_template.yml
with:
python-version: ${{ matrix.python-version }}
pytest-suite: tests/test_cmd.py --config quicktest.ini
pytest-suite: tests/test_cmd.py --config config_files/quicktest_rill.ini

smoderp2d-longtest:
strategy:
matrix:
python-version:
# - "2.7"
- "3.8"
- "3.11.2"
smoderp2d-quicktest-sheet-stream:
uses: ./.github/workflows/cmd_template.yml
with:
pytest-suite: tests/test_cmd.py --config config_files/quicktest_sheet_stream.ini

smoderp2d-quicktest-rill-mfda:
uses: ./.github/workflows/cmd_template.yml
with:
python-version: ${{ matrix.python-version }}
pytest-suite: tests/test_cmd.py --config test.ini
pytest-suite: tests/test_cmd.py --config config_files/quicktest_rill_mfda.ini

profile1d:
strategy:
matrix:
python-version:
- "3.8"
- "3.11.2"
smoderp2d-quicktest-stream-rill:
uses: ./.github/workflows/cmd_template.yml
with:
pytest-suite: tests/test_cmd.py --config config_files/quicktest_stream_rill.ini

smoderp2d-longtest-sheet:
uses: ./.github/workflows/cmd_template.yml
with:
pytest-suite: tests/test_cmd.py --config config_files/test_sheet.ini

smoderp2d-longtest-rill:
uses: ./.github/workflows/cmd_template.yml
with:
pytest-suite: tests/test_cmd.py --config config_files/test_rill.ini

smoderp2d-longtest-sheet-stream:
uses: ./.github/workflows/cmd_template.yml
with:
pytest-suite: tests/test_cmd.py --config config_files/test_sheet_stream.ini

smoderp2d-longtest-stream-rill-mfda:
uses: ./.github/workflows/cmd_template.yml
with:
pytest-suite: tests/test_cmd.py --config config_files/test_stream_rill_mfda.ini

smoderp2d-longtest-stream-rill:
uses: ./.github/workflows/cmd_template.yml
with:
pytest-suite: tests/test_cmd.py --config config_files/test_stream_rill.ini

profile1d:
uses: ./.github/workflows/cmd_template.yml
with:
python-version: ${{ matrix.python-version }}
pytest-suite: tests/test_profile1d.py

17 changes: 12 additions & 5 deletions .github/workflows/cmd_template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@ name: CMD provider consistency test reusable workflow
on:
workflow_call:
inputs:
python-version:
required: true
type: string
pytest-suite:
required: true
type: string
Expand All @@ -15,6 +12,11 @@ jobs:
strategy:
fail-fast: false

matrix:
python-version:
- "3.9"
- "3.11"

runs-on: ubuntu-22.04

steps:
Expand All @@ -23,11 +25,16 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ inputs.python-version }}
python-version: ${{ matrix.python-version }}

- name: Install Python dependencies
run: |
pip install -r .github/workflows/requirements${{ inputs.python-version }}.txt
pip install -r .github/workflows/requirements.txt
pip install -r .github/workflows/requirements${{ matrix.python-version }}.txt
- name: Install smoderp2d
run: |
pip install .
- name: Run command test suite
run: |
Expand Down
37 changes: 33 additions & 4 deletions .github/workflows/grass_provider.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,50 @@ on:
- master

jobs:
consistency_test:
consistency-quicktest:
strategy:
fail-fast: false

runs-on: ubuntu-22.04
container:
image: mundialis/grass-py3-pdal:latest-debian
image: osgeo/grass-gis:releasebranch_8_3-debian

steps:
- uses: actions/checkout@v3

- name: Install Python dependencies
run: |
pip3 install -r .github/workflows/requirements3.11.2.txt
pip3 install --break-system-packages -r .github/workflows/requirements.txt
pip3 install --break-system-packages -r .github/workflows/requirements3.11.txt
- name: Install smoderp2d
run: |
pip3 install --break-system-packages .
- name: Run GRASS test suite (rain_sim)
run: |
./tests/run_grass_gistest.sh rain_sim
consistency-longtest:
strategy:
fail-fast: false

runs-on: ubuntu-22.04
container:
image: osgeo/grass-gis:releasebranch_8_3-debian

steps:
- uses: actions/checkout@v3

- name: Install Python dependencies
run: |
pip3 install --break-system-packages -r .github/workflows/requirements.txt
pip3 install --break-system-packages -r .github/workflows/requirements3.11.txt
- name: Install smoderp2d
run: |
pip3 install --break-system-packages .
- name: Run GRASS test suite
run: |
grass -c tests/grassdata/smoderp2d-location/test/ --exec pytest tests/test_grass.py
./tests/run_grass_gistest.sh nucice
1 change: 1 addition & 0 deletions .github/workflows/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
configparser
3 changes: 0 additions & 3 deletions .github/workflows/requirements3.11.2.txt

This file was deleted.

4 changes: 4 additions & 0 deletions .github/workflows/requirements3.11.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
pytest
numpy==1.23.5
matplotlib==3.6.3
scipy==1.11.3
3 changes: 0 additions & 3 deletions .github/workflows/requirements3.8.txt

This file was deleted.

4 changes: 4 additions & 0 deletions .github/workflows/requirements3.9.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
pytest==7.2.2
numpy==1.20.1
matplotlib==3.5.3
scipy==1.7.3
29 changes: 15 additions & 14 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,23 @@

tests/data/log
tests/data/output*
tests/data/reference/gistest/*/dpre.extracted/
tests/data/reference/gistest/*/*/dpre.extracted/
tests/data/reference/gistest/full/*.aux.xml
tests/data/reference/gistest/full/control/*.aux.xml
tests/data/reference/dpre.extracted/
tests/grassdata/smoderp2d-location/test/
tests/grassdata/smoderp2d-location/PERMANENT/.bash_history
tests/grassdata/smoderp2d-location/PERMANENT/.bashrc
tests/grassdata/smoderp2d-location/PERMANENT/.gislock
tests/grassdata/smoderp2d-location/PERMANENT/.sudo_as_admin_successful
tests/grassdata/smoderp2d-location/PERMANENT/cell_misc/w001001/reclassed_to
tests/grassdata/smoderp2d-location/PERMANENT/hist
tests/grassdata/smoderp2d-location/stream_prep/
tests/grassdata/smoderp2d-location/water
tests/data/reference/gistest_*/*/dpre.extracted/
tests/data/reference/gistest_*/*/*/dpre.extracted/
tests/data/reference/gistest_*/dpre/control/
tests/data/reference/gistest_*/dpre/temp/
tests/data/reference/gistest_*/full/temp/
tests/data/reference/gistest_*/full/*.aux.xml
tests/data/reference/gistest_*/full/*.prj
tests/data/reference/gistest_*/*/control/*.aux.xml
tests/data/reference/gistest_*/*/temp/*.aux.xml
tests/data/reference/gistest_*/*/control/*.prj
tests/data/reference/gistest_*/*/temp/*.prj
tests/log

# build files
build
smoderp2d.egg-info

/bin/arcgis/old/

# jetbrains
Expand Down
57 changes: 40 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,24 +35,34 @@ git clone https://github.com/storm-fsv-cvut/smoderp2d.git
Build an image:

```sh
docker build -t smoderp docker/
docker build \
--tag smoderp2d:latest --file docker/Dockerfile .
```

Run SMODERP command line tool from Docker container:

```sh
docker run -v `pwd`:/opt/smoderp2d -w /opt/smoderp2d/ --rm --entrypoint \
./bin/start-smoderp2d.py smoderp \
--config tests/quicktest.ini
docker run \
-v `pwd`:/opt/smoderp2d -w /opt/smoderp2d/ --rm --entrypoint \
./bin/start-smoderp2d.py smoderp2d \
--config tests/config_files/quicktest_stream_rill.ini
```

### From command line locally
### Run locally

Build and install SMODERP2D Python package:

```sh
pip install .
```

#### Command line

```sh
./bin/start-smoderp2d.py --config tests/quicktest.ini
./bin/start-smoderp2d.py --config tests/config_files/quicktest_stream_rill.ini
```

### From GRASS GIS
#### GRASS GIS

Note: GRASS GIS 8.3+ required

Expand All @@ -71,9 +81,9 @@ Run `r.smoderp2d` module:
soil_type_fieldname=SID \
vegetation=landuse@PERMANENT \
vegetation_type_fieldname=LandUse \
rainfall_file=tests/data/rainfall.txt \
maxdt=30 end_time=40 \
points=points@PERMANENT \
rainfall_file=tests/data/rainfall_nucice.txt \
maxdt=5 end_time=5 \
points=points@PERMANENT points_fieldname='point_id' \
table_soil_vegetation=soil_veg_tab_mean@PERMANENT \
table_soil_vegetation_fieldname=soilveg \
streams=stream@PERMANENT \
Expand All @@ -82,25 +92,38 @@ Run `r.smoderp2d` module:
output=tests/data/output
```

### From ArcGIS 10.x or Pro
#### ArcGIS Pro

Launch SMODERP2D ArcToolbox from `bin\arcgis` directory.

![SMODERP2D ArcToolbox in action](img/arctoolbox.png?raw=true "SMODERP2D ArcToolbox in action")

### From QGIS
#### QGIS

Requirements: QGIS 3.28.10 and higher

Set path to the plugin from command line:
Define `QGIS_PLUGINPATH` and `PYTHONPATH` environmental variables in
`Settings -> Options -> System` and restart QGIS:

![SMODERP2D QGIS settings](img/qgis_settings.png?raw=true "QGIS settings")

Than enable SMODERP2D plugin in `Plugins -> Manage and Install Plugins...`.

Alternatively set up environment variables in command line before starting QGIS:

```sh
QGIS_PLUGINPATH=`pwd`/bin/qgis qgis tests/data/qgis_project.qgz
PYTHONPATH=`pwd` QGIS_PLUGINPATH=`pwd`/bin/qgis qgis tests/data/nucice/qgis_project.qgz
```

or define `QGIS_PLUGINPATH` in `Settings -> Options -> System` and restart QGIS:
#### Known issue

![SMODERP2D QGIS settings](img/qgis_settings.png?raw=true "QGIS settings")
On MS Windows QGIS plugin suffers by poping-up windows when starting computation.
This can be solved by copying ``core.py`` file located in ``smoderp2d\bin\qgis\grass_patch``
to a GRASS target directory.

GRASS target directory is typically located in:

- ``C:\Program Files\QGIS 3.**.*\apps\grass\grass83\etc\python\grass\script`` in the case that QGIS has been installed by standalone installer, or
- ``C:\OSGeo4W\apps\grass\grass83\etc\python\grass\script`` in the case that QGIS has been installed by OSGeo4W network installer.

And enable SMODERP2D plugin in `Plugins -> Manage and Install Plugins...`.
Update: This bug has been fixed in GRASS GIS 8.4.
Loading

0 comments on commit d34333f

Please sign in to comment.