Skip to content

_tiled_raster crashes on 1-ULP step mismatch when concatenating tile lookups #1077

Description

@rafaqz

Symptom

Loading SRTM via Raster(SRTM; extent=…) over a buffered extent that triggers the multi-tile concat path fails with:

TypeError: in AbstractBasicDimArray, in D, expected D<:Tuple{Vararg{Dimension}},
got Type{Tuple{Vector{Any}, Y{Projected{Float64, …}}}}

preceded by:

Warning: `cat` cannot concatenate `Dimension`s, falling back to `parent` type:
step sizes 0.0008333333333333334 and 0.0008333333333333335 do not match on dimension X.

Both values are valid Float64 representations of 1/1200 — they differ by 1 ULP.

Cause

  1. DimensionalData's cat over Dimension lookups requires step sizes to be exactly equal; it rejects the 1-ULP difference and falls back to plain-array cat.
  2. _tiled_raster (ext/RastersRasterDataSourcesExt/constructors.jl:100) continues past that warning and reconstructs the Raster with a Vector{Any} where the X dim should be, which Raster then rejects with the TypeError above.

Reproduce

using Rasters, RasterDataSources
import ArchGDAL
using Rasters.Extents: Extent

# Buffer 0.5° around X=(6,9), Y=(46,49) — triggers the tile concat path
Raster(SRTM; extent = Extent(X=(5.5, 9.5), Y=(45.5, 49.5)),
              lazy = true, missingval = Int16(0))

Buffers of 0.05° / 0.3° on the same area don't trigger the concat path and succeed.

Suggested fix

  • Tolerate ULP-level step rounding when concatenating Dimension lookups (compare within a small tolerance, or canonicalise via rational like 1//1200).
  • Or: have _tiled_raster detect the failed-cat fallback (the Vector{Any} placeholder) and error early with a clearer message instead of letting Raster throw the cryptic TypeError.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions