topocast
Moving-Window Regression Downscaling of Raster Data
New R package downscaling coarse climate rasters onto fine terrain, now five times cheaper per call.
◆Recent moves
- 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 ↗ - 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 ↗ - 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 ↗