This lesson is still being designed and assembled (Pre-Alpha version)

Raster Calculations in Python


Teaching: 30 min
Exercises: 20 min
  • How do I subtract one raster from another and extract pixel values for defined locations?

  • Perform a subtraction between two rasters using numpy.

  • Export raster data as a GeoTIFF file with rasterio.


Key Points

  • Rasters can be computed on using mathematical functions.

  • Rasters can be read as numpy arrays, a fast data structure for matrix computations

  • The method can be used to write raster data to a file.