Skip to content

Conversation

@alxthm
Copy link

@alxthm alxthm commented Dec 14, 2025

These changes rely on xpublish-community/xpublish#313, which introduces the concept of DataTrees in xpublish.
With these changes, TilesPlugin can now serve tiles from a multiscale DataTree.

It is a proof of concept intended to support discussion for #172.

Among other limitations, this change does not support the entire multiscales specification yet
(https://github.com/zarr-conventions/multiscales). It assumes a simple DataTree layout, with each child corresponding to a tile matrix zoom level.

Example:

<xarray.DataTree 'pyramid'>
Group: /
├── Group: /0
│       Dimensions:  (lat: 8, lon: 16)
│       Coordinates:
│         * lat      (lat) float64 64B -85.0 -60.71 -36.43 -12.14 12.14 36.43 60.71 85.0
│         * lon      (lon) float64 128B -180.0 -157.5 -135.0 ... 112.5 135.0 157.5
│       Data variables:
│           foo      (lat, lon) float32 512B 0.0 0.0 0.0 0.0 0.0 ... 0.0 0.0 0.0 0.0 0.0
│       Attributes:
│           title:    Precomputed level 0
├── Group: /1
│       Dimensions:  (lat: 16, lon: 32)
│       Coordinates:
│         * lat      (lat) float64 128B -85.0 -73.67 -62.33 -51.0 ... 62.33 73.67 85.0
│         * lon      (lon) float64 256B -180.0 -168.8 -157.5 ... 146.2 157.5 168.8
│       Data variables:
│           foo      (lat, lon) float32 2kB 1.0 1.0 1.0 1.0 1.0 ... 1.0 1.0 1.0 1.0 1.0
│       Attributes:
│           title:    Precomputed level 1
└── Group: /2
        Dimensions:  (lat: 32, lon: 64)
        Coordinates:
          * lat      (lat) float64 256B -85.0 -79.52 -74.03 -68.55 ... 74.03 79.52 85.0
          * lon      (lon) float64 512B -180.0 -174.4 -168.8 ... 163.1 168.8 174.4
        Data variables:
            foo      (lat, lon) float32 8kB 2.0 2.0 2.0 2.0 2.0 ... 2.0 2.0 2.0 2.0 2.0
        Attributes:
            title:    Precomputed level 2

By relying on the new xpublish DataTree dependencies,
the TilesPlugin can now serve tiles from a multiscale
DataTree.

This change does not support the entire multiscales
specification yet
(https://github.com/zarr-conventions/multiscales).

It assumes a simple DataTree layout, with each child
corresponding to a tile matrix zoom level.

```
<xarray.DataTree 'pyramid'>
Group: /
├── Group: /0
│       Dimensions:  (lat: 8, lon: 16)
│       Coordinates:
│         * lat      (lat) float64 64B -85.0 -60.71 -36.43 -12.14 12.14 36.43 60.71 85.0
│         * lon      (lon) float64 128B -180.0 -157.5 -135.0 ... 112.5 135.0 157.5
│       Data variables:
│           foo      (lat, lon) float32 512B 0.0 0.0 0.0 0.0 0.0 ... 0.0 0.0 0.0 0.0 0.0
│       Attributes:
│           title:    Precomputed level 0
├── Group: /1
│       Dimensions:  (lat: 16, lon: 32)
│       Coordinates:
│         * lat      (lat) float64 128B -85.0 -73.67 -62.33 -51.0 ... 62.33 73.67 85.0
│         * lon      (lon) float64 256B -180.0 -168.8 -157.5 ... 146.2 157.5 168.8
│       Data variables:
│           foo      (lat, lon) float32 2kB 1.0 1.0 1.0 1.0 1.0 ... 1.0 1.0 1.0 1.0 1.0
│       Attributes:
│           title:    Precomputed level 1
└── Group: /2
        Dimensions:  (lat: 32, lon: 64)
        Coordinates:
          * lat      (lat) float64 256B -85.0 -79.52 -74.03 -68.55 ... 74.03 79.52 85.0
          * lon      (lon) float64 512B -180.0 -174.4 -168.8 ... 163.1 168.8 174.4
        Data variables:
            foo      (lat, lon) float32 8kB 2.0 2.0 2.0 2.0 2.0 ... 2.0 2.0 2.0 2.0 2.0
        Attributes:
            title:    Precomputed level 2
```
@alxthm alxthm changed the title Add support for multiscale DataTrees [PoC] Add support for multiscale DataTrees Dec 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant