raster-and-terrainlisted
Install: claude install-skill wiatrek-kevin-s/columbus
# Raster and terrain
A raster is a grid of numbers with a CRS, a cell size, an origin and a nodata value. Most
raster mistakes are silent: the output looks like a picture of the right thing but the
numbers are wrong. Check the four properties first, every time.
```bash
gdalinfo -stats dem.tif # CRS, origin, pixel size, data type, nodata, min/max
```
## General practice (with or without Columbus)
### 1. Know what the cells mean
- **Continuous**: elevation, temperature, reflectance, distance. Values can be averaged.
- **Categorical**: land cover, soil class, zoning codes. Values are labels. Averaging `41`
(deciduous forest) and `82` (crops) gives nonsense.
- Data type: `Byte` (0 to 255), `Int16`, `UInt16`, `Float32`. Compute indices and
derivatives in `Float32`, or integer division and overflow wreck them.
- Vertical units and datum for elevation: metres or feet; NAVD88 (orthometric) or
ellipsoid heights. In the US the two differ by tens of metres. Never mix them in one
mosaic or difference.
### 2. Resampling
| Data | Upsampling or same size | Downsampling (coarser cells) |
| --- | --- | --- |
| Categorical (land cover, classes, IDs) | `near` (nearest neighbour) | `mode` (majority) |
| Continuous (elevation, temperature) | `bilinear` or `cubic` | `average` |
| Counts, totals (population per cell) | avoid, or redistribute | `sum` (GDAL 3.1+) |
| Imagery for display | `cubic` or `lanczos` | `average` |
- `cubic` and `lanczos` can overshoot: negative rainf