Skip to content
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
1 change: 0 additions & 1 deletion docs/api-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,6 @@ def get_s3_storage_options(s3_path: str, **s3_kwargs: Any) -> Dict[str, Any]

```python
# S3 store creation and validation
def create_s3_store(s3_path: str, **s3_kwargs: Any) -> str
def validate_s3_access(s3_path: str, **s3_kwargs: Any) -> tuple[bool, Optional[str]]
def s3_path_exists(s3_path: str, **s3_kwargs: Any) -> bool

Expand Down
2 changes: 0 additions & 2 deletions src/eopf_geozarr/conversion/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
"""Conversion tools for EOPF datasets to GeoZarr compliant format."""

from .fs_utils import (
create_s3_store,
get_s3_credentials_info,
is_s3_path,
open_s3_zarr_group,
Expand Down Expand Up @@ -36,7 +35,6 @@
"calculate_aligned_chunk_size",
"is_grid_mapping_variable",
"validate_existing_band_data",
"create_s3_store",
"get_s3_credentials_info",
"is_s3_path",
"open_s3_zarr_group",
Expand Down
23 changes: 0 additions & 23 deletions src/eopf_geozarr/conversion/fs_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,29 +183,6 @@ def normalize_path(path: str) -> str:
return os.path.normpath(path)


def create_s3_store(s3_path: str, **s3_kwargs: Any) -> str:
"""
Create an S3 path with storage options for Zarr operations.

This function now returns the S3 path directly, to be used with
xarray's storage_options parameter instead of creating a store.

Parameters
----------
s3_path : str
S3 path in format s3://bucket/key
**s3_kwargs
Additional keyword arguments for s3fs.S3FileSystem

Returns
-------
str
S3 path to be used with storage_options
"""
# Just return the S3 path - storage options will be handled separately
return s3_path


def write_s3_json_metadata(
s3_path: str, metadata: Mapping[str, Any], **s3_kwargs: Any
) -> None:
Expand Down
23 changes: 7 additions & 16 deletions tests/test_cli_e2e.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@
docs/analysis/eopf-geozarr/EOPF_Sentinel2_ZarrV3_geozarr_compliant.ipynb
"""

import shutil
import subprocess
import tempfile
from pathlib import Path

import pytest
Expand All @@ -18,16 +16,9 @@
class TestCLIEndToEnd:
"""End-to-end CLI tests with real data."""

@pytest.fixture
def temp_output_dir(self): # type: ignore[no-untyped-def]
"""Create a temporary directory for test outputs."""
temp_dir = tempfile.mkdtemp()
yield temp_dir
shutil.rmtree(temp_dir)

@pytest.mark.slow
@pytest.mark.network
def test_cli_convert_real_sentinel2_data(self, temp_output_dir: str) -> None:
def test_cli_convert_real_sentinel2_data(self, tmp_path: Path) -> None:
"""
Test CLI conversion using real Sentinel-2 data from the notebook.

Expand All @@ -42,7 +33,7 @@ def test_cli_convert_real_sentinel2_data(self, temp_output_dir: str) -> None:
"https://objectstore.eodc.eu:2222/e05ab01a9d56408d82ac32d69a5aae2a:sample-data/"
"tutorial_data/cpm_v253/S2B_MSIL1C_20250113T103309_N0511_R108_T32TLQ_20250113T122458.zarr"
)
output_path = Path(temp_output_dir) / "s2b_geozarr_cli_test.zarr"
output_path = tmp_path / "s2b_geozarr_cli_test.zarr"

# Groups to convert (from the notebook)
groups = [
Expand Down Expand Up @@ -289,7 +280,7 @@ def test_cli_crs_groups_option(self) -> None:

@pytest.mark.slow
@pytest.mark.network
def test_cli_convert_with_crs_groups(self, temp_output_dir: str) -> None:
def test_cli_convert_with_crs_groups(self, tmp_path: Path) -> None:
"""
Test CLI conversion with --crs-groups option using real Sentinel-2 data.

Expand All @@ -301,7 +292,7 @@ def test_cli_convert_with_crs_groups(self, temp_output_dir: str) -> None:
"https://objectstore.eodc.eu:2222/e05ab01a9d56408d82ac32d69a5aae2a:sample-data/"
"tutorial_data/cpm_v253/S2B_MSIL1C_20250113T103309_N0511_R108_T32TLQ_20250113T122458.zarr"
)
output_path = Path(temp_output_dir) / "s2b_geozarr_crs_groups_test.zarr"
output_path = tmp_path / "s2b_geozarr_crs_groups_test.zarr"

# Groups to convert
groups = ["/measurements/reflectance/r10m"]
Expand Down Expand Up @@ -383,11 +374,11 @@ def test_cli_convert_with_crs_groups(self, temp_output_dir: str) -> None:

print("✅ CLI convert with --crs-groups test completed successfully")

def test_cli_crs_groups_empty_list(self, temp_output_dir: str) -> None:
def test_cli_crs_groups_empty_list(self, tmp_path: str) -> None:
"""Test CLI with --crs-groups but no groups specified (empty list)."""
# Create a minimal test dataset
test_input = Path(temp_output_dir) / "test_input.zarr"
test_output = Path(temp_output_dir) / "test_output.zarr"
test_input = Path(tmp_path) / "test_input.zarr"
test_output = Path(tmp_path) / "test_output.zarr"

# Create a simple test dataset
import numpy as np
Expand Down
12 changes: 0 additions & 12 deletions tests/test_fs_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import pytest

from eopf_geozarr.conversion.fs_utils import (
create_s3_store,
get_s3_credentials_info,
get_s3_storage_options,
get_storage_options,
Expand Down Expand Up @@ -87,17 +86,6 @@ def test_validate_s3_access_failure(mock_s3fs):
assert "Access denied" in error


def test_create_s3_store_path_handling():
"""Test that create_s3_store returns the S3 path correctly."""
# Test with S3 path
result = create_s3_store("s3://test-bucket/path/to/data")
assert result == "s3://test-bucket/path/to/data"

# Test with bucket only
result = create_s3_store("s3://test-bucket")
assert result == "s3://test-bucket"


def test_get_s3_storage_options():
"""Test that get_s3_storage_options returns correct configuration."""
with patch.dict(
Expand Down