Skip to content

emerging_hotspots() repeats the local-mean z-score bug instead of computing Gi* #2804

@brendancol

Description

@brendancol

Follow-up to #2767 / #2803.

While fixing hotspots() to compute the real Getis-Ord Gi* statistic, I found that emerging_hotspots() carries its own copy of the same wrong formula. In xrspatial/emerging_hotspots.py it convolves each time step with a normalized kernel and z-scores the local mean against the global mean/std (see _emerging_hotspots_numpy around line 414, _emerging_hotspots_cupy around line 447, and _convolve_and_zscore_chunk around line 474). It reuses _calc_hotspots_numpy for the banding but never computes the Gi* weight sum, squared weight sum, sample count n, or the variance adjustment term.

The fix mirrors #2803: compute the per-cell Gi* z-score from the kernel weight sum, squared weight sum, valid-cell count, global mean, and population std, on all four backends. The Gi* helpers added in #2803 (_gistar_zscore, _gistar_global_stats) can be reused. The space-time hot/cold trend classification (Mann-Kendall step) stays as is; only the per-step z-score is wrong.

Kept separate from #2803 to keep one fix per PR.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    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