Skip to content

Commit

Permalink
Merge pull request #84 from sentinel-hub/develop
Browse files Browse the repository at this point in the history
Release 1.7.2
  • Loading branch information
zigaLuksic authored Jan 10, 2024
2 parents 308c7ed + fd7ac82 commit 29ad017
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 11 deletions.
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v4.5.0
hooks:
- id: end-of-file-fixer
- id: requirements-txt-fixer
Expand All @@ -13,18 +13,18 @@ repos:
- id: debug-statements

- repo: https://github.com/psf/black
rev: 23.1.0
rev: 23.12.1
hooks:
- id: black
language_version: python3

- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: "v0.0.269"
rev: "v0.1.11"
hooks:
- id: ruff

- repo: https://github.com/nbQA-dev/nbQA
rev: 1.6.3
rev: 1.7.1
hooks:
- id: nbqa-black
- id: nbqa-ruff
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ classifiers = [
]
dependencies = [
"lightgbm>=2.0.11",
"numpy>=1.13.3",
"numpy>=1.13.3,<2",
"opencv-python-headless",
"sentinelhub>=3.9.0",
"typing_extensions",
Expand Down
2 changes: 1 addition & 1 deletion s2cloudless/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
from .pixel_classifier import PixelClassifier
from .utils import download_bands_and_valid_data_mask

__version__ = "1.7.1"
__version__ = "1.7.2"
1 change: 1 addition & 0 deletions s2cloudless/cloud_detector.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Module for pixel-based classification on Sentinel-2 L1C imagery."""

from __future__ import annotations

import os
Expand Down
5 changes: 3 additions & 2 deletions s2cloudless/pixel_classifier.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Module for pixel-based classifiers."""

from __future__ import annotations

from typing import Any, Protocol
Expand Down Expand Up @@ -75,8 +76,8 @@ def image_predict_proba(self, data: np.ndarray, **kwargs: Any) -> np.ndarray:
pixels = data.reshape((-1, data.shape[-1]))

if isinstance(self.classifier, Booster):
probabilities = self.classifier.predict(pixels, **kwargs)
probabilities = np.vstack((1.0 - probabilities, probabilities)).transpose()
proba = self.classifier.predict(pixels, **kwargs)
probabilities = np.vstack([1.0 - proba, proba]).transpose() # type: ignore[operator, list-item]
else:
probabilities = self.classifier.predict_proba(pixels, **kwargs)

Expand Down
2 changes: 1 addition & 1 deletion s2cloudless/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,6 @@ def download_bands_and_valid_data_mask(

def cv2_disk(radius: int) -> np.ndarray:
"""Recreates the disk structural element from skimage.morphology using OpenCV."""
return cv2.circle(
return cv2.circle( # type: ignore[call-overload]
np.zeros((radius * 2 + 1, radius * 2 + 1), dtype=np.uint8), (radius, radius), radius, color=1, thickness=-1
)
5 changes: 3 additions & 2 deletions tests/test_utils.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from __future__ import annotations

import datetime as dt
from typing import Tuple

import numpy as np
import pytest
Expand Down Expand Up @@ -46,7 +47,7 @@
],
)
@pytest.mark.sh_integration()
def test_download_bands_and_valid_data_mask(test_input: dict, expected_shape: Tuple[int, int, int]) -> None:
def test_download_bands_and_valid_data_mask(test_input: dict, expected_shape: tuple[int, int, int]) -> None:
bands, mask = download_bands_and_valid_data_mask(**test_input)
assert bands.shape == expected_shape
assert bands.dtype == np.float32
Expand Down

0 comments on commit 29ad017

Please sign in to comment.