66docs/analysis/eopf-geozarr/EOPF_Sentinel2_ZarrV3_geozarr_compliant.ipynb
77"""
88
9- import os
109import shutil
1110import tempfile
1211from pathlib import Path
@@ -24,7 +23,7 @@ class TestSentinel2Integration:
2423 """Integration tests for Sentinel-2 EOPF to GeoZarr conversion."""
2524
2625 @pytest .fixture
27- def sample_sentinel2_datatree (self ):
26+ def sample_sentinel2_datatree (self ) -> xr . DataTree :
2827 """
2928 Create a sample Sentinel-2 EOPF DataTree structure for testing.
3029
@@ -217,15 +216,15 @@ def sample_sentinel2_datatree(self):
217216 return dt
218217
219218 @pytest .fixture
220- def temp_output_dir (self ):
219+ def temp_output_dir (self ) -> str :
221220 """Create a temporary directory for test outputs."""
222221 temp_dir = tempfile .mkdtemp ()
223222 yield temp_dir
224223 shutil .rmtree (temp_dir )
225224
226225 def test_complete_sentinel2_conversion_notebook_workflow (
227226 self , sample_sentinel2_datatree , temp_output_dir
228- ):
227+ ) -> None :
229228 """
230229 Test complete conversion following the notebook workflow.
231230
@@ -247,7 +246,7 @@ def test_complete_sentinel2_conversion_notebook_workflow(
247246 "/quality/l1c_quicklook/r10m" ,
248247 ]
249248
250- print (f "Converting Sentinel-2 EOPF DataTree to GeoZarr format..." )
249+ print ("Converting Sentinel-2 EOPF DataTree to GeoZarr format..." )
251250 print (f"Input groups: { groups } " )
252251 print (f"Output path: { output_path } " )
253252
@@ -283,7 +282,7 @@ def test_complete_sentinel2_conversion_notebook_workflow(
283282
284283 print ("✅ All integration tests passed!" )
285284
286- def _verify_basic_structure (self , output_path , groups ):
285+ def _verify_basic_structure (self , output_path , groups ) -> None :
287286 """Verify the basic Zarr store structure."""
288287 print ("Verifying basic structure..." )
289288
@@ -301,7 +300,7 @@ def _verify_basic_structure(self, output_path, groups):
301300 assert level_0_path .exists (), f"Level 0 not found for { group } "
302301 assert (level_0_path / "zarr.json" ).exists (), f"Level 0 missing zarr.json for { group } "
303302
304- def _verify_geozarr_spec_compliance (self , output_path , group ):
303+ def _verify_geozarr_spec_compliance (self , output_path , group ) -> None :
305304 """
306305 Verify GeoZarr specification compliance following the notebook verification.
307306
@@ -380,13 +379,13 @@ def _verify_geozarr_spec_compliance(self, output_path, group):
380379 if "GeoTransform" in ds ["spatial_ref" ].attrs :
381380 print (f" ✅ GeoTransform: { ds ['spatial_ref' ].attrs ['GeoTransform' ]} " )
382381 else :
383- print (f " ⚠️ Missing GeoTransform attribute" )
382+ print (" ⚠️ Missing GeoTransform attribute" )
384383
385384 # Check 6: CRS information (from notebook verification)
386385 if "crs_wkt" in ds ["spatial_ref" ].attrs :
387- print (f " ✅ CRS WKT present" )
386+ print (" ✅ CRS WKT present" )
388387 else :
389- print (f " ⚠️ Missing CRS WKT" )
388+ print (" ⚠️ Missing CRS WKT" )
390389
391390 # Check 7: Coordinate standard names (from notebook verification)
392391 for coord in ["x" , "y" ]:
@@ -402,7 +401,7 @@ def _verify_geozarr_spec_compliance(self, output_path, group):
402401
403402 ds .close ()
404403
405- def _verify_multiscale_structure (self , output_path , group ):
404+ def _verify_multiscale_structure (self , output_path , group ) -> None :
406405 """Verify multiscale structure following notebook patterns."""
407406 print (f"Verifying multiscale structure for { group } ..." )
408407
@@ -475,15 +474,15 @@ def _verify_multiscale_structure(self, output_path, group):
475474 f" Level { prev_level } →{ level } downsampling ratio: { height_ratio :.2f} x{ width_ratio :.2f} "
476475 )
477476
478- def _verify_rgb_data_access (self , output_path , groups ):
477+ def _verify_rgb_data_access (self , output_path , groups ) -> None :
479478 """Verify RGB data access patterns from the notebook."""
480479 print ("Verifying RGB data access patterns..." )
481480
482481 # Find groups with RGB bands (following notebook logic)
483482 rgb_groups = []
484483 for group in groups :
485- group_path = str (output_path / group .lstrip ("/" ) / "0" )
486- ds = xr .open_dataset (group_path , engine = "zarr" , zarr_format = 3 )
484+ group_path_str = str (output_path / group .lstrip ("/" ) / "0" )
485+ ds = xr .open_dataset (group_path_str , engine = "zarr" , zarr_format = 3 )
487486
488487 # Check for RGB bands (b04=red, b03=green, b02=blue for Sentinel-2)
489488 has_rgb = all (band in ds .data_vars for band in ["b04" , "b03" , "b02" ])
@@ -530,7 +529,7 @@ def _verify_rgb_data_access(self, output_path, groups):
530529 ds .close ()
531530
532531 @pytest .mark .slow
533- def test_performance_characteristics (self , sample_sentinel2_datatree , temp_output_dir ):
532+ def test_performance_characteristics (self , sample_sentinel2_datatree , temp_output_dir ) -> None :
534533 """
535534 Test performance characteristics following notebook analysis.
536535
@@ -546,7 +545,7 @@ def test_performance_characteristics(self, sample_sentinel2_datatree, temp_outpu
546545 groups = ["/measurements/reflectance/r10m" ] # Focus on one group for performance testing
547546
548547 with patch ("eopf_geozarr.conversion.geozarr.print" ):
549- dt_geozarr = create_geozarr_dataset (
548+ create_geozarr_dataset (
550549 dt_input = dt_input ,
551550 groups = groups ,
552551 output_path = str (output_path ),
0 commit comments