Skip to content

Commit

Permalink
Merge pull request #317 from sentinel-hub/develop
Browse files Browse the repository at this point in the history
Release 1.7.3
  • Loading branch information
zigaLuksic authored Dec 11, 2023
2 parents d37b575 + 158a6e0 commit fedb61e
Show file tree
Hide file tree
Showing 8 changed files with 60 additions and 18 deletions.
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ repos:
- id: debug-statements

- repo: https://github.com/pre-commit/mirrors-prettier
rev: "v3.1.0"
rev: "v4.0.0-alpha.4"
hooks:
- id: prettier
exclude: "tests/(test_stats|test_project)/"
Expand All @@ -26,12 +26,12 @@ repos:
language_version: python3

- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: "v0.1.6"
rev: "v0.1.7"
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
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@
## [Version 1.7.3] - 2023-12-11

- Fix bug with versions of `sentinelhub-py >= 3.10.0` due to bad version string comparison.
- Adjust rounding of statistics for vector data.


## [Version 1.7.2] - 2023-11-28

- Fix pipeline-chain execution when using CLI


## [Version 1.7.1] - 2023-11-23

- Fixed `eogrow-validate` command when validating pipeline chains that use variables.
- Restricted version of `typing_extensions`


## [Version 1.7.0] - 2023-11-22
With this release we push `eo-grow` towards a more `ray` centered execution model.

Expand Down
2 changes: 1 addition & 1 deletion eogrow/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
"""The main module of the eo-grow package."""

__version__ = "1.7.2"
__version__ = "1.7.3"
3 changes: 1 addition & 2 deletions eogrow/core/storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import fs
from pydantic import BaseSettings, Field

import sentinelhub
from eolearn.core.utils.fs import get_aws_credentials, get_filesystem, is_s3_path
from sentinelhub import SHConfig

Expand Down Expand Up @@ -65,7 +64,7 @@ def __init__(self, config: Schema):
def _prepare_sh_config(self) -> SHConfig:
"""Prepares an instance of `SHConfig` containing AWS credentials. In case given AWS profile doesn't exist it
will show a warning and return a config without AWS credentials."""
sh_config = SHConfig(hide_credentials=True) if sentinelhub.__version__ < "3.9.0" else SHConfig()
sh_config = SHConfig()

if self.is_on_s3() and self.config.aws_profile:
sh_config = get_aws_credentials(aws_profile=self.config.aws_profile, config=sh_config)
Expand Down
6 changes: 5 additions & 1 deletion eogrow/utils/testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import os
from collections import defaultdict
from dataclasses import dataclass
from functools import partial
from typing import Any, Iterable, cast

import fs
Expand Down Expand Up @@ -189,10 +190,13 @@ def _get_coords_sample(geom: Polygon | MultiPolygon | Any) -> list[tuple[float,
if len(gdf):
subsample: gpd.GeoDataFrame = gdf.sample(min(len(gdf), config.num_random_values), random_state=42)
subsample["centroid"] = subsample.centroid.apply(_rounder)
subsample["area"] = subsample.area.apply(_prepare_value, dtype=np.float64)
subsample["area"] = subsample.area
subsample["geometry_type"] = subsample.geometry.geom_type
subsample["some_coords"] = subsample.geometry.apply(_get_coords_sample)

for col in subsample.select_dtypes(include="number").columns.values:
subsample[col] = subsample[col].apply(partial(_prepare_value, dtype=subsample[col].dtype))

subsample_json_string = subsample.drop(columns="geometry").to_json(orient="index", date_format="iso")
stats["random_rows"] = json.loads(subsample_json_string)

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ dependencies = [
"python-rapidjson",
"rasterio",
"ray[default]",
"sentinelhub>=3.6.2",
"sentinelhub>=3.9.0",
"shapely>=1.8.0",
"typing-extensions>=4.5.0",
]
Expand Down
49 changes: 40 additions & 9 deletions tests/pipelines/test_byoc.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@
@pytest.fixture(name="configured_requests_mock")
def request_mock_setup(requests_mock):
requests_mock.get(url="/latest/dynamic/instance-identity/document", real_http=True) # logging
requests_mock.post(url="/oauth/token", real_http=True)
requests_mock.post(
url="https://services.sentinel-hub.com/auth/realms/main/protocol/openid-connect/token", real_http=True
)

# creating a new collection
requests_mock.post(url="/api/v1/byoc/collections", response_list=[{"json": {"data": {"id": "mock-collection"}}}])
Expand Down Expand Up @@ -79,7 +81,7 @@ def test_timeless_byoc(config_and_stats_paths, preparation_config, config, confi
pipeline, requests = run_byoc_pipeline(config_path, configured_requests_mock)

auth_request = requests.pop(0)
assert auth_request.url == "https://services.sentinel-hub.com/oauth/token"
assert auth_request.url == "https://services.sentinel-hub.com/auth/realms/main/protocol/openid-connect/token"

creation_request = requests.pop(0)
assert creation_request.url == "https://services.sentinel-hub.com/api/v1/byoc/collections"
Expand Down Expand Up @@ -111,7 +113,7 @@ def test_temporal_byoc(config_and_stats_paths, preparation_config, config, confi
pipeline, requests = run_byoc_pipeline(config_path, configured_requests_mock)

auth_request = requests.pop(0)
assert auth_request.url == "https://services.sentinel-hub.com/oauth/token"
assert auth_request.url == "https://services.sentinel-hub.com/auth/realms/main/protocol/openid-connect/token"

creation_request = requests.pop(0)
assert creation_request.url == "https://services.sentinel-hub.com/api/v1/byoc/collections"
Expand All @@ -124,12 +126,41 @@ def test_temporal_byoc(config_and_stats_paths, preparation_config, config, confi
assert check_request.method == "GET"

timestamps = [
"2019-01-04T07:48:37Z",
"2019-01-24T07:48:39Z",
"2019-02-13T07:48:39Z",
"2019-02-18T07:48:36Z",
"2019-02-23T07:49:38Z",
"2019-03-05T07:55:53Z",
"2018-01-19T07:42:27Z",
"2018-02-28T07:46:50Z",
"2018-03-05T07:38:03Z",
"2018-03-25T07:44:17Z",
"2018-04-09T07:38:40Z",
"2018-04-19T07:43:26Z",
"2018-04-24T07:46:03Z",
"2018-05-09T07:36:10Z",
"2018-05-19T07:45:29Z",
"2018-06-08T07:43:25Z",
"2018-06-13T07:43:56Z",
"2018-06-18T07:42:58Z",
"2018-06-23T07:46:07Z",
"2018-06-28T07:45:41Z",
"2018-07-03T07:36:13Z",
"2018-07-08T07:42:00Z",
"2018-07-13T07:44:13Z",
"2018-08-02T07:36:12Z",
"2018-08-07T07:41:24Z",
"2018-08-17T07:47:30Z",
"2018-08-22T07:45:09Z",
"2018-08-27T07:39:47Z",
"2018-09-01T07:36:10Z",
"2018-09-06T07:40:44Z",
"2018-09-11T07:44:09Z",
"2018-09-16T07:41:35Z",
"2018-09-21T07:46:13Z",
"2018-09-26T07:47:11Z",
"2018-10-01T07:37:17Z",
"2018-10-21T07:39:34Z",
"2018-10-31T07:41:47Z",
"2018-11-10T07:48:34Z",
"2018-11-20T07:48:33Z",
"2018-12-15T07:48:33Z",
"2018-12-30T07:48:33Z",
]
for tile_request in requests:
assert tile_request.url == "https://services.sentinel-hub.com/api/v1/byoc/collections/mock-collection/tiles"
Expand Down
2 changes: 1 addition & 1 deletion tests/test_config_files/byoc/prepare_bands_data.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"maps": "maps/BANDS-S2-L1C"
}
},
"input_folder_key": "data_2019",
"input_folder_key": "data",
"output_folder_key": "maps",
"feature": ["data", "BANDS-S2-L1C"],
"map_dtype": "float32",
Expand Down

0 comments on commit fedb61e

Please sign in to comment.