diff --git a/docs/api-reference.md b/docs/api-reference.md index ed6aca8..4d64f7c 100644 --- a/docs/api-reference.md +++ b/docs/api-reference.md @@ -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 diff --git a/src/eopf_geozarr/conversion/__init__.py b/src/eopf_geozarr/conversion/__init__.py index 9f72087..3764a80 100644 --- a/src/eopf_geozarr/conversion/__init__.py +++ b/src/eopf_geozarr/conversion/__init__.py @@ -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, @@ -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", diff --git a/src/eopf_geozarr/conversion/fs_utils.py b/src/eopf_geozarr/conversion/fs_utils.py index dc2ef52..e3f048c 100644 --- a/src/eopf_geozarr/conversion/fs_utils.py +++ b/src/eopf_geozarr/conversion/fs_utils.py @@ -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: diff --git a/tests/test_cli_e2e.py b/tests/test_cli_e2e.py index 75f4df9..121012d 100644 --- a/tests/test_cli_e2e.py +++ b/tests/test_cli_e2e.py @@ -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 @@ -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. @@ -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 = [ @@ -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. @@ -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"] @@ -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 diff --git a/tests/test_fs_utils.py b/tests/test_fs_utils.py index 05d5cd5..ebdf627 100644 --- a/tests/test_fs_utils.py +++ b/tests/test_fs_utils.py @@ -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, @@ -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(