← All projects
R package · 2026–present

terraces

Aggregation-consistent raster disaggregation

A one-dimensional comparison of standard linear interpolation and the three terraces disaggregation methods

Overview

terraces is an R package for disaggregating rasters to finer resolution in a way that stays consistent with the original coarse data. Most raster products, including climate grids like CHELSA and WorldClim, remote sensing imagery, and coarsened DEMs, report cell values that represent averages over each cell’s area. Standard bilinear and cubic disaggregation instead treat those values as point samples at cell centers, so the fine-scale result flattens peaks and troughs and no longer averages back to the input. terraces extends terra’s disaggregation tools with methods that treat cell values as areal means: re-aggregating the output recovers the original coarse raster, while the fine-scale surface remains smooth and continuous.

The package includes three of these Aggregation-Consistent Estimation methods. Two are pre-sharpened variants of bilinear and cubic interpolation, which apply a precomputed inverse kernel to the coarse raster before standard interpolation; they’re fast, non-iterative, and work as drop-in replacements for terra::disagg(). The third is an implementation of Tobler’s (1979) pycnophylactic interpolation adapted to regular grids, which preserves coarse-cell means exactly and gives the smoothest result, at the cost of more computation. The figure above illustrates the differences in one dimension.

Resources

terraces is available on GitHub and can be installed with:

pak::pak("matthewkling/terraces")