You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Update documentation for Sentinel-2 optimized conversion (EOPF-Explorer#83)
* add option for using new multiscales convention in optimized conversion
* remove OOP converter and use plain functions
* use pydantic models for fingerprinting sentinel2 product
* fix multiscales to use da.coarsen and propagate encoding
* ensure that dtype is preserved after resampling
* add new multiscales JSON example
* add mypy pydantic plugin
* lint
* add s1 and s2 demo data to tests, and don't test against remote urls
* fix e2e tests
* remove network test workflow from CI
* remove extra type definition and update tests
* remove explicit zarr groups in favor of dynamic test fixtures
* docstrings
* Enhance CRS initialization and update S2 optimization commands
- Added `initialize_crs_from_dataset` function to extract CRS from dataset metadata.
- Updated S2 optimization commands to include new CRS handling.
- Removed unused arguments related to geometry and meteorology groups.
- Added comprehensive tests for CRS initialization from various sources.
* Refactor code formatting for clarity in S2 optimization functions
* fix failing / warning tests
* add strict JSON schema equality check to e2e tests
* support both flavors of multiscale metadata
* dont manage return codes in cli functions
* add s2 optimized test
* add optimized geozarr exmaple hierarchies
* format JSON documents
* mid-debug of e2e tests
* WIP e2e fixes
* make cf standard name validator become a pass-through when no internet connection
* update example schemas
* narrow type to just tuples in types.py
* refactor consolidation
* use consolidated=False in conversion
* update tests
* lint
* add both multiscales types to output
* update comments in tests
* add Sentinel-2 optimization functions and update documentation
* update documentation for Sentinel-2 optimized conversion, detailing V1 approach and differences from V0
* update Sentinel-2 band analysis examples to include V1 approach and deprecate V0 structure
* update quickstart guide to reflect V1 converter structure and usage for Sentinel-2 data
* update documentation for multiscale dataset creation and resolution levels in GeoZarr converter
---------
Co-authored-by: Davis Vann Bennett <davis.v.bennett@gmail.com>
Co-authored-by: Loïc Houpert <10154151+lhoupert@users.noreply.github.com>
The library uses xarray's built-in `.coarsen()` method for efficient downsampling operations, providing better integration with lazy evaluation and memory management.
116
+
117
+
**Sentinel-2 Optimization:**
118
+
119
+
The S2 optimization module uses a functional programming approach with stateless functions for improved testability and maintainability:
The library uses an efficient testing approach with**lightweight JSON-based Zarr groups** that contain only the structure and metadata (no chunked array data). This provides:
435
+
436
+
-**Faster Test Execution**: Tests run locally without downloading large datasets
437
+
-**No Remote Dependencies**: Eliminates need for network access during testing
438
+
-**Lightweight Fixtures**: JSON files define Zarr group structure using `pydantic-zarr`
439
+
440
+
Test fixtures are created fromJSON schemas stored in`tests/test_data_api/{s1_examples,s2_examples}/` directories, making the test suite both comprehensive and efficient.
Copy file name to clipboardExpand all lines: docs/converter.md
+105Lines changed: 105 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -101,6 +101,111 @@ The converter supports multiscale datasets, creating overview levels with /2 dow
101
101
102
102
The converter maintains the native coordinate reference system (CRS) of the dataset, avoiding reprojection to Web Mercator.
103
103
104
+
## Sentinel-2 Optimized Conversion (V1)
105
+
106
+
The Sentinel-2 optimized converter (`convert_s2_optimized`) represents the refined approach (V1) that creates an efficient multiscale pyramid by **reusing the original multi-resolution data** (r10m, r20m, r60m) without duplication, and adding coarser overview levels (r120m, r360m, r720m) for efficient visualization at lower resolutions.
107
+
108
+
### V0 vs V1 Converter: Key Differences
109
+
110
+
Understanding the structural differences between the old (V0) and new (V1) converter approaches:
Creates a **consolidated pyramid** by reusing native resolutions and adding coarser levels:
147
+
148
+
```
149
+
output.zarr/
150
+
└── measurements/
151
+
└── reflectance/
152
+
├── r10m/ # Native 10m data (reused as-is)
153
+
├── r20m/ # Native 20m data (reused as-is)
154
+
├── r60m/ # Native 60m data (reused as-is)
155
+
├── r120m/ # Computed from r60m (2x downsampling)
156
+
├── r360m/ # Computed from r120m (3x downsampling)
157
+
└── r720m/ # Computed from r360m (2x downsampling)
158
+
```
159
+
160
+
**Why these specific resolution levels?**
161
+
162
+
The resolution levels are chosen to balance data preservation with storage optimization:
163
+
164
+
-**Native ESA resolutions (10m, 20m, 60m)**: These are the original resolutions delivered by ESA for Sentinel-2 data and are reused as-is to preserve the source data without any loss
165
+
-**Computed overview levels (120m, 360m, 720m)**: These additional levels were specifically chosen because their downsampling factors allow the data to be chunked and sharded in complete pieces, ensuring:
166
+
-**120m** (2x from 60m): Standard doubling for the first computed overview
167
+
-**360m** (3x from 120m): Selected for optimal chunking alignment
168
+
-**720m** (2x from 360m): Final level for global-scale visualization
169
+
170
+
This approach maintains the integrity of ESA's original multi-resolution data while adding computationally efficient overview levels for performance at coarser scales.
171
+
172
+
**Benefits of V1:**
173
+
- No data duplication - native resolutions are reused directly
174
+
- More efficient storage
175
+
- Simpler, flatter hierarchy
176
+
- Natural fit for Sentinel-2's multi-resolution data model
177
+
178
+
### Key Capabilities
179
+
180
+
-**Smart Resolution Consolidation**: Combines Sentinel-2's native multi-resolution structure (10m, 20m, 60m) into a unified multiscale pyramid
181
+
-**Non-Duplicative Downsampling**: Reuses original resolution data instead of recreating it, adding only the coarser levels (120m, 360m, 720m)
182
+
-**Variable-Aware Processing**: Applies appropriate resampling methods for different data types (reflectance, classification, quality masks, probabilities)
183
+
-**Efficient Testing**: Improved test infrastructure for faster local development
184
+
185
+
> **Note:** The V0 converter (`create_geozarr_dataset`) is deprecated and will be removed in future versions. All new projects should use the V1 converter (`convert_s2_optimized`).
186
+
187
+
### Usage Example
188
+
189
+
```python
190
+
from eopf_geozarr.s2_optimization.s2_converter import convert_s2_optimized
The result is a space-efficient multiscale pyramid: `/measurements/reflectance/{r10m, r20m, r60m, r120m, r360m, r720m}` where the native resolutions are preserved as-is and only the coarser levels are computed.
208
+
104
209
## Error Handling
105
210
106
211
The converter includes robust error handling and retry logic for network operations, ensuring reliable processing even in challenging environments.
Copy file name to clipboardExpand all lines: docs/examples.md
+55-17Lines changed: 55 additions & 17 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -76,43 +76,81 @@ for group_name in dt_geozarr.groups:
76
76
77
77
### Sentinel-2 Band Analysis
78
78
79
-
Access and analyze specific bands from the converted dataset:
79
+
> **Note on V0 vs V1:** This example shows both V0 (deprecated) and V1 (current) approaches. See [converter documentation](converter.md#v0-vs-v1-converter-key-differences) for structural differences.
0 commit comments