You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add dft_rast_consensus() for temporal mode smoothing #8
Single-year land cover comparisons (e.g. 2017 vs 2023) pick up noise from:
Misclassification in individual years (cloud shadow, spectral confusion)
Slight geometric shifts between satellite passes (edge pixels flip classes)
Seasonal timing differences (bare field vs crop depending on overpass date)
This inflates apparent change, especially at class boundaries.
Proposed Solution
Add dft_rast_consensus() — compute per-pixel mode (most frequent class) across multiple years to create a temporal consensus raster.
# Early period consensus: mode of 2017, 2018, 2019early<- dft_rast_consensus(classified[c("2017", "2018", "2019")])
# Late period consensus: mode of 2021, 2022, 2023late<- dft_rast_consensus(classified[c("2021", "2022", "2023")])
# Compare consensus periods — much less noisetrans<- dft_rast_transition(list(early=early, late=late),
from="early", to="late")
Scope
Input: named list of classified SpatRasters (same extent/resolution) — works with any categorical raster, not LULC-specific
Output: single SpatRaster with per-pixel mode, retaining factor levels
Optional: confidence layer (proportion of years agreeing on the mode, e.g. 3/3 = 1.0, 2/3 = 0.67)
Mean/median don't apply to categorical data — mode is the correct measure
Activity
Add dft_rast_consensus() for temporal mode smoothing