Skip to content

Conversation

wietzesuijker
Copy link
Contributor

@wietzesuijker wietzesuijker commented Oct 3, 2025

xarray.DataTree requires aligned coordinates between parent/child groups. When parent (level 0) uses int64 coords and children (level 1+) use float64 (np.linspace default), xarray throws "not aligned" errors, preventing TiTiler from reading multiscale groups.

Solution

Preserve parent coordinate dtype when creating overview coordinates:

parent_x_dtype = ds.coords["x"].dtype if "x" in ds.coords else np.float64
parent_y_dtype = ds.coords["y"].dtype if "y" in ds.coords else np.float64
x_coords = np.linspace(..., dtype=parent_x_dtype))
y_coords = np.linspace(..., dtype=parent_y_dtype))

Impact

  • Fixes "group /measurements/reflectance/r10m/1 is not aligned" error
  • Enables tile rendering at all zoom levels
  • Critical for STAC browser functionality
  • 7 lines, zero dependencies, backwards compatible

TiTiler requires coordinate dtypes to match between parent and child
groups. Previously np.linspace() always returned float64, causing
alignment errors when parent coordinates were int64.

Now reads parent dtype and casts overview coordinates accordingly.

Fixes: group /measurements/reflectance/r10m/1 is not aligned error
@wietzesuijker wietzesuijker force-pushed the fix/overview-coordinate-dtype branch from abc7906 to f1e6303 Compare October 3, 2025 15:01
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.

2 participants