Skip to content

Commit 03a9d39

Browse files
authored
Merge pull request #509 from sentinel-hub/develop
Release version 1.3.1
2 parents 0fd30fc + e8f228c commit 03a9d39

File tree

30 files changed

+364
-444
lines changed

30 files changed

+364
-444
lines changed

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
## [Version 1.3.1] - 2022-11-23
2+
3+
- Sentinel Hub IO tasks now support a custom timestamp filtration via `timestamp_filter` parameter.
4+
- `MergeFeatureTask` now supports the `axis` parameter.
5+
- Fix minor issues with the coregistration module.
6+
- Prepare for future removal of `sentinelhub.os_utils`.
7+
- Fix type annotations after `mypy` update.
8+
- Improvements to tests and various minor changes.
9+
10+
111
## [Version 1.3.0] - 2022-10-06
212

313
- (**codebreaking**) Adapted Sentinel Hub tasks to `sentinelhub-py 3.8.0` which switched to Catalog 1.0.0.

core/eolearn/core/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,4 @@
3232
from .utils.parallelize import execute_with_mp_lock, join_futures, join_futures_iter, parallelize
3333
from .utils.parsing import FeatureParser
3434

35-
__version__ = "1.3.0"
35+
__version__ = "1.3.1"

core/eolearn/core/core_tasks.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -508,11 +508,11 @@ def zip_method(self, *f):
508508

509509

510510
class MergeFeatureTask(ZipFeatureTask):
511-
"""Merges multiple features together by concatenating their data along the last axis."""
511+
"""Merges multiple features together by concatenating their data along the specified axis."""
512512

513-
def zip_method(self, *f: np.ndarray, dtype: Union[None, np.dtype, type] = None) -> np.ndarray:
514-
"""Concatenates the data of features along the last axis."""
515-
return np.concatenate(f, axis=-1, dtype=dtype) # pylint: disable=unexpected-keyword-arg
513+
def zip_method(self, *f: np.ndarray, dtype: Union[None, np.dtype, type] = None, axis: int = -1) -> np.ndarray:
514+
"""Concatenates the data of features along the specified axis."""
515+
return np.concatenate(f, axis=axis, dtype=dtype) # pylint: disable=unexpected-keyword-arg
516516

517517

518518
class ExtractBandsTask(MapFeatureTask):

core/eolearn/core/eodata.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ class _FeatureDictGeoDf(_FeatureDict[gpd.GeoDataFrame]):
175175
"""_FeatureDict object specialized for GeoDataFrames."""
176176

177177
def __init__(self, feature_dict: Dict[str, gpd.GeoDataFrame], feature_type: FeatureType):
178-
if not feature_type.is_vector:
178+
if not feature_type.is_vector():
179179
raise ValueError(f"Feature type {feature_type} does not represent a vector feature.")
180180
super().__init__(feature_dict, feature_type)
181181

core/eolearn/core/eodata_io.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
import datetime
1717
import gzip
1818
import json
19+
import platform
1920
import warnings
2021
from abc import ABCMeta, abstractmethod
2122
from collections import defaultdict
@@ -50,7 +51,6 @@
5051

5152
from sentinelhub import CRS, BBox, Geometry, MimeType
5253
from sentinelhub.exceptions import SHUserWarning
53-
from sentinelhub.os_utils import sys_is_windows
5454

5555
from .constants import FeatureType, FeatureTypeSet, OverwritePermission
5656
from .utils.parsing import FeatureParser, FeaturesSpecification
@@ -85,7 +85,7 @@ def save_eopatch(
8585
_check_letter_case_collisions(eopatch_features, fs_features)
8686
_check_add_only_permission(eopatch_features, fs_features)
8787

88-
elif sys_is_windows() and overwrite_permission is OverwritePermission.OVERWRITE_FEATURES:
88+
elif platform.system() == "Windows" and overwrite_permission is OverwritePermission.OVERWRITE_FEATURES:
8989
_check_letter_case_collisions(eopatch_features, fs_features)
9090

9191
else:

core/eolearn/tests/test_core_tasks.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,8 @@ def test_move_feature():
308308
assert "MTless2" in patch_dst[FeatureType.MASK_TIMELESS]
309309

310310

311-
def test_merge_features():
311+
@pytest.mark.parametrize("axis", (0, -1))
312+
def test_merge_features(axis):
312313
patch = EOPatch()
313314

314315
shape = (10, 5, 5, 3)
@@ -332,10 +333,10 @@ def test_merge_features():
332333
for feat, dat in zip(features, data):
333334
patch = AddFeatureTask(feat)(patch, dat)
334335

335-
patch = MergeFeatureTask(features[:3], (FeatureType.MASK, "merged"))(patch)
336-
patch = MergeFeatureTask(features[3:], (FeatureType.MASK_TIMELESS, "merged_timeless"))(patch)
336+
patch = MergeFeatureTask(features[:3], (FeatureType.MASK, "merged"), axis=axis)(patch)
337+
patch = MergeFeatureTask(features[3:], (FeatureType.MASK_TIMELESS, "merged_timeless"), axis=axis)(patch)
337338

338-
expected = np.concatenate([patch[f] for f in features[:3]], axis=-1)
339+
expected = np.concatenate([patch[f] for f in features[:3]], axis=axis)
339340

340341
assert np.array_equal(patch.mask["merged"], expected)
341342

core/eolearn/tests/test_utils/test_parsing.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ def test_allowed_feature_types(test_input: FeaturesSpecification, allowed_types:
170170
FeatureParser(features=test_input, allowed_feature_types=allowed_types)
171171

172172

173-
@pytest.fixture(name="eopatch", scope="session")
173+
@pytest.fixture(name="eopatch", scope="module")
174174
def eopatch_fixture():
175175
return EOPatch(
176176
data=dict(data=np.zeros((2, 2, 2, 2)), CLP=np.zeros((2, 2, 2, 2))), # name duplication intentional

coregistration/eolearn/coregistration/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@
44

55
from .coregistration import ECCRegistrationTask, InterpolationType, PointBasedRegistrationTask, RegistrationTask
66

7-
__version__ = "1.3.0"
7+
__version__ = "1.3.1"

coregistration/eolearn/coregistration/coregistration.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ def register(self, src, trg, trg_mask=None, src_mask=None):
331331
# Initialise matrix and failed registrations flag
332332
warp_matrix = None
333333
# Initiate point detector
334-
ptdt = cv2.xfeatures2d.SIFT_create() if self.params["Descriptor"] == "SIFT" else cv2.xfeatures2d.SURF_create()
334+
ptdt = cv2.SIFT_create() if self.params["Descriptor"] == "SIFT" else cv2.SURF_create()
335335
# create BFMatcher object
336336
bf_matcher = cv2.BFMatcher(cv2.NORM_L1, crossCheck=True)
337337
# find the key points and descriptors with SIFT

features/eolearn/features/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,4 @@
3838
AddSpatioTemporalFeaturesTask,
3939
)
4040

41-
__version__ = "1.3.0"
41+
__version__ = "1.3.1"

0 commit comments

Comments
 (0)