Skip to content

Commit 3589b34

Browse files
authored
Merge pull request #37 from sentinel-hub/feat/package-updates
Feat/package updates
2 parents 2d291e0 + 5eed12f commit 3589b34

25 files changed

+515
-279
lines changed

.coveragerc

-10
This file was deleted.

.github/ISSUE_TEMPLATE/bug-report.md

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
---
2+
name: 'Bug report'
3+
about: Help us improve
4+
title: '[BUG]'
5+
labels: bug
6+
assignees: ''
7+
8+
---
9+
10+
**Describe the bug**
11+
12+
A clear and concise description of what the bug is.
13+
14+
NOTE: Remove any confidential information, such as Sentinel Hub credentials!
15+
16+
**To Reproduce**
17+
18+
Steps to reproduce the behavior:
19+
20+
1.
21+
2.
22+
3.
23+
24+
**Expected behavior**
25+
26+
A clear and concise description of what you expected to happen.
27+
28+
**Environment**
29+
30+
Details of the python environment
31+
32+
**Stack trace or screenshots**
33+
34+
If applicable, add screenshots to help explain your problem.
35+
36+
**Desktop (please complete the following information):**
37+
38+
- OS: [e.g. iOS]
39+
- Browser [e.g. chrome, safari]
40+
- Version [e.g. 22]
41+
42+
**Additional context**
+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
---
2+
name: 'Feature request'
3+
about: What feature is missing?
4+
title: '[FEAT]'
5+
labels: enhancement
6+
assignees: ''
7+
8+
---
9+
10+
**What is the problem? Please describe.**
11+
12+
A clear and concise description of what the problem is.
13+
14+
**Here's the solution**
15+
16+
A clear and concise description of what you want to happen.
17+
18+
**Alternatives**
19+
20+
A clear and concise description of any alternative solutions or features you've considered.
21+
22+
**Additional context**
23+
24+
Add any other context or screenshots about the feature request here.
+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
---
2+
name: 'Help/Support'
3+
about: 'Need help?'
4+
title: '[HELP]'
5+
labels: help wanted, question
6+
assignees: ''
7+
8+
---
9+
10+
**Resources**
11+
12+
Before opening an issue for help/support, make sure you have checked [existing issues](https://github.com/sentinel-hub/sentinel2-cloud-detector/issues) and the Sentinel Hub [forum](https://forum.sentinel-hub.com/).
13+
14+
**Question**
15+
16+
Formulate your question in a clear and structured way, providing context and links to the resources raising issues.
17+
18+
NOTE: Remove any confidential information, such as Sentinel Hub credentials!
19+
20+
**Additional context**
21+
22+
Add any information that would help us supporting you.

.github/workflows/ci_action.yml

+88
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
name: build
2+
3+
on:
4+
push:
5+
schedule:
6+
- cron: '0 0 * * *'
7+
8+
jobs:
9+
10+
check-code-black:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Check out current branch
14+
if: github.event_name == 'push'
15+
uses: actions/checkout@v2
16+
17+
- name: Check code compliance with black
18+
if: github.event_name == 'push'
19+
run: |
20+
pip install black[jupyter]
21+
black . --check --diff
22+
23+
check-code-isort:
24+
runs-on: ubuntu-latest
25+
steps:
26+
- name: Check out current branch
27+
if: github.event_name == 'push'
28+
uses: actions/checkout@v2
29+
30+
- name: Check code compliance with isort
31+
if: github.event_name == 'push'
32+
run: |
33+
pip install isort
34+
isort **/*.py --check --diff
35+
36+
test-on-github:
37+
runs-on: ubuntu-latest
38+
strategy:
39+
matrix:
40+
python-version:
41+
- '3.7'
42+
- '3.8'
43+
- '3.9'
44+
- '3.10'
45+
steps:
46+
- name: Check out current branch in case of a push event
47+
if: github.event_name == 'push'
48+
uses: actions/checkout@v2
49+
50+
- name: Check out develop branch in case of a scheduled event
51+
if: github.event_name == 'schedule'
52+
uses: actions/checkout@v2
53+
with:
54+
ref: develop
55+
56+
- name: Setup Python
57+
uses: actions/setup-python@v2
58+
with:
59+
python-version: ${{ matrix.python-version }}
60+
architecture: x64
61+
62+
- name: Install packages
63+
run: |
64+
sudo apt-get update
65+
sudo apt-get install -y build-essential libopenjp2-7
66+
pip install -e .[DEV]
67+
68+
- name: Run full tests and code coverage
69+
if: matrix.python-version == '3.9'
70+
run: |
71+
sentinelhub.config \
72+
--sh_client_id "${{ secrets.SH_CLIENT_ID }}" \
73+
--sh_client_secret "${{ secrets.SH_CLIENT_SECRET }}"
74+
pytest --cov --cov-report=term --cov-report=xml
75+
76+
- name: Run pylint and reduced tests
77+
if: matrix.python-version != '3.9'
78+
run: |
79+
pylint s2cloudless
80+
pytest -m "not sh_integration"
81+
82+
- name: Upload code coverage
83+
if: matrix.python-version == '3.9'
84+
uses: codecov/codecov-action@v2
85+
with:
86+
files: coverage.xml
87+
fail_ci_if_error: true
88+
verbose: false

.travis.yml

-37
This file was deleted.

MANIFEST.in

-1
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,3 @@ include README.md
44
include LICENSE.md
55
include setup.py
66
include s2cloudless/models/*
7-
include s2cloudless/TestInputs/*

Makefile

+4-2
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,12 @@ help:
77

88

99
upload:
10-
$(PYTHON) setup.py sdist
10+
rm -r dist build | true
11+
$(PYTHON) setup.py sdist bdist_wheel
1112
twine upload dist/*
1213

1314
# For testing:
1415
test-upload:
15-
$(PYTHON) setup.py sdist
16+
rm -r dist build | true
17+
$(PYTHON) setup.py sdist bdist_wheel
1618
twine upload --repository testpypi dist/*

README.md

+7-10
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
[![Package version](https://badge.fury.io/py/s2cloudless.svg)](https://pypi.org/project/s2cloudless)
2+
[![Conda version](https://img.shields.io/conda/vn/conda-forge/s2cloudless.svg)](https://anaconda.org/conda-forge/s2cloudless)
23
[![Supported Python versions](https://img.shields.io/pypi/pyversions/s2cloudless.svg?style=flat-square)](https://pypi.org/project/s2cloudless)
3-
[![Build Status](https://www.travis-ci.com/sentinel-hub/sentinel2-cloud-detector.svg?branch=master)](https://app.travis-ci.com/github/sentinel-hub/sentinel2-cloud-detector/builds)
4+
[![Build Status](https://github.com/sentinel-hub/sentinel2-cloud-detector/actions/workflows/ci_action.yml/badge.svg?branch=master)](https://github.com/sentinel-hub/sentinel2-cloud-detector/actions)
45
[![Overall downloads](https://pepy.tech/badge/s2cloudless)](https://pepy.tech/project/s2cloudless)
56
[![Last month downloads](https://pepy.tech/badge/s2cloudless/month)](https://pepy.tech/project/s2cloudless)
67
[![Code coverage](https://codecov.io/gh/sentinel-hub/sentinel2-cloud-detector/branch/master/graph/badge.svg)](https://codecov.io/gh/sentinel-hub/sentinel2-cloud-detector)
@@ -11,12 +12,12 @@
1112

1213
The **s2cloudless** Python package provides automated cloud detection in
1314
Sentinel-2 imagery. The classification is based on a *single-scene pixel-based cloud detector*
14-
developed by Sentinel Hub's research team and is described in more details
15+
developed by Sentinel Hub's research team and is described in more detail
1516
[in this blog](https://medium.com/sentinel-hub/improving-cloud-detection-with-machine-learning-c09dc5d7cf13).
1617

1718
## Installation
1819

19-
The package requires a Python version >= 3.6. The package is available on
20+
The package requires a Python version >= 3.7. The package is available on
2021
the PyPI package manager and can be installed with
2122

2223
```
@@ -36,17 +37,13 @@ Before installing `s2cloudless` on **Windows**, it is recommended to install pac
3637

3738
## Input: Sentinel-2 scenes
3839

39-
The inputs to the cloud detector are Sentinel-2 images. In particular, the cloud detector requires the following 10
40-
Sentinel-2 band reflectances: B01, B02, B04, B05, B08, B8A, B09, B10, B11, B12, which are obtained from raw
41-
reflectance value in the following way: `B_i/10000`.
40+
The inputs to the cloud detector are Sentinel-2 images. In particular, the cloud detector requires the following 10 Sentinel-2 band reflectances: B01, B02, B04, B05, B08, B8A, B09, B10, B11, B12, which are obtained from raw reflectance values in the following way: `B_i/10000`. From product baseline `04.00` onward additional harmonization factors have to be applied to data according to [instructions from ESA](https://sentinels.copernicus.eu/en/web/sentinel/-/copernicus-sentinel-2-major-products-upgrade-upcoming).
4241

43-
You don't need to worry about any of this, if you're doing classification of scenes obtained using [Sentinel Hub
44-
Process API](https://docs.sentinel-hub.com/api/latest/api/process/). The API is supported in Python with
45-
[sentinelhub-py](https://github.com/sentinel-hub/sentinelhub-py) package.
42+
You don't need to worry about any of this, if you are using Sentinel-2 data obtained from [Sentinel Hub Process API](https://docs.sentinel-hub.com/api/latest/api/process/). By default, the data is already harmonized according to [documentation](https://docs.sentinel-hub.com/api/latest/data/sentinel-2-l1c/#harmonize-values). The API is supported in Python with [sentinelhub-py](https://github.com/sentinel-hub/sentinelhub-py) package and used within `s2cloudless.CloudMaskRequest` class.
4643

4744
## Examples
4845

49-
Jupyter notebook on how to use the cloud detector to produce cloud mask or cloud probability map
46+
A Jupyter notebook on how to use the cloud detector to produce cloud mask or cloud probability map
5047
can be found in the [examples folder](https://github.com/sentinel-hub/sentinel2-cloud-detector/tree/master/examples).
5148

5249
## License

examples/plotting_utils.py

+5-8
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,16 @@
55
import numpy as np
66

77

8-
def plot_image(image=None, mask=None, ax=None, factor=3.5/255, clip_range=(0, 1), **kwargs):
9-
""" Utility function for plotting RGB images and masks.
10-
"""
8+
def plot_image(image=None, mask=None, ax=None, factor=3.5 / 255, clip_range=(0, 1), **kwargs):
9+
"""Utility function for plotting RGB images and masks."""
1110
if ax is None:
1211
_, ax = plt.subplots(nrows=1, ncols=1, figsize=(15, 15))
1312

1413
mask_color = [255, 255, 255, 255] if image is None else [255, 255, 0, 100]
1514

1615
if image is None:
1716
if mask is None:
18-
raise ValueError('image or mask should be given')
17+
raise ValueError("image or mask should be given")
1918
image = np.zeros(mask.shape + (3,), dtype=np.uint8)
2019

2120
ax.imshow(np.clip(image * factor, *clip_range), **kwargs)
@@ -28,12 +27,10 @@ def plot_image(image=None, mask=None, ax=None, factor=3.5/255, clip_range=(0, 1)
2827
ax.imshow(cloud_image)
2928

3029

31-
def plot_probabilities(image, proba, factor=3.5/255):
32-
""" Utility function for plotting a RGB image and its cloud probability map next to each other.
33-
"""
30+
def plot_probabilities(image, proba, factor=3.5 / 255):
31+
"""Utility function for plotting a RGB image and its cloud probability map next to each other."""
3432
plt.figure(figsize=(15, 15))
3533
ax = plt.subplot(1, 2, 1)
3634
ax.imshow(np.clip(image * factor, 0, 1))
3735
ax = plt.subplot(1, 2, 2)
3836
ax.imshow(proba, cmap=plt.cm.inferno)
39-

0 commit comments

Comments
 (0)