Rasterio comes with a Command Line raster calculator called rio calc
. Because nothing says look how smart I am as doing stuff in Command Line, it was the tool-of-choice when asked to subtract two geospatial rasters. The docs aren’t too generous with examples, but I got it working as:
rio calc "(- (read 1) (read 2))" input1 input2 output