Skip to content

Commit

Permalink
feat: Sentinel-1 water extraction
Browse files Browse the repository at this point in the history
  • Loading branch information
l0b0 committed Mar 28, 2023
1 parent 93b8113 commit eca587b
Show file tree
Hide file tree
Showing 18 changed files with 2,387 additions and 66 deletions.
4 changes: 4 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ updates:
directory: /
schedule:
interval: daily
- package-ecosystem: pip
directory: /flooding/sentinel1_water_extraction
schedule:
interval: daily
- package-ecosystem: pip
directory: /flooding/sentinel2_water_extraction
schedule:
Expand Down
41 changes: 26 additions & 15 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,19 @@ jobs:
- name: Run test
run: nix-shell --pure --run 'LC_MESSAGES=C TZ=UTC mocha'

test-sentinel2-water-extraction-nix:
name: Test Sentinel-2 water extraction using Nix
test-sentinel-water-extraction-nix:
name: Test Sentinel-${{ matrix.sentinel }} using Nix
runs-on: ubuntu-22.04
defaults:
run:
working-directory: flooding/sentinel2_water_extraction
working-directory:
flooding/sentinel${{ matrix.sentinel }}_water_extraction
strategy:
fail-fast: false
matrix:
sentinel:
- "1"
- "2"
steps:
- name: Check out repository
uses: actions/[email protected]
Expand All @@ -76,17 +83,18 @@ jobs:
- name: Run test
run:
nix-shell --pure --run 'jupyter nbconvert --debug --execute --inplace
--to=notebook sentinel2_water_extraction.ipynb'
--to=notebook sentinel${{ matrix.sentinel }}_water_extraction.ipynb'

test-sentinel2-water-extraction-poetry:
test-sentinel-water-extraction-poetry:
name:
Test on ${{ matrix.runner }}, using Poetry with Python ${{ matrix.python
}}
Test Sentinel-${{ matrix.sentinel }} on ${{ matrix.runner }}, using Poetry
with Python ${{ matrix.python }}
runs-on: ${{ matrix.runner }}
defaults:
run:
shell: bash --login -o errexit {0} # https://github.com/conda-incubator/setup-miniconda/tree/7e642bb2e4ca56ff706818a0febf72bb226d348d#use-a-default-shell
working-directory: flooding/sentinel2_water_extraction
working-directory:
flooding/sentinel${{ matrix.sentinel }}_water_extraction
strategy:
fail-fast: false
matrix:
Expand All @@ -99,6 +107,9 @@ jobs:
- "3.9"
- "3.10"
- "3.11"
sentinel:
- "1"
- "2"
include:
- runner: macos-12
pip-cache-dir: ~/Library/Caches/pip
Expand All @@ -116,8 +127,8 @@ jobs:
path: ${{ matrix.pip-cache-dir }}
key:
${{ runner.os }}-pip-${{ secrets.CACHE_SEED }}-${{ matrix.python
}}-${{
hashFiles('./flooding/sentinel2_water_extraction/poetry.lock') }}
}}-${{ hashFiles('./flooding/sentinel${{ matrix.sentinel
}}_water_extraction/poetry.lock') }}
restore-keys:
${{ runner.os }}-pip-${{ secrets.CACHE_SEED }}-${{ matrix.python }}

Expand Down Expand Up @@ -150,24 +161,24 @@ jobs:
with:
timeout_minutes: 9999 # Workaround for https://github.com/nick-fields/retry/issues/107
max_attempts: 6
command: bash --login -o errexit -c 'cd
flooding/sentinel2_water_extraction && poetry install --only=main
command: bash --login -o errexit -c 'cd flooding/sentinel${{
matrix.sentinel }}_water_extraction && poetry install --only=main
--no-root' # Workaround for https://github.com/python-poetry/poetry/issues/7363 / https://github.com/nick-fields/retry/issues/89
shell: bash
if: ${{ startsWith(runner.os, 'Windows') }}

- name: Run test
run:
poetry run jupyter nbconvert --debug --execute --inplace --to=notebook
sentinel2_water_extraction.ipynb
sentinel${{ matrix.sentinel }}_water_extraction.ipynb

finalise:
if: always()
needs:
- lint
- test-machine-readable-to-human-readable-date-time
- test-sentinel2-water-extraction-nix
- test-sentinel2-water-extraction-poetry
- test-sentinel-water-extraction-nix
- test-sentinel-water-extraction-poetry
runs-on: ubuntu-22.04
steps:
- name: Decide whether the needed jobs succeeded or failed
Expand Down
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ support emergency events

Current automated processes

### [Flood Water Extraction](flooding/sentinel2_water_extraction/README.md)
### [Radar Flood Water Extraction](flooding/sentinel2_water_extraction/README.md)

Jupyter Notebook for extracting water from Sentinel 2 imagery.
Jupyter Notebook for extracting water from Sentinel 1 radar imagery.

### [Optical Flood Water Extraction](flooding/sentinel2_water_extraction/README.md)

Jupyter Notebook for extracting water from Sentinel 2 optical imagery.
File renamed without changes.
9 changes: 9 additions & 0 deletions flooding/sentinel1_water_extraction/.envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/env bash
# the shebang is ignored, but nice for editors

if type -P lorri &>/dev/null; then
eval "$(lorri direnv)"
else
echo 'while direnv evaluated .envrc, could not find the command "lorri" [https://github.com/nix-community/lorri]'
use nix
fi
1 change: 1 addition & 0 deletions flooding/sentinel1_water_extraction/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Sentinel-1 Water Extraction
2 changes: 2 additions & 0 deletions flooding/sentinel1_water_extraction/out/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*
!/.gitignore
Loading

0 comments on commit eca587b

Please sign in to comment.