← Back to all sparks
T

topocast

ANALYTICS
Velocity2.5

Moving-Window Regression Downscaling of Raster Data

New R package downscaling coarse climate rasters onto fine terrain, now five times cheaper per call.

geospatialclimate-datadownscalingr-packageperformance
Current state
topocast is a young R package — first released in June 2026 — that downscales coarse rasters onto fine terrain using moving-window regression, with the relationship expressed as a formula over layer names. Its defining implementation choice is summed-area tables, which make the cost of estimating coefficient grids independent of the window radius. Three releases in six weeks have taken it from first publication through real-workflow fixes to a substantial performance restructuring.
Where it's heading
Development is being driven by running the package against real datasets — the second release names CHELSA and SRTM as the source of its three fixes — and the third is a direct response to multi-response calls repeating work. The arc is the ordinary one for a new method package: publish the method, then discover that real inputs have more responses, more coordinate-system edge cases, and more repeated structure than the initial design assumed. Coefficient grids being exposed as output suggests the local regression parameters, such as lapse rate, are as interesting to users as the downscaled values.
Prediction
Expect continued work on multi-response and time-series throughput, and more coordinate-system and input-validation handling as the package meets further real climate datasets.

Recent moves

  1. 26d ago

    Multi-response calls stop repeating the coarse-to-target trip

    Previously every response repeated the entire coarse-to-target journey; the package now brings all coarse grids onto the target in a single resample or extract, resolves target predictors once, and assembles coefficients as one multi-layer object instead of a separate terra object each. Fixed per-call cost drops from roughly 0.58s to 0.11s, and a 25,000-point call with 19 responses from 1.28s to 0.46s. The gain scales with response count, which is exactly the shape of a real climate workload.

    View source ↗
  2. 2mo ago

    Coefficient grids exposed and coarse predictors derived automatically

    Three fixes found running the package on CHELSA and SRTM: a predictor named in the formula but missing from the data is now aggregated from the fine grid, making the single-DEM case one call; coefficients = TRUE returns intercept and per-predictor slope grids, surfacing the local lapse rate; and coordinate systems sharing an EPSG code are treated as equal despite differing WKT, with genuine mismatches naming both. Returning the slopes is the notable one — it turns a downscaling tool into something you can also read the local physics off.

    View source ↗
  3. 2mo ago

    First release: terrain downscaling by moving-window regression

    Introduces topocast(), which downscales a coarse raster onto fine terrain via moving-window regression specified as a formula of layer names, with summed-area tables making the cost independent of window radius. Time series are handled by downscaling a baseline climatology once and carrying each period's anomaly onto it, either multiplicatively or additively. The radius-independent cost is the design decision the rest of the package is built around.

    View source ↗