Add loading documentation
Browse files
README.md
CHANGED
|
@@ -18,6 +18,73 @@ Each benchmark sample asks: given five past calving front observations (spanning
|
|
| 18 |
|
| 19 |
---
|
| 20 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
## Dataset at a glance
|
| 22 |
|
| 23 |
| Property | Value |
|
|
@@ -30,7 +97,8 @@ Each benchmark sample asks: given five past calving front observations (spanning
|
|
| 30 |
| CRS | EPSG:3995 (Arctic Polar Stereographic) |
|
| 31 |
| Prediction horizon | 365 days |
|
| 32 |
| Input sequence length | 5 snapshots |
|
| 33 |
-
|
|
|
|
|
| 34 |
| License | CC BY 4.0 |
|
| 35 |
|
| 36 |
---
|
|
@@ -39,8 +107,10 @@ Each benchmark sample asks: given five past calving front observations (spanning
|
|
| 39 |
|
| 40 |
```
|
| 41 |
calvdb/
|
| 42 |
-
├── zarr_zipped/ #
|
| 43 |
-
│ └── RGI60-07.XXXXX.zarr.zip
|
|
|
|
|
|
|
| 44 |
├── splits/
|
| 45 |
│ ├── train.json # 866 benchmark samples
|
| 46 |
│ ├── val.json # 109 benchmark samples
|
|
@@ -51,13 +121,95 @@ calvdb/
|
|
| 51 |
└── README.md
|
| 52 |
```
|
| 53 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 54 |
---
|
| 55 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 56 |
## Normalisation
|
| 57 |
|
| 58 |
-
`splits/normalisation_stats.json` contains per-channel mean and standard
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 59 |
|
|
|
|
| 60 |
|
| 61 |
## License
|
| 62 |
|
| 63 |
-
|
|
|
|
| 18 |
|
| 19 |
---
|
| 20 |
|
| 21 |
+
## Quick start
|
| 22 |
+
|
| 23 |
+
Requires **zarr >= 3.0** and **Python >= 3.11** — see [Requirements](#requirements). Read the archives **directly; do not unzip them.**
|
| 24 |
+
|
| 25 |
+
```bash
|
| 26 |
+
pip install "zarr>=3.0" huggingface_hub
|
| 27 |
+
```
|
| 28 |
+
|
| 29 |
+
```python
|
| 30 |
+
import zarr
|
| 31 |
+
from huggingface_hub import hf_hub_download
|
| 32 |
+
|
| 33 |
+
path = hf_hub_download(
|
| 34 |
+
repo_id="enscg/calvdb",
|
| 35 |
+
filename="zarr_zipped/RGI60-07.00552.zarr.zip", # one glacier, 30 MB
|
| 36 |
+
repo_type="dataset",
|
| 37 |
+
)
|
| 38 |
+
|
| 39 |
+
group = zarr.open_group(zarr.storage.ZipStore(path, mode="r"), mode="r")
|
| 40 |
+
|
| 41 |
+
print(dict(group.attrs)) # glacier_id, T, H, W, CRS, channel names
|
| 42 |
+
print(group["sdt"].shape) # (T, H, W) signed distance transform, metres
|
| 43 |
+
print(group["dates"][:5]) # observation dates, YYYY-MM-DD
|
| 44 |
+
```
|
| 45 |
+
|
| 46 |
+
Or with **xarray**, for named dimensions and lazy loading:
|
| 47 |
+
|
| 48 |
+
```python
|
| 49 |
+
import xarray as xr
|
| 50 |
+
|
| 51 |
+
ds = xr.open_zarr(zarr.storage.ZipStore(path, mode="r"))
|
| 52 |
+
print(ds.sdt.dims) # ('time', 'y', 'x')
|
| 53 |
+
```
|
| 54 |
+
|
| 55 |
+
A complete runnable example — download, inspect, plot, and load a benchmark
|
| 56 |
+
sample — is in **[`example_loading.ipynb`](example_loading.ipynb)**.
|
| 57 |
+
|
| 58 |
+
---
|
| 59 |
+
|
| 60 |
+
## Requirements
|
| 61 |
+
|
| 62 |
+
| Component | Requirement | Why |
|
| 63 |
+
|---|---|---|
|
| 64 |
+
| `zarr` | **>= 3.0** (tested 3.1.5) | stores are Zarr **format 3**; zarr 2.x cannot read them |
|
| 65 |
+
| Python | **>= 3.11** | hard floor of zarr-python 3.x |
|
| 66 |
+
| `numcodecs` | >= 0.14 | installed with zarr 3; provides the **zstd** codec |
|
| 67 |
+
| `numpy` | >= 1.26 | zarr 3 floor |
|
| 68 |
+
| `xarray` | >= 2024.10 | optional, for the xarray route |
|
| 69 |
+
| `huggingface_hub` | any recent | download only |
|
| 70 |
+
|
| 71 |
+
### Troubleshooting
|
| 72 |
+
|
| 73 |
+
**`GroupNotFoundError: group not found at path ''`** — you are on zarr 2.x. A v2
|
| 74 |
+
reader looks for `.zgroup` / `.zarray`, which Zarr v3 stores do not contain.
|
| 75 |
+
Check with `import zarr; print(zarr.__version__)`; it must be 3.x. Do not upgrade
|
| 76 |
+
zarr inside an existing 2.x environment unless you are ready for a breaking API
|
| 77 |
+
change — create a fresh environment instead.
|
| 78 |
+
|
| 79 |
+
**`TypeError: cannot cast dtype StringDType()`** — under numpy >= 2 the `dates`
|
| 80 |
+
array (vlen-utf8) arrives as `StringDType`. Use `dates.tolist()`, not
|
| 81 |
+
`dates.astype(str)`.
|
| 82 |
+
|
| 83 |
+
**Opening the `.zip` with `zipfile`, or unzipping it first** — unnecessary.
|
| 84 |
+
`zarr.storage.ZipStore` reads chunks directly from the archive.
|
| 85 |
+
|
| 86 |
+
---
|
| 87 |
+
|
| 88 |
## Dataset at a glance
|
| 89 |
|
| 90 |
| Property | Value |
|
|
|
|
| 97 |
| CRS | EPSG:3995 (Arctic Polar Stereographic) |
|
| 98 |
| Prediction horizon | 365 days |
|
| 99 |
| Input sequence length | 5 snapshots |
|
| 100 |
+
| Download size | 5.4 GB (all glaciers); 0.4–300 MB per glacier |
|
| 101 |
+
| Version | 1.1.0 |
|
| 102 |
| License | CC BY 4.0 |
|
| 103 |
|
| 104 |
---
|
|
|
|
| 107 |
|
| 108 |
```
|
| 109 |
calvdb/
|
| 110 |
+
├── zarr_zipped/ # one Zarr v3 store per glacier, zipped
|
| 111 |
+
│ └── RGI60-07.XXXXX.zarr.zip # read directly with zarr.storage.ZipStore
|
| 112 |
+
├── zarr_sample/ # one store, unzipped, for browsing only
|
| 113 |
+
│ └── RGI60-07.00025.zarr/ # click through it in the file browser above
|
| 114 |
├── splits/
|
| 115 |
│ ├── train.json # 866 benchmark samples
|
| 116 |
│ ├── val.json # 109 benchmark samples
|
|
|
|
| 121 |
└── README.md
|
| 122 |
```
|
| 123 |
|
| 124 |
+
### Browsing the layout without downloading
|
| 125 |
+
|
| 126 |
+
`zarr_sample/RGI60-07.00025.zarr/` is one glacier (Braasvellbreen, 55 timesteps)
|
| 127 |
+
left **unzipped** so you can explore the store in the file browser above and read
|
| 128 |
+
the `zarr.json` metadata documents in place — for example
|
| 129 |
+
`zarr_sample/RGI60-07.00025.zarr/sdt/zarr.json` shows the shape, dtype, chunking
|
| 130 |
+
and dimension names of the SDT array.
|
| 131 |
+
|
| 132 |
+
Its arrays are identical to `zarr_zipped/RGI60-07.00025.zarr.zip`; it is provided
|
| 133 |
+
for inspection only. **For actual use, download from `zarr_zipped/`** — one file
|
| 134 |
+
of 275 MB rather than 617 loose files, and readable without unzipping.
|
| 135 |
+
|
| 136 |
+
---
|
| 137 |
+
|
| 138 |
+
## Store contents
|
| 139 |
+
|
| 140 |
+
Each archive holds one glacier with `T` observations on an `H × W` grid at 30 m.
|
| 141 |
+
|
| 142 |
+
| Array | Shape | Dtype | Description |
|
| 143 |
+
|---|---|---|---|
|
| 144 |
+
| `sdt` | `(T, H, W)` | float32 | Signed distance transform to the front, metres, clipped ±2000; the front is the zero level set |
|
| 145 |
+
| `trace` | `(T, H, W)` | bool | Rasterised front line. Evaluation ground truth only — never a model input |
|
| 146 |
+
| `imagery` | `(T, 5, H, W)` | float32 | Optical bands: `blue, green, red, nir, swir1` |
|
| 147 |
+
| `geophys` | `(T, 6, H, W)` | float32 | `bed_elevation, surface_elevation, thickness, velocity, strain_rate, ice_fjord_mask` |
|
| 148 |
+
| `climate` | `(T, 2)` | float32 | `mar_runoff, ocean_temp` |
|
| 149 |
+
| `dates` | `(T,)` | string | Acquisition date, `YYYY-MM-DD` |
|
| 150 |
+
| `sensors` | `(T,)` | uint8 | `0=S2, 1=LE07, 2=LC08, 3=LC09, 255=unknown` |
|
| 151 |
+
| `valid_sdt`, `valid_img`, `valid_clm`, `valid_trace` | `(T,)` | bool | Per-timestep reliability flags — **check these before using a timestep** |
|
| 152 |
+
|
| 153 |
+
Root attributes carry `glacier_id`, `T`, `H`, `W`, `resolution_m`, `crs`,
|
| 154 |
+
`sdt_clip_m`, and the channel-name lists.
|
| 155 |
+
|
| 156 |
---
|
| 157 |
|
| 158 |
+
## Benchmark splits
|
| 159 |
+
|
| 160 |
+
Each entry in `splits/{train,val,test}.json` is one forecasting sample:
|
| 161 |
+
|
| 162 |
+
```json
|
| 163 |
+
{
|
| 164 |
+
"glacier_id": "RGI60-07.00030_D",
|
| 165 |
+
"reference_date": "2017-05-20",
|
| 166 |
+
"horizon_days": 365,
|
| 167 |
+
"input_zarr_indices": [0, 5, 7, 14, 22],
|
| 168 |
+
"target_zarr_index": 53,
|
| 169 |
+
"anchor_offsets": [-1460, -1095, -730, -365, -30]
|
| 170 |
+
}
|
| 171 |
+
```
|
| 172 |
+
|
| 173 |
+
Index into the arrays with `input_zarr_indices` (the five inputs) and
|
| 174 |
+
`target_zarr_index` (the front 365 days after the last input):
|
| 175 |
+
|
| 176 |
+
```python
|
| 177 |
+
group = zarr.open_group(zarr.storage.ZipStore(path, mode="r"), mode="r")
|
| 178 |
+
inputs = group["sdt"][sample["input_zarr_indices"]] # (5, H, W)
|
| 179 |
+
target = group["sdt"][sample["target_zarr_index"]] # (H, W)
|
| 180 |
+
```
|
| 181 |
+
|
| 182 |
+
> **Note:** entries also contain a `zarr_path` field (e.g. `../zarr/RGI60-07.00030_D.zarr`).
|
| 183 |
+
> That is a path from the build machine and will not exist on your system —
|
| 184 |
+
> use `glacier_id` to locate `zarr_zipped/<glacier_id>.zarr.zip` instead.
|
| 185 |
+
|
| 186 |
+
### Suggested task
|
| 187 |
+
|
| 188 |
+
Predict **displacement** rather than absolute position: `sdt(target) − sdt(last input)`.
|
| 189 |
+
The natural baseline is persistence — predict zero displacement, i.e. the front
|
| 190 |
+
does not move — which any useful model must beat.
|
| 191 |
+
|
| 192 |
## Normalisation
|
| 193 |
|
| 194 |
+
`splits/normalisation_stats.json` contains per-channel mean and standard
|
| 195 |
+
deviation computed **from the training split only**. Apply z-score normalisation
|
| 196 |
+
before training.
|
| 197 |
+
|
| 198 |
+
---
|
| 199 |
+
|
| 200 |
+
## Changelog
|
| 201 |
+
|
| 202 |
+
**1.1.0** — Fixed archive packaging. Stores were previously nested under a
|
| 203 |
+
`zarr/<GLACIER>.zarr/` prefix inside each zip, which made `zarr.open_group()`
|
| 204 |
+
and `xarray.open_zarr()` fail with `GroupNotFoundError`. Stores are now at the
|
| 205 |
+
archive root. Added `dimension_names` to all arrays (xarray previously could not
|
| 206 |
+
open the stores at all) and consolidated metadata for faster opens. Added
|
| 207 |
+
loading documentation and a runnable example notebook. Regenerated the unzipped
|
| 208 |
+
`zarr_sample/` with the same corrected metadata, so it matches the archives.
|
| 209 |
+
**Array data is unchanged** — only packaging and metadata.
|
| 210 |
|
| 211 |
+
**1.0.0** — Initial release.
|
| 212 |
|
| 213 |
## License
|
| 214 |
|
| 215 |
+
Released under [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/).
|