Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 1.5.3 #785

Merged
merged 9 commits into from
Jan 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion .github/workflows/ci_action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,9 @@ jobs:
cache: pip

- name: Install packages
run: pip install -e .[DEV] --upgrade --upgrade-strategy eager
run: | # must install async-timeout until ray fixes issue
pip install -e .[DEV] --upgrade --upgrade-strategy eager
pip install async-timeout

- name: Run full tests and code coverage
if: ${{ matrix.full_test_suite }}
Expand All @@ -110,3 +112,20 @@ jobs:
files: coverage.xml
fail_ci_if_error: true
verbose: false

mirror-and-integration-test-on-gitlab:
if: github.event_name == 'push'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Mirror + trigger CI
uses: SvanBoxel/gitlab-mirror-and-ci-action@master
with:
args: "https://git.sinergise.com/eo/code/eo-learn/"
env:
FOLLOW_TAGS: "true"
GITLAB_HOSTNAME: "git.sinergise.com"
GITLAB_USERNAME: "github-action"
GITLAB_PASSWORD: ${{ secrets.GITLAB_PASSWORD }}
GITLAB_PROJECT_ID: "164"
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
31 changes: 10 additions & 21 deletions .github/workflows/ci_trigger.yml
Original file line number Diff line number Diff line change
@@ -1,30 +1,19 @@
name: mirror_and_trigger
name: trigger

on:
pull_request:
push:
branches:
- "master"
- "develop"
workflow_call:
release:
types:
- published

jobs:
mirror-and-integration-test-on-gitlab:
if: github.event_name == 'push'
trigger:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Mirror + trigger CI
uses: SvanBoxel/gitlab-mirror-and-ci-action@master
with:
args: "https://git.sinergise.com/eo/code/eo-learn/"
env:
FOLLOW_TAGS: "true"
GITLAB_HOSTNAME: "git.sinergise.com"
GITLAB_USERNAME: "github-action"
GITLAB_PASSWORD: ${{ secrets.GITLAB_PASSWORD }}
GITLAB_PROJECT_ID: "164"
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Trigger API
run: >
curl -X POST --fail \
-F token=${{ secrets.GITLAB_PIPELINE_TRIGGER_TOKEN }} \
-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
15 changes: 0 additions & 15 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ image: python:3.9

stages:
- test
- build

run_sh_integration_tests:
stage: test
Expand All @@ -14,17 +13,3 @@ run_sh_integration_tests:
- pip install .[DEV]
- sentinelhub.config --sh_client_id "$SH_CLIENT_ID" --sh_client_secret "$SH_CLIENT_SECRET" > /dev/null # Gitlab can't mask SH_CLIENT_SECRET in logs
- pytest -m sh_integration

build_docker_image:
stage: build
needs: []
rules:
- if: $CI_COMMIT_TAG # run only on releases
when: always
variables:
CUSTOM_RUN_TAG: auto # this will create images with the latest tag and the version tag
LAYER_NAME: dotai-eo
- when: manual
trigger:
project: eo/infra/docker
allow_failure: true
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,18 @@ repos:
- id: debug-statements

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

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

- repo: https://github.com/nbQA-dev/nbQA
rev: 1.7.0
rev: 1.7.1
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 @@ -206,6 +206,9 @@
},
{
"id": "101004112"
},
{
"id": "101059548"
}
]
}
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.3] - 2024-01-10

- Fix `numpy<2` in anticipation of numpy 2.0 release.


## [Version 1.5.2] - 2023-11-07

- `RayExecutor` can now forward remote kwargs to ray jobs.
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 and No. 101004112.
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.
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.2"
__version__ = "1.5.3"

import importlib.util
import warnings
Expand Down
17 changes: 10 additions & 7 deletions eolearn/core/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@
from enum import Enum, EnumMeta
from typing import Any, TypeVar

from typing_extensions import deprecated

from sentinelhub import BBox, MimeType
from sentinelhub.exceptions import deprecated_function

from .exceptions import EODeprecationWarning

Expand Down Expand Up @@ -157,14 +158,16 @@ def is_image(self) -> bool:
"""True if FeatureType stores a dictionary with arrays that represent images. False otherwise."""
return self.is_array() and self.is_spatial()

@deprecated_function(
EODeprecationWarning, "Use the equivalent `is_array` method, or consider if `is_image` fits better."
@deprecated(
"The method `is_raster` has been deprecated. Use the equivalent `is_array` method, or consider if `is_image`"
" fits better.",
category=EODeprecationWarning,
)
def is_raster(self) -> bool:
"""True if FeatureType stores a dictionary with raster data. False otherwise."""
return self.is_array()

@deprecated_function(EODeprecationWarning)
@deprecated("The method `has_dict` has been deprecated.", category=EODeprecationWarning)
def has_dict(self) -> bool:
"""True if FeatureType stores a dictionary. False otherwise."""
return self in [
Expand All @@ -181,7 +184,7 @@ def has_dict(self) -> bool:
FeatureType.META_INFO,
]

@deprecated_function(EODeprecationWarning)
@deprecated("The method `contains_ndarrays` has been deprecated.", category=EODeprecationWarning)
def contains_ndarrays(self) -> bool:
"""True if FeatureType stores a dictionary of numpy.ndarrays. False otherwise."""
return self.is_array()
Expand All @@ -201,7 +204,7 @@ def ndim(self) -> int | None:
}[self]
return None

@deprecated_function(EODeprecationWarning)
@deprecated("The method `type` has been deprecated.", category=EODeprecationWarning)
def type(self) -> type:
"""Returns type of the data for the given FeatureType."""
if self is FeatureType.TIMESTAMPS:
Expand All @@ -210,7 +213,7 @@ def type(self) -> type:
return BBox
return dict

@deprecated_function(EODeprecationWarning)
@deprecated("The method `file_format` has been deprecated.", category=EODeprecationWarning)
def file_format(self) -> MimeType:
"""Returns a mime type enum of a file format into which data of the feature type will be serialized"""
if self.is_array():
Expand Down
10 changes: 6 additions & 4 deletions eolearn/core/core_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
import fs
import numpy as np
from fs.base import FS
from typing_extensions import deprecated

from sentinelhub import SHConfig
from sentinelhub.exceptions import deprecated_class

from .constants import FeatureType, OverwritePermission
from .eodata import EOPatch
Expand Down Expand Up @@ -56,7 +56,9 @@ def execute(self, eopatch: EOPatch) -> EOPatch:
return eopatch.copy(features=self.features, deep=self.deep, copy_timestamps=self.copy_timestamps)


@deprecated_class(EODeprecationWarning, "Use `CopyTask` with the configuration `deep=True`.")
@deprecated(
"Use `CopyTask` with the configuration `deep=True` instead of `DeepCopyTask`.", category=EODeprecationWarning
)
class DeepCopyTask(CopyTask):
"""[DEPRECATED] Makes a deep copy of the given EOPatch."""

Expand Down Expand Up @@ -119,7 +121,7 @@ def __init__(
all features will be saved.
:param overwrite_permission: A level of permission for overwriting an existing EOPatch
to 9 (highest compression).
:save_timestamps: Whether to save the timestamps of the EOPatch. With the `"auto"` setting timestamps are saved
:save_timestamps: Save the timestamps of the EOPatch. With the `"auto"` setting timestamps are saved
if `features=...` or if other temporal features are being saved.
:param use_zarr: Saves numpy-array based features into Zarr files. Requires ZARR extra dependencies.
:param temporal_selection: Writes all of the data to the chosen temporal indices of preexisting arrays. Can be
Expand Down Expand Up @@ -191,7 +193,7 @@ def __init__(
default configuration will be taken.
:param features: A collection of features to be loaded. By default, all features will be loaded.
:param lazy_loading: If `True` features will be lazy loaded.
:load_timestamps: Whether to load the timestamps of the EOPatch. With the `"auto"` setting timestamps are loaded
:load_timestamps: Load the timestamps of the EOPatch. With the `"auto"` setting timestamps are loaded
if `features=...` or if other temporal features are being loaded.
:param temporal_selection: Only loads data corresponding to the chosen indices. Can also be a callable that,
given a list of timestamps, returns a list of booleans declaring which temporal slices to load.
Expand Down
37 changes: 23 additions & 14 deletions eolearn/core/eodata.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@
import geopandas as gpd
import numpy as np
from fs.base import FS
from typing_extensions import deprecated

from sentinelhub import CRS, BBox, parse_time
from sentinelhub.exceptions import deprecated_function

from .constants import FEATURETYPE_DEPRECATION_MSG, TIMESTAMP_COLUMN, FeatureType, OverwritePermission
from .eodata_io import FeatureIO, load_eopatch_content, save_eopatch
Expand Down Expand Up @@ -427,7 +427,10 @@ def __contains__(self, key: object) -> bool:
"`(feature_type, feature_name)` pairs."
)

@deprecated_function(EODeprecationWarning, "Use the `merge` method instead.")
@deprecated(
"The `+` operator for EOPatches has been deprecated. Use the function `eolearn.core.merge_eopatches` instead.",
category=EODeprecationWarning,
)
def __add__(self, other: EOPatch) -> EOPatch:
"""Merges two EOPatches into a new EOPatch."""
return self.merge(other)
Expand Down Expand Up @@ -499,7 +502,7 @@ def __copy__(
"""Returns a new EOPatch with shallow copies of given features.

:param features: A collection of features or feature types that will be copied into new EOPatch.
:param copy_timestamps: Whether to copy timestamps to the new EOPatch. By default copies them over if all
:param copy_timestamps: Copy timestamps to the new EOPatch. By default copies them over if all
features are copied or if any temporal features are getting copied.
"""
if not features: # For some reason deepcopy and copy pass {} by default
Expand All @@ -526,7 +529,7 @@ def __deepcopy__(

:param memo: built-in parameter for memoization
:param features: A collection of features or feature types that will be copied into new EOPatch.
:param copy_timestamps: Whether to copy timestamps to the new EOPatch. By default copies them over if all
:param copy_timestamps: Copy timestamps to the new EOPatch. By default copies them over if all
features are copied or if any temporal features are getting copied.
"""
if not features: # For some reason deepcopy and copy pass {} by default
Expand Down Expand Up @@ -564,7 +567,7 @@ def copy(
:param features: Features to be copied into a new `EOPatch`. By default, all features will be copied.
:param deep: If `True` it will make a deep copy of all data inside the `EOPatch`. Otherwise, only a shallow copy
of `EOPatch` will be made. Note that `BBOX` and `TIMESTAMPS` will be copied even with a shallow copy.
:param copy_timestamps: Whether to copy timestamps to the new EOPatch. By default copies them over if all
:param copy_timestamps: Copy timestamps to the new EOPatch. By default copies them over if all
features are copied or if any temporal features are getting copied.
:return: An EOPatch copy.
"""
Expand All @@ -591,14 +594,14 @@ def get_features(self) -> list[Feature]:

:return: List of non-empty features
"""
feature_list: list[Feature] = []
with warnings.catch_warnings():
warnings.filterwarnings("ignore", message=FEATURETYPE_DEPRECATION_MSG.format(".*?", ".*?"))
removed_ftypes = {FeatureType.BBOX, FeatureType.TIMESTAMPS} # list comprehensions make ignoring hard
for feature_type in (ftype for ftype in FeatureType if ftype not in removed_ftypes):
for feature_name in self[feature_type]:
feature_list.append((feature_type, feature_name))
return feature_list
return [
(feature_type, feature_name)
for feature_type in (ftype for ftype in FeatureType if ftype not in removed_ftypes)
for feature_name in self[feature_type]
]

def save(
self,
Expand All @@ -620,7 +623,7 @@ def save(
:param overwrite_permission: A level of permission for overwriting an existing EOPatch
:param filesystem: An existing filesystem object. If not given it will be initialized according to the `path`
parameter.
:save_timestamps: Whether to save the timestamps of the EOPatch. With the `"auto"` setting timestamps are saved
:save_timestamps: Save the timestamps of the EOPatch. With the `"auto"` setting timestamps are saved
if `features=...` or if other temporal features are being saved.
:param use_zarr: Saves numpy-array based features into Zarr files. Requires ZARR extra dependencies.
:param temporal_selection: Writes all of the data to the chosen temporal indices of preexisting arrays. Can be
Expand Down Expand Up @@ -666,7 +669,7 @@ def load(
:param lazy_loading: If `True` features will be lazy loaded.
:param filesystem: An existing filesystem object. If not given it will be initialized according to the `path`
parameter.
:load_timestamps: Whether to load the timestamps of the EOPatch. With the `"auto"` setting timestamps are loaded
:load_timestamps: Load the timestamps of the EOPatch. With the `"auto"` setting timestamps are loaded
if `features=...` or if other temporal features are being loaded.
:param temporal_selection: Only loads data corresponding to the chosen indices. Can also be a callable that,
given a list of timestamps, returns a list of booleans declaring which temporal slices to load.
Expand All @@ -688,7 +691,10 @@ def load(
_trigger_loading_for_eopatch_features(eopatch)
return eopatch

@deprecated_function(EODeprecationWarning, "Use the function `eolearn.core.merge_eopatches` instead.")
@deprecated(
"The EOPatch method `merge` has been deprecated. Use the function `eolearn.core.merge_eopatches` instead.",
category=EODeprecationWarning,
)
def merge(
self,
*eopatches: EOPatch,
Expand Down Expand Up @@ -727,7 +733,10 @@ def merge(
self, *eopatches, features=features, time_dependent_op=time_dependent_op, timeless_op=timeless_op
)

@deprecated_function(EODeprecationWarning, "Please use the method `temporal_subset` instead.")
@deprecated(
"The method `consolidate_timestamps` has been deprecated. Use the method `temporal_subset` instead.",
category=EODeprecationWarning,
)
def consolidate_timestamps(self, timestamps: list[dt.datetime]) -> set[dt.datetime]:
"""Removes all frames from the EOPatch with a date not found in the provided timestamps list.

Expand Down
Loading
Loading