Skip to content

Commit

Permalink
Merge pull request #464 from sentinel-hub/develop
Browse files Browse the repository at this point in the history
Release version 1.2.1
  • Loading branch information
zigaLuksic committed Sep 12, 2022
2 parents fd41552 + 64d155e commit 59947fb
Show file tree
Hide file tree
Showing 46 changed files with 986 additions and 473 deletions.
18 changes: 13 additions & 5 deletions .github/workflows/ci_action.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
name: build

on:
pull_request:
push:
branches:
- 'master'
- 'develop'
schedule:
- cron: '0 0 * * *'

env:
# The only way to simulate if-else statement
CHECKOUT_BRANCH: ${{ github.event_name == 'push' && github.ref || 'develop' }}
CHECKOUT_BRANCH: ${{ github.event_name == 'schedule' && 'develop' || github.ref }}


jobs:
Expand Down Expand Up @@ -48,9 +52,13 @@ jobs:
matrix:
python-version:
- '3.7'
- '3.8'
- '3.9'
- '3.10'
include:
# A flag marks whether full or partial tests should be run
# We don't run integration tests on pull requests from outside repos, because they don't have secrets
- python-version: '3.8'
full_test_suite: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository }}
steps:
- name: Checkout branch
uses: actions/checkout@v2
Expand All @@ -71,21 +79,21 @@ jobs:
python install_all.py -e
- name: Run full tests and code coverage
if: matrix.python-version == '3.8'
if: ${{ matrix.full_test_suite }}
run: |
sentinelhub.config \
--sh_client_id "${{ secrets.SH_CLIENT_ID }}" \
--sh_client_secret "${{ secrets.SH_CLIENT_SECRET }}"
pytest --cov --cov-report=term --cov-report=xml
- name: Run pylint and reduced tests
if: matrix.python-version != '3.8'
if: ${{ !matrix.full_test_suite }}
run: |
make pylint
pytest -m "not sh_integration"
- name: Upload code coverage
if: matrix.python-version == '3.8'
if: ${{ matrix.full_test_suite }}
uses: codecov/codecov-action@v2
with:
files: coverage.xml
Expand Down
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -114,11 +114,14 @@ Pipfile*
/docs/source/examples
/docs/source/markdowns
/docs/source/eotasks.rst
/docs/source/reference/*.rst
/docs/source/reference/

# pytest
.pytest_cache/
features/.pytest_cache

# execution reports
**execution-report**

# MacOS cache
.DS_Store
6 changes: 4 additions & 2 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@ version: 2
sphinx:
configuration: docs/source/conf.py

python:
version: 3.7
build:
os: "ubuntu-20.04"
tools:
python: "mambaforge-4.10"

conda:
environment: docs/environment.yml
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
## [Version 1.2.1] - 2022-09-12

- Corrected the default for `no_data_value` in `ImportFromTiffTask` and `ExportToTiffTask` to `None`. The previous default of `0` was a poor choice in many scenarios. The switch might alter behavior in existing code.
- Changed the way `SpatialResizeTask` accepts parameters for the final image size. Now supports resizing by using resolution.
- Added `ExplodeBandsTask` that explodes a multi-band feature into multiple features.
- Exposed resampling parameters in Sentinel Hub tasks and included a `geometry` execution parameter.
- Reworked internal classes `FeatureIO` and `_FeatureDict` to improve types and maintainability.
- Fixed y-axis orientation of `MeteoblueRasterTask`.
- `FilterTimeSeriesTask` adjusted to work with multiprocessing.
- EOPatch plotting no longer anti-aliases by default (removes issues with phantom values in mask plots)
- Improved documentation building, fixing a few broken links.


## [Version 1.2.0] - 2022-07-27

- Improved handling of filesystem objects:
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 @@ -31,4 +31,4 @@
from .utils.parallelize import execute_with_mp_lock, join_futures, join_futures_iter, parallelize
from .utils.parsing import FeatureParser

__version__ = "1.2.0"
__version__ = "1.2.1"
26 changes: 26 additions & 0 deletions core/eolearn/core/core_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,12 @@
"""
import copy
from abc import ABCMeta, abstractmethod
from typing import Dict, Iterable, Tuple, Union

import fs
import numpy as np

from .constants import FeatureType
from .eodata import EOPatch
from .eotask import EOTask
from .utils.fs import get_filesystem, pickle_fs, unpickle_fs
Expand Down Expand Up @@ -555,6 +557,30 @@ def map_method(self, feature):
return feature[..., self.bands]


class ExplodeBandsTask(EOTask):
"""Explode a subset of bands from one feature to multiple new features."""

def __init__(
self,
input_feature: Tuple[FeatureType, str],
output_mapping: Dict[Tuple[FeatureType, str], Union[int, Iterable[int]]],
):
"""
:param input_feature: A source feature from which to take the subset of bands.
:param output_mapping: A mapping of output features into the band indices used to explode the input feature.
"""
self.input_feature = input_feature
self.output_mapping = output_mapping

def execute(self, eopatch):
for output_feature, bands in self.output_mapping.items():
new_bands = list(bands) if isinstance(bands, Iterable) else [bands]
eopatch = ExtractBandsTask(
input_feature=self.input_feature, output_feature=output_feature, bands=new_bands
).execute(eopatch)
return eopatch


class CreateEOPatchTask(EOTask):
"""Creates an EOPatch."""

Expand Down

0 comments on commit 59947fb

Please sign in to comment.