https://github.com/cordmaur/waterquality
Science Score: 23.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
○codemeta.json file
-
○.zenodo.json file
-
✓DOI references
Found 4 DOI reference(s) in README -
✓Academic publication links
Links to: zenodo.org -
○Committers with academic emails
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (14.7%) to scientific vocabulary
Repository
Basic Info
- Host: GitHub
- Owner: cordmaur
- License: gpl-3.0
- Language: Jupyter Notebook
- Default Branch: master
- Size: 2.63 MB
Statistics
- Stars: 49
- Watchers: 2
- Forks: 10
- Open Issues: 3
- Releases: 0
Metadata Files
README.md
WaterQuality
Synopsis
The WaterQuality package extends the functionalities of the WaterDetect[1] package (https://github.com/cordmaur/WaterDetect) to calculate continental water quality parameters from satellite reflectances. The inversion algorithms are not implemented, as they depend on the region or specifics calibration and can be found in the literature. Once the inversion function is defined, the water quality parameter is calculated just where there exist water, according to the waterdetect mask and the reports are generated.
As an example, an inversion algorithms for total suspended matter (TSM), proposed by Nechad et al. (2010)[2] has been implemented. Refer to the notebook 01_Example.ipynb under the nbs/ folder for more information
The Medium article Creating water quality maps from remote sensed images with Python has the first steps on the package.
Dependencies
The required libraries are:
GDAL>=3.0.2
matplotlib>=3.1.2
PyPDF2>=1.26.0
scipy>=1.3.2
scikit-learn>=0.22
skimage>=0.16.2
numpy>=1.17
waterdetect>=1.5
Alternatively: ``` conda env create -f environment.yml
conda activate waterquality ```
Instalation
The easiest way to install waterquality package is with pip command, directly from the git repository, like so:
pip install git+https://github.com/cordmaur/WaterQuality.git@main
Alternatively, you can clone the repository and install from its root throught the following commands:
git clone https://github.com/cordmaur/WaterQuality.git
cd WaterQuality
pip install -e .
Inversion Functions
If the waterquality is being used from a Jupyter Notebook, refer to the medium story for more information on how to create new functions and pass them to the algorithm.
If it is being called from the console, the functions need to be informed in the file inversion_functions.py.
The new fuction should be defined with the name of the band (as used in WaterDetect) as argument (e.g., Red, Green, Nir, Mir, etc.).
Once created, the functions that will be used should appear in the functions dictionary.
These examples are available inside the inversion_functions.py file:
```
Bellow is an example extracted from Nechad et al. (2010)
def nechad(Red): a = 610.94 c = 0.2324 spm = 610.94 * Red / (1 - (Red/c)) return spm
functions = { 'SPM_Nechad3': { 'function': nechad, 'units': 'mg/l' } } ```
Usage:
Make sure waterdetect is already installed, following the instructions in https://github.com/cordmaur/WaterDetect.
Once installed, a waterquality entry point is created in the path of the environment.
One can check the installation and options by running waterquality --help. Check also the waterdetect instalation. GDAL will be necessary for waterquality package.
``` usage: waterquality [-h] [-GC] [-i INPUT] [-o OUT] [-s SHP] [-sm] [-p PRODUCT] [-cwd CONFIGWD] [-cwq CONFIGWQ]
The waterquality adds a post-processing function to waterdetect package to calc water quality parameters. Waterdetect should be installed in the environment.
optional arguments: -h, --help show this help message and exit -GC, --GetConfig Copy the inversionfunctions.py, WaterQuality.ini and the WaterDetect.ini into the current directory and skips the processing. Once copied you can edit the .ini file and launch the waterquality without -c option. -i INPUT, --input INPUT The products input folder. Required. -o OUT, --out OUT Output directory. Required. -s SHP, --shp SHP SHP file. Optional. -sm, --single Run WaterDetect over only one image instead of a directory of images. Optional. -p PRODUCT, --product PRODUCT The product to be processed (S2THEIA, L8USGS, S2L1C or S2S2COR) -cwd CONFIGWD, --configwd CONFIGWD WaterDetect configuration file (.ini). Only needed if running WD.If not passed, WaterDetect.ini from current dir is used as default. -cwq CONFIGWQ, --configwq CONFIG_WQ WaterQuality configuration file (.ini). If not passed, WaterQuality.ini from current dir is used as default.
The waterquality uses the WaterQuality.ini configuration file as well as WaterDetect.ini from waterdetect package.To
copy the package's default .ini files into the current directory, type: waterquality -GC . without other arguments
and it will copy WaterDetect.ini and WaterQuality.ini into the current directory.The file inversion_functions.py
should be updated with the necessary inversion functions.
```
WaterQuality can be run from the console or through a notebook. For notebook usage, refer to the notebook 01_Example.ipynb under nbs/ folder.
The basic usage for the waterquality from the console is:
waterquality -i c:/input_folder -i -c:/output_folder -p S2_S2COR [-s any_shape.shp]
The input directory should contain the uncompressed folders for the images. The script will loop through all folders in the input directory and save the water masks, graphs and reports to the output folder. The output folder must be created beforehand.
If the config file is not specified, the script will search for WaterDetect.ini and WaterQuality.ini in the current folder.
Institutions
- ANA - Agência Nacional de Águas (https://www.gov.br/ana/en/)
- GET - Géosciences Environnement Toulouse (https://www.get.omp.eu/)
- IRD - Institut de Recherche pour le Développement (https://en.ird.fr/)
- CNES - Centre National d'Études Spatiales (https://cnes.fr/fr)
License
This code is licensed under the GNU General Public License v3.0 license. Please, refer to GNU's webpage (https://www.gnu.org/licenses/gpl-3.0.en.html) for details.
References
[1] Cordeiro, Maurício C. R., Jean-Michel Martinez, and Santiago Peña-Luque. 2021. “Automatic Water Detection from Multidimensional Hierarchical Clustering for Sentinel-2 Images and a Comparison with Level 2A Processors.” Remote Sensing of Environment 253 (February): 112209. https://doi.org/10.1016/j.rse.2020.112209.
[2] Nechad, B., K. G. Ruddick, and Y. Park. 2010. “Calibration and Validation of a Generic Multisensor Algorithm for Mapping of Total Suspended Matter in Turbid Waters.” Remote Sensing of Environment 114 (4): 854–66. https://doi.org/10.1016/j.rse.2009.11.022.
Owner
- Name: Mauricio Cordeiro
- Login: cordmaur
- Kind: user
- Location: Toulouse
- Website: https://cordmaur.medium.com/
- Repositories: 26
- Profile: https://github.com/cordmaur
Data scientist specialized in geosciences and remote sensing for environment. Deep learning practitioner. More info: http://cordmaur.carrd.co
GitHub Events
Total
- Watch event: 3
Last Year
- Watch event: 3
Committers
Last synced: over 2 years ago
Top Committers
| Name | Commits | |
|---|---|---|
| Mauricio Cordeiro | c****r@g****m | 69 |
| rebellm | m****o@a****r | 28 |
| David Guimaraes | 3****a | 11 |
| MH | m****2@g****m | 10 |
Committer Domains (Top 20 + Academic)
Issues and Pull Requests
Last synced: 12 months ago
All Time
- Total issues: 4
- Total pull requests: 1
- Average time to close issues: about 1 hour
- Average time to close pull requests: about 2 hours
- Total issue authors: 4
- Total pull request authors: 1
- Average comments per issue: 1.25
- Average comments per pull request: 0.0
- Merged pull requests: 1
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 1
- Pull requests: 0
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Issue authors: 1
- Pull request authors: 0
- Average comments per issue: 1.0
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- olongfen (1)
- yyeongha (1)
- syncruise (1)
- Sachagobeyn (1)
Pull Request Authors
- daviguima (1)
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 1
-
Total downloads:
- pypi 9 last-month
- Total dependent packages: 0
- Total dependent repositories: 0
- Total versions: 3
- Total maintainers: 1
pypi.org: waterquality
The waterquality package extends the functionality of the waterdetect package to calculate water quality parameters over the identified water mask. To do so, it is mandatory to have waterdetect package installed (pip install waterdetect).
- Homepage: https://github.com/cordmaur/WaterQuality
- Documentation: https://waterquality.readthedocs.io/
- License: GNU General Public License v3 (GPLv3)
-
Latest release: 1.1.5
published almost 4 years ago
Rankings
Maintainers (1)
Dependencies
- waterdetect >=1.5
- GDAL >=2.3.0
- PyPDF2 >=1.26.0
- matplotlib >=3.1.2
- pysptools >=0.15.0
- scikit-learn >=0.2
- scipy >=1.1.0
- waterdetect *
- PyPDF2 >=1.26
- lxml >=4.5.0
- matplotlib >=3.3
- numpy >=1.17
- pandas *
- pillow >=7.0.0
- scikit_learn >=0.23
- waterdetect >=1.5.12