Skip to content

Commit

Permalink
Bump version to 1.4.2 (#671)
Browse files Browse the repository at this point in the history
* tdigest fixes

* add changelog

* bump version to 1.4.2

* update types of tdigest
  • Loading branch information
zigaLuksic committed May 24, 2023
1 parent 1ef8d73 commit eca3aae
Show file tree
Hide file tree
Showing 11 changed files with 48 additions and 23 deletions.
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
## [Version 1.4.2] - 2023-3-14

- Introduced support for Python 3.11.
- Removed support for Python 3.7.
- Added T-Digest `EOTask` in the scope of the Global Earth Monitor Project, contributed by @meengel.
- Used evalscript generation utility from `sentinelhub-py` in SH related `EOTasks`.
- Deprecated the `EOPatch.merge` method and extracted it as a function.
- Deprecated the `OVERWRITE_PATCH` permission and enforcing the usage of explicit string permissions.
- Encapsulated `FeatureDict` class as `Mapping`, removed inheritance from `dict`.
- Switched to new-style typed annotations.
- Introduced the `ruff` python linter, removed `flake8` and `isort` (covered by `ruff`).
- Fixed issue with occasionally failing scheduled builds on the `master` branch.
- Various refactoring efforts and dependency improvements.
- Various improvements to tests and code.

## [Version 1.4.1] - 2023-3-14

- The codebase is now fully annotated and type annotations are mandatory for all new code.
Expand Down
2 changes: 1 addition & 1 deletion core/eolearn/core/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@
from .utils.parallelize import execute_with_mp_lock, join_futures, join_futures_iter, parallelize
from .utils.parsing import FeatureParser

__version__ = "1.4.1"
__version__ = "1.4.2"
2 changes: 1 addition & 1 deletion coregistration/eolearn/coregistration/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@

from .coregistration import ECCRegistrationTask, get_gradient

__version__ = "1.4.1"
__version__ = "1.4.2"
2 changes: 1 addition & 1 deletion features/eolearn/features/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@
AddSpatioTemporalFeaturesTask,
)

__version__ = "1.4.1"
__version__ = "1.4.2"
2 changes: 1 addition & 1 deletion geometry/eolearn/geometry/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@
)
from .transformations import RasterToVectorTask, VectorToRasterTask

__version__ = "1.4.1"
__version__ = "1.4.2"
2 changes: 1 addition & 1 deletion io/eolearn/io/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@
get_available_timestamps,
)

__version__ = "1.4.1"
__version__ = "1.4.2"
2 changes: 1 addition & 1 deletion mask/eolearn/mask/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@
from .snow_mask import SnowMaskTask, TheiaSnowMaskTask
from .utils import resize_images

__version__ = "1.4.1"
__version__ = "1.4.2"
2 changes: 1 addition & 1 deletion ml_tools/eolearn/ml_tools/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
from .sampling import BlockSamplingTask, FractionSamplingTask, GridSamplingTask, sample_by_values
from .train_test_split import TrainTestSplitTask

__version__ = "1.4.1"
__version__ = "1.4.2"
22 changes: 16 additions & 6 deletions ml_tools/eolearn/ml_tools/tdigest.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""
The module provides an EOTask for the computation of a T-Digest representation of an EOPatch.
Requires installation of `eolearn.ml_tools[TDIGEST]`.
Copyright (c) 2017- Sinergise and contributors
For the full list of contributors, see the CREDITS file in the root directory of this source tree.
Expand All @@ -16,7 +17,7 @@
from eolearn.core import EOPatch, EOTask, FeatureType
from eolearn.core.types import FeatureSpec, FeaturesSpecification

ModeTypes = Literal["standard", "timewise", "monthly", "total"]
ModeTypes = Union[Literal["standard", "timewise", "monthly", "total"], Callable]


class TDigestTask(EOTask):
Expand Down Expand Up @@ -47,7 +48,7 @@ def __init__(
* | `'total'` computes the total T-Digest representation of the whole feature accumulating all timestamps,
| bands and pixels. Cannot be used with `pixelwise=True`.
* | Callable computes the T-Digest representation defined by the processing function given as mode. Receives
| the input_array of the feature, the timestamps, the shape and the pixelwise and filternan keywords as an input.
| the input_array of the feature, timestamps, shape and pixelwise and filternan keywords as an input.
:param pixelwise: Decider whether to compute the T-Digest representation accumulating pixels or per pixel.
Cannot be used with `mode='total'`.
:param filternan: Decider whether to filter out nan-values before computing the T-Digest.
Expand Down Expand Up @@ -83,8 +84,13 @@ def execute(self, eopatch: EOPatch) -> EOPatch:
for in_feature_, out_feature_, shape in _looper(
in_feature=self.in_feature, out_feature=self.out_feature, eopatch=eopatch
):
eopatch[out_feature_] = _processing_function.get(self.mode, self.mode)(
input_array=eopatch[in_feature_], timestamps=eopatch.timestamps, shape=shape, pixelwise=self.pixelwise, filternan=self.filternan
processing_func = self.mode if callable(self.mode) else _processing_function[self.mode]
eopatch[out_feature_] = processing_func(
input_array=eopatch[in_feature_],
timestamps=eopatch.timestamps,
shape=shape,
pixelwise=self.pixelwise,
filternan=self.filternan,
)

return eopatch
Expand Down Expand Up @@ -120,7 +126,9 @@ def _looper(
yield in_feature_, out_feature_, shape


def _process_standard(input_array: np.ndarray, shape: np.ndarray, pixelwise: bool, filternan: bool, **_: Any) -> np.ndarray:
def _process_standard(
input_array: np.ndarray, shape: np.ndarray, pixelwise: bool, filternan: bool, **_: Any
) -> np.ndarray:
if pixelwise:
array = np.empty(shape[-3:], dtype=object)
for i, j, k in product(range(shape[-3]), range(shape[-2]), range(shape[-1])):
Expand All @@ -134,7 +142,9 @@ def _process_standard(input_array: np.ndarray, shape: np.ndarray, pixelwise: boo
return array


def _process_timewise(input_array: np.ndarray, shape: np.ndarray, pixelwise: bool, filternan: bool, **_: Any) -> np.ndarray:
def _process_timewise(
input_array: np.ndarray, shape: np.ndarray, pixelwise: bool, filternan: bool, **_: Any
) -> np.ndarray:
if pixelwise:
array = np.empty(shape, dtype=object)
for time_, i, j, k in product(range(shape[0]), range(shape[1]), range(shape[2]), range(shape[3])):
Expand Down
18 changes: 9 additions & 9 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def parse_requirements(file):
setup(
name="eo-learn",
python_requires=">=3.8",
version="1.4.1",
version="1.4.2",
description="Earth observation processing framework for machine learning in Python",
long_description=get_long_description(),
long_description_content_type="text/markdown",
Expand All @@ -38,14 +38,14 @@ def parse_requirements(file):
packages=[],
include_package_data=True,
install_requires=[
"eo-learn-core==1.4.1",
"eo-learn-coregistration==1.4.1",
"eo-learn-features==1.4.1",
"eo-learn-geometry==1.4.1",
"eo-learn-io==1.4.1",
"eo-learn-mask==1.4.1",
"eo-learn-ml-tools==1.4.1",
"eo-learn-visualization==1.4.1",
"eo-learn-core==1.4.2",
"eo-learn-coregistration==1.4.2",
"eo-learn-features==1.4.2",
"eo-learn-geometry==1.4.2",
"eo-learn-io==1.4.2",
"eo-learn-mask==1.4.2",
"eo-learn-ml-tools==1.4.2",
"eo-learn-visualization==1.4.2",
],
extras_require={"DEV": parse_requirements("requirements-dev.txt")},
zip_safe=False,
Expand Down
2 changes: 1 addition & 1 deletion visualization/eolearn/visualization/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@

from .eopatch import PlotBackend, PlotConfig

__version__ = "1.4.1"
__version__ = "1.4.2"

0 comments on commit eca3aae

Please sign in to comment.