Skip to content

aspect: add test coverage for degenerate raster shapes and geodesic boundary modes #2742

@brendancol

Description

@brendancol

The test-coverage sweep found two gaps in the aspect module (xrspatial/aspect.py). Both are test-only; the underlying code already behaves correctly, so no source changes are needed.

1. Degenerate raster shapes are untested

No test passes a 1x1, Nx1, or 1xN raster to aspect, northness, or eastness on any backend. A raster with fewer than three cells along a dimension has no interior cell, so the correct output is all-NaN with the input shape preserved. Both the planar and geodesic paths already produce that result without raising, but nothing guards against a regression.

2. Geodesic boundary modes are untested

method='geodesic' accepts boundary='nan', 'nearest', 'reflect', and 'wrap', and the geodesic backends carry their own lat/lon padding code (the _run_*_geodesic functions in xrspatial/aspect.py). Only boundary='nan' is exercised today. The planar path has thorough boundary tests; the geodesic path has none.

Proposed tests

  • test_aspect.py: degenerate-shape regression tests for planar aspect/northness/eastness across numpy, cupy, dask+numpy, dask+cupy.
  • test_geodesic_aspect.py: a numpy boundary-mode test plus numpy-vs-dask (and cupy/dask+cupy) parity for the non-default boundary modes.

Found by the deep-sweep test-coverage pass. No bug surfaced; if one had, it would be filed as a separate accuracy issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    QA/QCtestsTest coverage and parity

    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