Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: xarray-contrib/xarray-spatial
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: main
Choose a base ref
...
head repository: xarray-contrib/xarray-spatial
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: issue-3739
Choose a head ref
Checking mergeability… Don’t worry, you can still create the pull request.
  • 2 commits
  • 3 files changed
  • 1 contributor

Commits on Sep 4, 2026

  1. Drop the per-cell NaN early-out in the planar CPU slope kernel (#3739)

    _cpu started every interior cell with `if np.isnan(data[y, x]): continue`.
    On DEMs with scattered nodata that branch is data-dependent and
    mispredicts more than the few float32 ops and one arctan it skips.
    
    Remove the branch and fold the centre back in with a select after the
    arithmetic. Neighbour NaN already propagates through the Horn stencil,
    so the select only has to cover a NaN centre with valid neighbours.
    Results are bitwise identical to the old kernel on 2000x4000 float32
    DEMs with no NaN, 30% random NaN and a NaN left half, and on 3x3, 1xN
    and int16 inputs. On the 30% random NaN raster the kernel goes from
    ~92 ms to ~55 ms; the NaN-free and contiguous-NaN cases are within
    noise.
    
    Add a SlopeNaN asv benchmark with 30% random NaN over the interior so
    the nodata path is timed from now on. get_xr_dataarray(include_nan=True)
    only sets the [0, 0] corner to NaN, which the kernel never visits, so
    the benchmark adds its own speckle.
    
    Add tests pinning the NaN footprint on a speckled raster: NaN at every
    centre-NaN cell and its 8-neighbours, finite elsewhere, on numpy and
    dask+numpy.
    brendancol committed Sep 4, 2026
    Configuration menu
    Copy the full SHA
    c1b9343 View commit details
    Browse the repository at this point in the history
  2. Address review notes on the slope NaN early-out PR (#3739)

    Note in SlopeNaN that its dask timing forces the compute while
    Slope.time_slope does not, so the two classes' dask numbers are not
    comparable. Build the speckle mask from a float32 draw to halve the
    setup allocation at nx=10000. State in the footprint test comment that
    the tests pass on the old kernel too, since they pin behaviour rather
    than reproduce a regression. Drop the stale "(unchanged)" from the
    planar section banner.
    brendancol committed Sep 4, 2026
    Configuration menu
    Copy the full SHA
    b2c5a22 View commit details
    Browse the repository at this point in the history
Loading