Skip to content

Commit a6fa81e

Browse files
committed
fix: restore conversion override parameters and correct S2 CRS groups
Restore override parameters (--groups, --spatial-chunk, --tile-width, --enable-sharding) to workflow template that were removed during script consolidation. Fix critical bug where S2 quicklook conversion used wrong CRS groups (/conditions/geometry instead of /quality/l2a_quicklook/r10m), causing TiTiler preview tiles to fail with 'not enough values to unpack' error. Changes: - Add override parameter args to convert-geozarr step in workflow template - Fix S2 crs_groups config to match converted zarr group - Handle empty string override values (convert to None) - Support string values for --enable-sharding flag Fixes preview tile generation for Sentinel-2 quicklook conversions.
1 parent 4bdd64c commit a6fa81e

File tree

2 files changed

+23
-5
lines changed

2 files changed

+23
-5
lines changed

scripts/convert.py

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
"/measurements/reflectance/r60m",
4343
"/quality/l2a_quicklook/r10m",
4444
],
45-
"crs_groups": ["/conditions/geometry"],
45+
"crs_groups": ["/quality/l2a_quicklook/r10m"],
4646
"spatial_chunk": 1024,
4747
"tile_width": 256,
4848
"enable_sharding": True,
@@ -157,6 +157,11 @@ def run_conversion(
157157
return output_url
158158

159159

160+
def optional_int(value: str) -> int | None:
161+
"""Convert string to int, return None for empty strings."""
162+
return int(value) if value else None
163+
164+
160165
def main() -> None:
161166
"""CLI entry point for GeoZarr conversion."""
162167
parser = argparse.ArgumentParser(description="Convert EOPF Zarr to GeoZarr format")
@@ -165,11 +170,16 @@ def main() -> None:
165170
parser.add_argument("--s3-output-bucket", required=True, help="S3 bucket")
166171
parser.add_argument("--s3-output-prefix", required=True, help="S3 prefix")
167172
parser.add_argument("--groups", help="Override groups (comma-separated)")
168-
parser.add_argument("--spatial-chunk", type=int, help="Override spatial chunk size")
169-
parser.add_argument("--tile-width", type=int, help="Override tile width")
170-
parser.add_argument("--enable-sharding", action="store_true", help="Enable sharding")
173+
parser.add_argument("--spatial-chunk", type=optional_int, help="Override spatial chunk size")
174+
parser.add_argument("--tile-width", type=optional_int, help="Override tile width")
175+
parser.add_argument("--enable-sharding", help="Override sharding flag (true/false)")
171176
args = parser.parse_args()
172177

178+
# Convert enable_sharding string to bool (or None)
179+
enable_sharding = None
180+
if args.enable_sharding:
181+
enable_sharding = args.enable_sharding.lower() in ("true", "1", "yes")
182+
173183
run_conversion(
174184
source_url=args.source_url,
175185
collection=args.collection,
@@ -178,7 +188,7 @@ def main() -> None:
178188
groups=args.groups,
179189
spatial_chunk=args.spatial_chunk,
180190
tile_width=args.tile_width,
181-
enable_sharding=args.enable_sharding,
191+
enable_sharding=enable_sharding,
182192
)
183193

184194

workflows/base/workflowtemplate.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,14 @@ spec:
6767
- "{{workflow.parameters.s3_output_bucket}}"
6868
- --s3-output-prefix
6969
- "{{workflow.parameters.s3_output_prefix}}"
70+
- --groups
71+
- "{{workflow.parameters.override_groups}}"
72+
- --spatial-chunk
73+
- "{{workflow.parameters.override_spatial_chunk}}"
74+
- --tile-width
75+
- "{{workflow.parameters.override_tile_width}}"
76+
- --enable-sharding
77+
- "{{workflow.parameters.override_enable_sharding}}"
7078
resources:
7179
requests:
7280
memory: 4Gi

0 commit comments

Comments
 (0)