Spaces:
Sleeping
Sleeping
Add fallback for non-consolidated zarr stores
Browse files- Try consolidated=True first
- Fall back to consolidated=False if no .zmetadata
- Should now work with dynamical.org stores
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
app.py
CHANGED
|
@@ -62,9 +62,15 @@ def load_dataset(dataset_name, use_cache=True):
|
|
| 62 |
logger.info(f"Opening zarr store at: {url}")
|
| 63 |
|
| 64 |
# Open zarr store (using zarr v2)
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 68 |
logger.info(f"Dataset dimensions: {dict(ds.dims)}")
|
| 69 |
logger.info(f"Dataset variables: {list(ds.data_vars)}")
|
| 70 |
logger.info(f"Dataset coordinates: {list(ds.coords)}")
|
|
|
|
| 62 |
logger.info(f"Opening zarr store at: {url}")
|
| 63 |
|
| 64 |
# Open zarr store (using zarr v2)
|
| 65 |
+
# Try consolidated first, then fall back to non-consolidated
|
| 66 |
+
try:
|
| 67 |
+
logger.info("Trying to open with consolidated=True")
|
| 68 |
+
ds = xr.open_zarr(url, consolidated=True)
|
| 69 |
+
logger.info(f"Successfully opened with consolidated metadata")
|
| 70 |
+
except KeyError:
|
| 71 |
+
logger.info("No consolidated metadata, trying consolidated=False")
|
| 72 |
+
ds = xr.open_zarr(url, consolidated=False)
|
| 73 |
+
logger.info(f"Successfully opened without consolidated metadata")
|
| 74 |
logger.info(f"Dataset dimensions: {dict(ds.dims)}")
|
| 75 |
logger.info(f"Dataset variables: {list(ds.data_vars)}")
|
| 76 |
logger.info(f"Dataset coordinates: {list(ds.coords)}")
|