Skip to content

Commit

Permalink
Release 1.5.4, Merge pull request #791 from sentinel-hub/develop
Browse files Browse the repository at this point in the history
Release 1.5.4
  • Loading branch information
zigaLuksic committed May 13, 2024
2 parents bd4717b + efa49d4 commit c7a39ed
Show file tree
Hide file tree
Showing 25 changed files with 204 additions and 152 deletions.
20 changes: 10 additions & 10 deletions .github/workflows/ci_action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -105,13 +105,13 @@ jobs:
if: ${{ !matrix.full_test_suite }}
run: pytest -m "not sh_integration and not geopedia"

- name: Upload code coverage
if: ${{ matrix.full_test_suite && github.event_name == 'push' }}
uses: codecov/codecov-action@v2
with:
files: coverage.xml
fail_ci_if_error: true
verbose: false
# - name: Upload code coverage
# if: ${{ matrix.full_test_suite && github.event_name == 'push' }}
# uses: codecov/codecov-action@v2
# with:
# files: coverage.xml
# fail_ci_if_error: true
# verbose: false

mirror-and-integration-test-on-gitlab:
if: github.event_name == 'push'
Expand All @@ -121,11 +121,11 @@ jobs:
- name: Mirror + trigger CI
uses: SvanBoxel/gitlab-mirror-and-ci-action@master
with:
args: "https://git.sinergise.com/eo/code/eo-learn/"
args: "https://hello.planet.com/code/eo/code/eo-learn"
env:
FOLLOW_TAGS: "true"
GITLAB_HOSTNAME: "git.sinergise.com"
GITLAB_HOSTNAME: "hello.planet.com/code"
GITLAB_USERNAME: "github-action"
GITLAB_PASSWORD: ${{ secrets.GITLAB_PASSWORD }}
GITLAB_PROJECT_ID: "164"
GITLAB_PROJECT_ID: "9715"
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2 changes: 1 addition & 1 deletion .github/workflows/ci_trigger.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ jobs:
-F ref=main \
-F variables[CUSTOM_RUN_TAG]=auto \
-F variables[LAYER_NAME]=dotai-eo \
https://git.sinergise.com/api/v4/projects/1031/trigger/pipeline
https://hello.planet.com/code/api/v4/projects/9723/trigger/pipeline
5 changes: 4 additions & 1 deletion .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
image: python:3.9
default:
image: python:3.9
tags:
- sinergise-lju

stages:
- test
Expand Down
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.5.0
rev: v4.6.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.12.1
rev: 24.4.2
hooks:
- id: black
language_version: python3

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

- repo: https://github.com/nbQA-dev/nbQA
rev: 1.7.1
rev: 1.8.5
hooks:
- id: nbqa-black
- id: nbqa-ruff
3 changes: 3 additions & 0 deletions .zenodo.json
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,9 @@
},
{
"id": "101059548"
},
{
"id": "101086461"
}
]
}
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## [Version 1.5.4] - 2024-05-13

- Minor fixes for documentation


## [Version 1.5.3] - 2024-01-10

- Fix `numpy<2` in anticipation of numpy 2.0 release.
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -202,4 +202,4 @@ See [LICENSE](https://github.com/sentinel-hub/eo-learn/blob/master/LICENSE).

## Acknowledgements

This project has received funding from the European Union’s Horizon 2020 research and innovation programme under grant agreements No. 776115, No. 101004112 and No. 101059548.
This project has received funding from the European Union’s Horizon 2020 research and innovation programme under grant agreements No. 776115, No. 101004112, No. 101059548 and No. 101086461.
2 changes: 1 addition & 1 deletion docs/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ dependencies:
- sphinx_rtd_theme==1.3.0
- nbsphinx
- jupyter
- sphinx_mdinclude
- sphinx_mdinclude==0.5.4

- ./../.[FULL]
2 changes: 1 addition & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ def get_subclasses(cls):
module = "eolearn"

APIDOC_OPTIONS = ["--module-first", "--separate", "--no-toc", "--templatedir", os.path.join(current_dir, "_templates")]
APIDOC_EXCLUDE = ["graph.py", "eodata_io.py", "eodata_merge.py"]
APIDOC_EXCLUDE = ["graph.py", "eodata_io.py"]

shutil.rmtree(reference_dir, ignore_errors=True)
shutil.copytree(custom_reference_dir, reference_dir)
Expand Down
2 changes: 1 addition & 1 deletion eolearn/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""Main module of the `eolearn` package."""

__version__ = "1.5.3"
__version__ = "1.5.4"

import importlib.util
import warnings
Expand Down
2 changes: 1 addition & 1 deletion eolearn/core/eoexecution.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ def __init__(

@staticmethod
def _parse_and_validate_execution_kwargs(
execution_kwargs: Iterable[dict[EONode, dict[str, object]]]
execution_kwargs: Iterable[dict[EONode, dict[str, object]]],
) -> list[dict[EONode, dict[str, object]]]:
"""Parses and validates execution arguments provided by user and raises an error if something is wrong."""
for input_kwargs in execution_kwargs:
Expand Down
10 changes: 6 additions & 4 deletions eolearn/features/extra/interpolation.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,10 +273,12 @@ def interpolate_data(self, data: np.ndarray, times: np.ndarray, resampled_times:

# array defining index correspondence between reference times and resampled times
min_time, max_time = np.min(resampled_times), np.max(resampled_times)
ori2res = np.array([
np.abs(resampled_times - orig_time).argmin() if min_time <= orig_time <= max_time else None
for orig_time in times
])
ori2res = np.array(
[
np.abs(resampled_times - orig_time).argmin() if min_time <= orig_time <= max_time else None
for orig_time in times
]
)

# find NaNs that start or end a time-series
row_nans, col_nans = np.where(self._get_start_end_nans(data))
Expand Down
2 changes: 1 addition & 1 deletion eolearn/io/sentinelhub_process.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
""" Input tasks that collect data from `Sentinel-Hub Process API
"""Input tasks that collect data from `Sentinel-Hub Process API
<https://docs.sentinel-hub.com/api/latest/api/process/>`__
Copyright (c) 2017- Sinergise and contributors
Expand Down
20 changes: 11 additions & 9 deletions eolearn/visualization/eoexecutor.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,15 +163,17 @@ def _get_node_descriptions(self) -> list[dict[str, Any]]:
f" usually {np.mean(durations):.4g} ± {np.std(durations):.4g} seconds"
)

descriptions.append({
"name": f"{node_name} ({node.uid})",
"uid": node.uid,
"args": {
key: value.replace("<", "&lt;").replace(">", "&gt;") # type: ignore[attr-defined]
for key, value in node.task.private_task_config.init_args.items()
},
"duration_report": duration_report,
})
descriptions.append(
{
"name": f"{node_name} ({node.uid})",
"uid": node.uid,
"args": {
key: value.replace("<", "&lt;").replace(">", "&gt;") # type: ignore[attr-defined]
for key, value in node.task.private_task_config.init_args.items()
},
"duration_report": duration_report,
}
)
return descriptions

def _render_execution_tracebacks(self, formatter: pygments.formatter.Formatter) -> list:
Expand Down
12 changes: 7 additions & 5 deletions examples/core/CoreOverview.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -801,11 +801,13 @@
}
],
"source": [
"results = workflow.execute({\n",
" load_node: {\"eopatch_folder\": \"TestEOPatch\"},\n",
" add_feature_node: {\"data\": np.zeros((68, 3), dtype=np.uint8)},\n",
" save_node: {\"eopatch_folder\": \"WorkflowEOPatch\"},\n",
"})\n",
"results = workflow.execute(\n",
" {\n",
" load_node: {\"eopatch_folder\": \"TestEOPatch\"},\n",
" add_feature_node: {\"data\": np.zeros((68, 3), dtype=np.uint8)},\n",
" save_node: {\"eopatch_folder\": \"WorkflowEOPatch\"},\n",
" }\n",
")\n",
"\n",
"results"
]
Expand Down
10 changes: 6 additions & 4 deletions examples/io/SentinelHubIO.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -374,10 +374,12 @@
"workflow_nodes = linearly_connect_tasks(input_task, add_indices, add_l2a_and_scl, add_dem, save, output_task)\n",
"workflow = EOWorkflow(workflow_nodes)\n",
"\n",
"result = workflow.execute({\n",
" workflow_nodes[0]: {\"bbox\": roi_bbox, \"time_interval\": time_interval},\n",
" workflow_nodes[-2]: {\"eopatch_folder\": \"eopatch\"},\n",
"})"
"result = workflow.execute(\n",
" {\n",
" workflow_nodes[0]: {\"bbox\": roi_bbox, \"time_interval\": time_interval},\n",
" workflow_nodes[-2]: {\"eopatch_folder\": \"eopatch\"},\n",
" }\n",
")"
]
},
{
Expand Down
34 changes: 20 additions & 14 deletions examples/land-cover-map/SI_LULC_pipeline.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -744,10 +744,12 @@
"save_node = workflow_nodes[-1]\n",
"execution_args = []\n",
"for idx, bbox in enumerate(bbox_list[patch_ids]):\n",
" execution_args.append({\n",
" input_node: {\"bbox\": bbox, \"time_interval\": time_interval},\n",
" save_node: {\"eopatch_folder\": f\"eopatch_{idx}\"},\n",
" })\n",
" execution_args.append(\n",
" {\n",
" input_node: {\"bbox\": bbox, \"time_interval\": time_interval},\n",
" save_node: {\"eopatch_folder\": f\"eopatch_{idx}\"},\n",
" }\n",
" )\n",
"\n",
"# Execute the workflow\n",
"executor = EOExecutor(workflow, execution_args, save_logs=True)\n",
Expand Down Expand Up @@ -1329,11 +1331,13 @@
"\n",
"execution_args = []\n",
"for idx in range(len(patch_ids)):\n",
" execution_args.append({\n",
" workflow_nodes[0]: {\"eopatch_folder\": f\"eopatch_{idx}\"}, # load\n",
" workflow_nodes[-2]: {\"seed\": 42}, # sampling\n",
" workflow_nodes[-1]: {\"eopatch_folder\": f\"eopatch_{idx}\"}, # save\n",
" })\n",
" execution_args.append(\n",
" {\n",
" workflow_nodes[0]: {\"eopatch_folder\": f\"eopatch_{idx}\"}, # load\n",
" workflow_nodes[-2]: {\"seed\": 42}, # sampling\n",
" workflow_nodes[-1]: {\"eopatch_folder\": f\"eopatch_{idx}\"}, # save\n",
" }\n",
" )\n",
"\n",
"executor = EOExecutor(workflow, execution_args, save_logs=True)\n",
"executor.run(workers=5)\n",
Expand Down Expand Up @@ -2002,11 +2006,13 @@
"# Create a list of execution arguments for each patch\n",
"execution_args = []\n",
"for i in range(len(patch_ids)):\n",
" execution_args.append({\n",
" workflow_nodes[0]: {\"eopatch_folder\": f\"eopatch_{i}\"},\n",
" workflow_nodes[2]: {\"filename\": f\"{tiff_location}/prediction_eopatch_{i}.tiff\"},\n",
" workflow_nodes[3]: {\"eopatch_folder\": f\"eopatch_{i}\"},\n",
" })\n",
" execution_args.append(\n",
" {\n",
" workflow_nodes[0]: {\"eopatch_folder\": f\"eopatch_{i}\"},\n",
" workflow_nodes[2]: {\"filename\": f\"{tiff_location}/prediction_eopatch_{i}.tiff\"},\n",
" workflow_nodes[3]: {\"eopatch_folder\": f\"eopatch_{i}\"},\n",
" }\n",
" )\n",
"\n",
"# Run the executor\n",
"executor = EOExecutor(workflow, execution_args)\n",
Expand Down
8 changes: 5 additions & 3 deletions examples/water-monitor/WaterMonitorWorkflow.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -430,9 +430,11 @@
"# The download task requires additional arguments at execution. These are linked to the node the task is in.\n",
"download_node = workflow_nodes[0]\n",
"\n",
"result = workflow.execute({\n",
" download_node: {\"bbox\": dam_bbox, \"time_interval\": time_interval},\n",
"})"
"result = workflow.execute(\n",
" {\n",
" download_node: {\"bbox\": dam_bbox, \"time_interval\": time_interval},\n",
" }\n",
")"
]
},
{
Expand Down
5 changes: 2 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -72,19 +72,18 @@ docs = [
"jupyter",
"nbsphinx",
"sphinx==7.1.2",
"sphinx_mdinclude",
"sphinx_mdinclude==0.5.4", #0.6 didn't work last time
"sphinx_rtd_theme==1.3.0",
]
dev = [
"build",
"eo-learn[FULL]",
"hypothesis",
"moto",
"moto[s3]>=5.0.0",
"mypy>=0.990",
"pylint>=2.14.0",
"pytest>=7.0.0",
"pytest-cov",
"pytest-lazy-fixture",
"pytest-mock",
"twine",
"types-python-dateutil",
Expand Down
27 changes: 0 additions & 27 deletions tests/core/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,8 @@
from __future__ import annotations

import os
from typing import Callable

import boto3
import pytest
from fs_s3fs import S3FS
from moto import mock_s3

from eolearn.core import EOPatch

Expand All @@ -28,26 +24,3 @@ def test_eopatch_path_fixture() -> str:
@pytest.fixture(name="test_eopatch")
def test_eopatch_fixture(test_eopatch_path) -> EOPatch:
return EOPatch.load(test_eopatch_path)


@pytest.fixture(name="create_mocked_s3fs", scope="session")
def s3_mocking_fixture() -> Callable[[str], S3FS]:
"""Provides a function for mocking S3 buckets"""

@mock_s3
def create_mocked_s3fs(bucket_name: str = "mocked-test-bucket") -> S3FS:
"""Creates a new empty mocked s3 bucket. If one such bucket already exists it deletes it first."""
s3resource = boto3.resource("s3", region_name="eu-central-1")

bucket = s3resource.Bucket(bucket_name)

if bucket.creation_date: # If bucket already exists
for key in bucket.objects.all():
key.delete()
bucket.delete()

s3resource.create_bucket(Bucket=bucket_name, CreateBucketConfiguration={"LocationConstraint": "eu-central-1"})

return S3FS(bucket_name=bucket_name)

return create_mocked_s3fs
16 changes: 9 additions & 7 deletions tests/core/test_core_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,15 @@

@pytest.fixture(name="patch")
def patch_fixture() -> EOPatch:
patch = generate_eopatch({
FeatureType.DATA: ["bands", "CLP"],
FeatureType.MASK: ["CLM"],
FeatureType.MASK_TIMELESS: ["mask", "LULC", "RANDOM_UINT8"],
FeatureType.SCALAR: ["values", "CLOUD_COVERAGE"],
FeatureType.META_INFO: ["something"],
})
patch = generate_eopatch(
{
FeatureType.DATA: ["bands", "CLP"],
FeatureType.MASK: ["CLM"],
FeatureType.MASK_TIMELESS: ["mask", "LULC", "RANDOM_UINT8"],
FeatureType.SCALAR: ["values", "CLOUD_COVERAGE"],
FeatureType.META_INFO: ["something"],
}
)
patch.data["CLP_S2C"] = np.zeros_like(patch.data["CLP"])
return patch

Expand Down
Loading

0 comments on commit c7a39ed

Please sign in to comment.