Skip to content

Remove canvas_like and datashader references from source code #3451

Description

@brendancol

Reason or Problem

xrspatial/utils.py defines canvas_like(), which wraps datashader.Canvas.raster() to resample a raster. It is the only place in the library source that imports datashader, it is not exported from __init__.py, and a repo-wide search finds no callers. A couple of docstrings and a comment also mention datashader.

Proposal

  • Delete canvas_like() from xrspatial/utils.py, including its lazy import datashader as ds and the try/except that raises ImportError. Remove any imports the deletion leaves unused.
  • Rewrite the suggest_zonal_canvas() docstring example in xrspatial/zonal.py to use arr.xrs.rasterize(...) instead of ds.Canvas().polygons(...). The function body has no datashader dependency, so this is a docstring-only change.
  • Reword the comment at xrspatial/terrain.py:698 so it describes the pixel-center coordinate convention without naming datashader.

Value

Removes the library's only datashader import and trims stale references, a prerequisite for dropping datashader from packaging.

Done when

  • pytest xrspatial/tests/ passes.
  • No test or module imports canvas_like.

Part of removing datashader as a dependency; final packaging removal is tracked in #3450.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions