Skip to content

Commit

Permalink
Renaming Flompy to Floodpy
Browse files Browse the repository at this point in the history
  • Loading branch information
kleok committed Dec 14, 2022
1 parent 355c68a commit e375967
Show file tree
Hide file tree
Showing 70 changed files with 3,361 additions and 326 deletions.
2 changes: 1 addition & 1 deletion FLOMPY_env.yml → FLOODPY_env.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: flompy
name: floodpy
channel_priority: strict
channels:
- conda-forge
Expand Down
4 changes: 2 additions & 2 deletions FLOMPYapp_template.cfg → FLOODPYapp_template.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ Projectname = Palamas
# you have enough free space disk on the specific location.
projectfolder = /home/kleanthis/Palamas

#A3. The location of Flompy code
src_dir = /home/kleanthis/Projects/FLOMPY/flompy/
#A3. The location of floodpy code
src_dir = /home/kleanthis/Projects/FLOODPY/floodpy/

#A4. SNAP ORBIT DIRECTORY
snap_dir = /home/jovkleanthisyan/.snap/auxdata/Orbits/Sentinel-1
Expand Down
6 changes: 3 additions & 3 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
FLOMPY - FLOod Mapping PYthon toolbox
FLOODPY - FLOOD PYthon toolbox
Copyright (c) 2021 - 2022, Kleanthis Karamvasis

FLOMPY is free software: you can redistribute it and/or modify
FLOODPY is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

FLOMPY is distributed in the hope that it will be useful,
FLOODPY is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
Expand Down
78 changes: 39 additions & 39 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
# <img src="https://github.com/kleok/FLOMPY/blob/main/figures/Flompy_logo.png" width="58"> FLOMPY - FLOod Mapping PYthon toolbox
[![GitHub license](https://img.shields.io/badge/License-GNU3-green.svg)](https://github.com/kleok/FLOMPY)
[![Release](https://img.shields.io/badge/Release-0.2.0-brightgreen)](https://github.com/kleok/FLOMPY)
# <img src="https://github.com/kleok/FLOODPY/blob/main/figures/FLOODPY_logo.png" width="58"> FLOODPY - FLOOD PYthon toolbox
[![GitHub license](https://img.shields.io/badge/License-GNU3-green.svg)](https://github.com/kleok/FLOODPY)
[![Release](https://img.shields.io/badge/Release-0.2.0-brightgreen)](https://github.com/kleok/FLOODPY)
[![Facebook](https://img.shields.io/badge/Group-Flompy-yellowgreen.svg)](https://www.facebook.com/groups/876299509742954)
[![contributions welcome](https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=flat)](https://github.com/kleok/FLOMPY/issues)
[![Documentation](https://readthedocs.org/projects/flompy/badge/?version=latest)](https://flompy.readthedocs.io/en/latest/)
[![contributions welcome](https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=flat)](https://github.com/kleok/FLOODPY/issues)
[![Documentation](https://readthedocs.org/projects/floodpy/badge/?version=latest)](https://floodpy.readthedocs.io/en/latest/)

## Introduction

The FLOod Mapping PYthon toolbox is a free and open-source python toolbox for mapping of floodwater. It exploits the dense Sentinel-1 GRD intensity time series and is based on four processing steps. In the first step, a selection of Sentinel-1 images related to pre-flood (baseline) state and flood state is performed. In the second step, the preprocessing of the selected images is performed in order to create a co-registered stack with all the pre-flood and flood images. In the third step, a statistical temporal analysis is performed and a t-score map that represents the changes due to flood event is calculated. Finally, in the fourth step, a multi-scale iterative thresholding algorithm based on t-score map is performed to extract the final flood map. We believe that the end-user community can benefit by exploiting the FLOMPY's floodwater maps.
The FLOod Mapping PYthon toolbox is a free and open-source python toolbox for mapping of floodwater. It exploits the dense Sentinel-1 GRD intensity time series and is based on four processing steps. In the first step, a selection of Sentinel-1 images related to pre-flood (baseline) state and flood state is performed. In the second step, the preprocessing of the selected images is performed in order to create a co-registered stack with all the pre-flood and flood images. In the third step, a statistical temporal analysis is performed and a t-score map that represents the changes due to flood event is calculated. Finally, in the fourth step, a multi-scale iterative thresholding algorithm based on t-score map is performed to extract the final flood map. We believe that the end-user community can benefit by exploiting the FLOODPY's floodwater maps.

This is research code provided to you "as is" with NO WARRANTIES OF CORRECTNESS. Use at your own risk.

<img src="https://github.com/kleok/FLOMPY/blob/main/figures/pinieios_results_github.png" width="900">
<img src="https://github.com/kleok/FLOODPY/blob/main/figures/pinieios_results_github.png" width="900">

## 1. Installation

The installation notes below are tested only on Linux. Recommended minimum setup: Python 3.6, SNAP 8.0

### 1.1 Install snap gpt including [Sentinel-1 toolbox](https://step.esa.int/main/download/snap-download/previous-versions/)

For the installation of ESA SNAP you can run the automated script [aux/install_snap.sh](https://github.com/kleok/FLOMPY/blob/main/aux/install_snap.sh) for downloading and installing the official Linux installer from the official ESA repository. To install SNAP run the following commands:
For the installation of ESA SNAP you can run the automated script [aux/install_snap.sh](https://github.com/kleok/FLOODPY/blob/main/aux/install_snap.sh) for downloading and installing the official Linux installer from the official ESA repository. To install SNAP run the following commands:

```bash
chmod +x install_snap.sh
Expand All @@ -35,51 +35,51 @@ ERA-5 data set is redistributed over the Copernicus Climate Data Store (CDS). Yo
url: https://cds.climate.copernicus.eu/api/v2
key: UID:personal API Key
```
In case you dont want to create the .cdsapirc file manually, you can run [aux/install_CDS_key.sh](https://github.com/kleok/FLOMPY/blob/main/aux/install_CDS_key.sh) script as follows:
In case you dont want to create the .cdsapirc file manually, you can run [aux/install_CDS_key.sh](https://github.com/kleok/FLOODPY/blob/main/aux/install_CDS_key.sh) script as follows:

```bash
chmod +x install_CDS_key.sh
./install_CDS_key.sh
```
More details on CDSAPI can be found [here](https://cds.climate.copernicus.eu/api-how-to).

### 1.4 Download FLOMPY
First you have to download Flompy toolbox using the following command
```git clone https://github.com/kleok/FLOMPY.git```
### 1.4 Download FLOODPY
First you have to download FLOODPY toolbox using the following command
```git clone https://github.com/kleok/FLOODPY.git```

### 1.5 Create python environment for FLOMPY
### 1.5 Create python environment for FLOODPY

FLOMPY is written in Python3 and relies on several Python modules. You can install them by using conda or pip.
FLOODPY is written in Python3 and relies on several Python modules. You can install them by using conda or pip.

- Using **conda**
Create a new conda environement with required packages using the the file [FLOMPY_env.yml](https://github.com/kleok/FLOMPY/blob/main/FLOMPY_env.yml).
Create a new conda environement with required packages using the the file [FLOODPY_env.yml](https://github.com/kleok/FLOODPY/blob/main/FLOODPY_env.yml).

```
conda env create -f ~/FLOMPY/FLOMPY_env.yml
conda env create -f ~/FLOODPY/FLOODPY_env.yml
```

- Using **pip**
You can install python packages using [setup.py](https://github.com/kleok/FLOMPY/blob/main/setup.py)
You can install python packages using [setup.py](https://github.com/kleok/FLOODPY/blob/main/setup.py)

```
cd ~/FLOMPY
cd ~/FLOODPY
pip install .
```

### 1.6 Set environmental variables

on GNU/Linux, append to .bashrc file:
```
export FLOMPY_HOME=~/FLOMPY
export PYTHONPATH=${PYTHONPATH}:${FLOMPY_HOME}
export PATH=${PATH}:${FLOMPY_HOME}/flompy
export FLOODPY_HOME=~/FLOODPY
export PYTHONPATH=${PYTHONPATH}:${FLOODPY_HOME}
export PATH=${PATH}:${FLOODPY_HOME}/floodpy
```

## 2. Running Flompy
[FLOMPYapp.py]("https://github.com/kleok/FLOMPY/blob/main/flompy/FLOMPYapp.py")
## 2. Running FLOODPY
[FLOODPYapp.py]("https://github.com/kleok/FLOODPY/blob/main/floodpy/FLOODPYapp.py")

FLOMPY generates a floodwater map based on Sentinel-1 GRD products and meteorological data. FLOMPYapp.py includes the functionalities for FLOMPY's routine processing for generating floodwater maps. User should provide the following information at configuration file FLOMPYapp_template.cfg
We suggest you to can have a look at the plots for each Sentinel-1 image (located at projectfolder) to find out if you have a considerable decrease of backscatter in the flood image with respect to the baseline images. If you are able to identify a decrease of backscatter in the flood image (darker tones), then you can expect that FLOMPY will generate a useful floodwater map. In cases that you have similar or bigger backscatter values of flood image with respect to baseline images (due to complex backscatter mechanisms) FLOMPY`s results cannot be trusted.
FLOODPY generates a floodwater map based on Sentinel-1 GRD products and meteorological data. FLOODPYapp.py includes the functionalities for FLOODPY's routine processing for generating floodwater maps. User should provide the following information at configuration file FLOODPYapp_template.cfg
We suggest you to can have a look at the plots for each Sentinel-1 image (located at projectfolder) to find out if you have a considerable decrease of backscatter in the flood image with respect to the baseline images. If you are able to identify a decrease of backscatter in the flood image (darker tones), then you can expect that FLOODPY will generate a useful floodwater map. In cases that you have similar or bigger backscatter values of flood image with respect to baseline images (due to complex backscatter mechanisms) FLOODPY`s results cannot be trusted.
```
#######################################
# CONFIGURATION FILE #
Expand All @@ -93,10 +93,10 @@ Projectname = Palamas
#A2. The location that everything is going to be saved. Make sure
# you have enough free space disk on the specific location.
projectfolder = /RSL03/FLOMPY_palamas
projectfolder = /RSL03/FLOODPY_palamas
#A3. The location of Flompy code
src_dir = /RSL03/Flompy_0.3/FLOMPY/flompy
#A3. The location of FLOODPY code
src_dir = /RSL03/FLOODPY_0.4/FLOODPY/floodpy
#A4. SNAP ORBIT DIRECTORY
snap_dir = /home/kleanthis/.snap/auxdata/Orbits/Sentinel-1
Expand Down Expand Up @@ -135,7 +135,7 @@ after_flood_days = 3
#-In case you provide AOI BBOX coordinates, set AOI_File = None
#--------------------------------------------------------
# C1. AOI VECTOR FILE (if given AOI BBOX parameters can be ommited)
AOI_File = /home/kleanthis/bin/FLOMPY/tests/Palamas_AOI.geojson
AOI_File = /home/kleanthis/bin/FLOODPY/tests/Palamas_AOI.geojson
# C2. AOI BBOX (WGS84)
LONMIN=22.02
Expand Down Expand Up @@ -179,55 +179,55 @@ scihub_username = ******
scihub_password = ******
```

After the setup of the configuration file you can use the default recipe script FLOMPYapp.py to run the following following individual steps that will
After the setup of the configuration file you can use the default recipe script FLOODPYapp.py to run the following following individual steps that will
automatically run for the selected AOI:

### 2.1. Download Precipitation data from ERA5.

```
FLOMPYapp.py FLOMPYapp_template.cfg --dostep Download_Precipitation_data
FLOODPYapp.py FLOODPYapp_template.cfg --dostep Download_Precipitation_data
```

### 2.2. Download Sentinel 1 data.

```
FLOMPYapp.py FLOMPYapp_template.cfg --dostep Download_S1_data
FLOODPYapp.py FLOODPYapp_template.cfg --dostep Download_S1_data
```

### 2.3. Preprocessing Sentinel 1 data.

```
FLOMPYapp.py FLOMPYapp_template.cfg --dostep Preprocessing_S1_data
FLOODPYapp.py FLOODPYapp_template.cfg --dostep Preprocessing_S1_data
```

### 2.4. Sentinel 1 statistical analysis.

```
FLOMPYapp.py FLOMPYapp_template.cfg --dostep Statistical_analysis
FLOODPYapp.py FLOODPYapp_template.cfg --dostep Statistical_analysis
```

### 2.5. And at last the floodwater classification step. At this point the result of the estimated flooded region is exported.

```
FLOMPYapp.py FLOMPYapp_template.cfg --dostep Floodwater_classification
FLOODPYapp.py FLOODPYapp_template.cfg --dostep Floodwater_classification
```

If the flood was on an agricultural region you can also run the following steps to estimate the amount of the damaged fields by performing delineation (with a methodology based on Yan & Roy, 2014 and a pretrained Unet delineation network) and active-inactive field classification based on NDVI timeseries with Sentinel 2 data. For more information check at Gounari et al. 2022 bellow.

### 2.6. Download Sentinel 2 multispectral data (Optional).

```
FLOMPYapp.py FLOMPYapp_template.cfg --dostep Download_S2_data
FLOODPYapp.py FLOODPYapp_template.cfg --dostep Download_S2_data
```

### 2.7. Run crop delineation and field classification (Optional, requires 6).

```
FLOMPYapp.py FLOMPYapp_template.cfg --dostep Crop_delineation
FLOODPYapp.py FLOODPYapp_template.cfg --dostep Crop_delineation
```

## 3. Documentation and citation
Algorithms implemented in the software are described in detail at our publications. If FLOMPY was useful for you, we encourage you to cite the following work.
Algorithms implemented in the software are described in detail at our publications. If FLOODPY was useful for you, we encourage you to cite the following work.

- Karamvasis K, Karathanassi V. FLOMPY: An Open-Source Toolbox for Floodwater Mapping Using Sentinel-1 Intensity Time Series. Water. 2021; 13(21):2943. https://doi.org/10.3390/w13212943

Expand All @@ -238,5 +238,5 @@ Algorithms implemented in the software are described in detail at our publicatio
## 4. Contact us
Feel free to open an issue, comment or pull request. We would like to listen to your thoughts and your recommendations. Any help is very welcome! :heart:

FLOMPY Team: [Kleanthis Karamvasis](https://github.com/kleok), [Ioanna Zotou](https://www.researchgate.net/profile/Ioanna-Zotou), [Alekos Falagas](https://github.com/alekfal), [Olympia Gounari](https://github.com/Olyna), [Vasileios Tsironis](https://github.com/tsironisbi), [Markos Mylonas](https://github.com/mylonasma), [Pavlos Alexantonakis](https://www.linkedin.com/in/pavlos-alexantonakis)
FLOODPY Team: [Kleanthis Karamvasis](https://github.com/kleok), [Ioanna Zotou](https://www.researchgate.net/profile/Ioanna-Zotou), [Alekos Falagas](https://github.com/alekfal), [Olympia Gounari](https://github.com/Olyna), [Vasileios Tsironis](https://github.com/tsironisbi), [Markos Mylonas](https://github.com/mylonasma), [Pavlos Alexantonakis](https://www.linkedin.com/in/pavlos-alexantonakis)

6 changes: 3 additions & 3 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@

# -- Project information -----------------------------------------------------

project = 'flompy'
project = 'floodpy'
copyright = '2022, Kleanthis Karamvasis, Alekos Falagas'
author = 'Kleanthis Karamvasis, Alekos Falagas'

# The full version, including alpha/beta/rc tags
release = '0.2.2'
release = '0.4.0'


# -- General configuration ---------------------------------------------------
Expand Down Expand Up @@ -56,7 +56,7 @@
# a list of builtin themes.
#
html_theme = 'sphinx_rtd_theme'
html_logo = '../figures/Flompy_logo.png'
html_logo = '../figures/Floodpy_logo.png'

# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
Expand Down
12 changes: 6 additions & 6 deletions docs/flompy.Crop_delineation.rst
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
flompy.Crop\_delineation package
floodpy.Crop\_delineation package
================================

Submodules
----------

flompy.Crop\_delineation.delineate module
floodpy.Crop\_delineation.delineate module
-----------------------------------------

.. automodule:: flompy.Crop_delineation.delineate
.. automodule:: floodpy.Crop_delineation.delineate
:members:
:undoc-members:
:show-inheritance:

flompy.Crop\_delineation.utils module
floodpy.Crop\_delineation.utils module
-------------------------------------

.. automodule:: flompy.Crop_delineation.utils
.. automodule:: floodpy.Crop_delineation.utils
:members:
:undoc-members:
:show-inheritance:

Module contents
---------------

.. automodule:: flompy.Crop_delineation
.. automodule:: floodpy.Crop_delineation
:members:
:undoc-members:
:show-inheritance:
8 changes: 4 additions & 4 deletions docs/flompy.Crop_delineation_unet.rst
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
flompy.Crop\_delineation\_unet package
floodpy.Crop\_delineation\_unet package
======================================

Submodules
----------

flompy.Crop\_delineation\_unet.Pretrained\_networks module
floodpy.Crop\_delineation\_unet.Pretrained\_networks module
----------------------------------------------------------

.. automodule:: flompy.Crop_delineation_unet.Pretrained_networks
.. automodule:: floodpy.Crop_delineation_unet.Pretrained_networks
:members:
:undoc-members:
:show-inheritance:

Module contents
---------------

.. automodule:: flompy.Crop_delineation_unet
.. automodule:: floodpy.Crop_delineation_unet
:members:
:undoc-members:
:show-inheritance:
24 changes: 12 additions & 12 deletions docs/flompy.Download.rst
Original file line number Diff line number Diff line change
@@ -1,53 +1,53 @@
flompy.Download package
floodpy.Download package
=======================

Submodules
----------

flompy.Download.Download\_ERA5\_precipitation module
floodpy.Download.Download\_ERA5\_precipitation module
----------------------------------------------------

.. automodule:: flompy.Download.Download_ERA5_precipitation
.. automodule:: floodpy.Download.Download_ERA5_precipitation
:members:
:undoc-members:
:show-inheritance:

flompy.Download.Download\_GFS module
floodpy.Download.Download\_GFS module
------------------------------------

.. automodule:: flompy.Download.Download_GFS
.. automodule:: floodpy.Download.Download_GFS
:members:
:undoc-members:
:show-inheritance:

flompy.Download.Download\_orbits module
floodpy.Download.Download\_orbits module
---------------------------------------

.. automodule:: flompy.Download.Download_orbits
.. automodule:: floodpy.Download.Download_orbits
:members:
:undoc-members:
:show-inheritance:

flompy.Download.Sentinel\_1\_download module
floodpy.Download.Sentinel\_1\_download module
--------------------------------------------

.. automodule:: flompy.Download.Sentinel_1_download
.. automodule:: floodpy.Download.Sentinel_1_download
:members:
:undoc-members:
:show-inheritance:

flompy.Download.Sentinel\_2\_download module
floodpy.Download.Sentinel\_2\_download module
--------------------------------------------

.. automodule:: flompy.Download.Sentinel_2_download
.. automodule:: floodpy.Download.Sentinel_2_download
:members:
:undoc-members:
:show-inheritance:

Module contents
---------------

.. automodule:: flompy.Download
.. automodule:: floodpy.Download
:members:
:undoc-members:
:show-inheritance:
Binary file removed figures/Flompy_logo.png
Binary file not shown.
Binary file added figures/Floodpy_logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified figures/pinieios_results_github.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit e375967

Please sign in to comment.