File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -46,6 +46,27 @@ ds = xdggs.tutorial.open_dataset("air_temperature", "healpix")
46
46
ds
47
47
```
48
48
49
+ ``` {code-cell} python
50
+ ---
51
+ tags: [remove-cell]
52
+ ---
53
+ from xdggs.utils import GRID_REGISTRY, _extract_cell_id_variable
54
+
55
+ def from_variables_patch(variables, *, options):
56
+ _, var, _ = _extract_cell_id_variable(variables)
57
+
58
+ grid_name = var.attrs["grid_name"]
59
+ cls = GRID_REGISTRY.get(grid_name)
60
+ if cls is None:
61
+ raise ValueError(f"unknown DGGS grid name: {grid_name}")
62
+
63
+ obj = cls.from_variables(variables, options=options)
64
+ obj._pd_index.index.name = "cell_ids"
65
+ return obj
66
+
67
+ xdggs.DGGSIndex.from_variables = from_variables_patch
68
+ ```
69
+
49
70
with that, we can decode the metadata:
50
71
51
72
``` {code-cell} python
You can’t perform that action at this time.
0 commit comments