Skip to content

Commit eaef673

Browse files
Update GeoZarr conversion: adjust spatial chunk and min dimension parameters, enhance S3 path handling with storage options, and improve JSON metadata writing for S3.
1 parent a83b1c8 commit eaef673

2 files changed

Lines changed: 6 additions & 7 deletions

File tree

.vscode/launch.json

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
"https://objectstore.eodc.eu:2222/e05ab01a9d56408d82ac32d69a5aae2a:sample-data/tutorial_data/cpm_v253/S2B_MSIL1C_20250113T103309_N0511_R108_T32TLQ_20250113T122458.zarr",
1717
"./tests-output/eopf_geozarr/s2b_test.zarr",
1818
"--groups", "/measurements/reflectance/r10m", "/measurements/reflectance/r20m", "/measurements/reflectance/r60m", "/quality/l1c_quicklook/r10m",
19-
"--spatial-chunk", "512",
20-
"--min-dimension", "128",
19+
"--spatial-chunk", "4096",
20+
"--min-dimension", "256",
2121
"--tile-width", "256",
2222
"--max-retries", "2",
2323
"--verbose"
@@ -51,8 +51,7 @@
5151
"console": "integratedTerminal",
5252
"env": {
5353
"PYTHONPATH": "${workspaceFolder}/.venv/bin",
54-
"AWS_ACCESS_KEY_ID": "secret",
55-
"AWS_SECRET_ACCESS_KEY": "secret",
54+
"AWS_PROFILE": "eopf-explorer",
5655
"AWS_DEFAULT_REGION": "gra",
5756
"AWS_S3_ENDPOINT": "https://s3.gra.io.cloud.ovh.net/"
5857
},

eopf_geozarr/conversion/geozarr.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -526,7 +526,8 @@ def write_geozarr_group(
526526
if s3_utils.is_s3_path(output_path):
527527
if s3_utils.s3_path_exists(native_dataset_path):
528528
store = s3_utils.create_s3_store(native_dataset_path)
529-
existing_native_dataset = xr.open_zarr(store, zarr_format=3)
529+
storage_options = s3_utils.get_s3_storage_options(native_dataset_path)
530+
existing_native_dataset = xr.open_zarr(store, zarr_format=3, storage_options=storage_options)
530531
print(f"Found existing native dataset at {native_dataset_path}")
531532
else:
532533
if os.path.exists(native_dataset_path):
@@ -696,8 +697,7 @@ def create_geozarr_compliant_multiscales(
696697
"tile_matrix_limits": tile_matrix_limits,
697698
}
698699

699-
with fs.open(zarr_json_path, "w") as f:
700-
json.dump(zarr_json, f, indent=2)
700+
s3_utils.write_s3_json_metadata(zarr_json_path, zarr_json)
701701
else:
702702
# Local file operations
703703
with open(zarr_json_path, "r") as f:

0 commit comments

Comments
 (0)