Skip to content

Bounded GREAT_CIRCLE proximity/allocation/direction raises ValueError on dask rasters #2721

@brendancol

Description

@brendancol

The dask backends (dask+numpy and dask+cupy) compute the map_overlap pad depth as max_distance / cellsize. The cellsize is the coordinate spacing in degrees, but with distance_metric='GREAT_CIRCLE' the max_distance argument is in metres. Dividing a metre distance (millions) by a degree cellsize (a few) gives an overlap depth of hundreds of thousands of pixels, and dask raises ValueError: The overlapping depth N is larger than your array.

The numpy and cupy backends accept the same call and return correct results, so this is a backend-parity defect: a call that works on numpy/cupy crashes on either dask backend.

To reproduce, build a small lat/lon dask raster and call proximity(raster, distance_metric='GREAT_CIRCLE', max_distance=1.5e6). It raises; the numpy-backed copy of the same raster returns a result.

The fix measures the per-pixel pitch with the active distance metric (great-circle metres between adjacent cells) instead of the raw degree cellsize, so the overlap depth is in pixels regardless of metric. EUCLIDEAN and MANHATTAN are unaffected because their max_distance shares units with the cellsize.

Found via accuracy sweep (categories 4 and 5).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions