Working with satellite imagery
Satellite imagery is a grid of numbers per patch of ground, with more colour channels than your eyes have, so working with it means working with stacked arrays, not photographs.
- 9 min read
- 3 reading levels
- Published
Read these first
On this page 6
One lesson, three depths. Pick the one that fits you today — you can switch any time.
Beginner — No maths. Plain English.
Satellite imagery is a grid of numbers for each patch of ground, with more colour channels than your eyes can see.
Think of a shopkeeper checking a banknote under a UV torch. Your eyes see plain paper. Under that light, hidden ink glows, because the torch sends out a kind of light your eyes cannot detect at all. The note did not change. The tool looking at it changed.
Satellites carry many such torches at once. Each one is a band — a sensor tuned to one range of light wavelength. Bands range from ordinary red and green to infrared light no human eye has ever seen. Every pixel of a satellite image stores one brightness value per band, not one colour.
Why it exists
A person can walk one field and judge it by eye. Nobody can walk every field in a district every week.
Satellites solve the coverage problem. One pass over a region photographs millions of fields in one sweep, and returns to the same spot every few days. A government or a farmer never has to send a person to look.
The extra bands solve a second problem: eyes are a weak sensor. Human vision covers a narrow sliver of light. Stressed crops, dry soil and burnt ground change how they reflect infrared light. That shift happens long before it is visible to a person standing in the field. A satellite with an infrared band catches it early.
How it works
Ground -> Satellite sensor -> One number per band, per pixel
patch (several "torches" Red: 45
tuned to different Green: 78
wavelengths) NIR: 172 <- near-infrared, invisible to eyesStack the bands together and one pixel becomes a short list of numbers, not a single colour. A patch — a small square cut from the full image — becomes a 3D grid: rows, columns, and bands.
Three ideas you will meet on every satellite dataset:
- Spatial resolution — how much ground one pixel covers. 10 metres means one pixel is a 10 metre by 10 metre square.
- Spectral resolution — how many bands the sensor records, and how narrow each one is.
- Revisit time — how often the satellite photographs the same spot again. A few days is typical for public satellites.
Where you have already seen it
- The cloud layer on a weather app, updated from a satellite that revisits every few minutes.
- Google Earth's "which year" slider, built from repeated satellite passes over the same ground.
- Crop insurance payouts in India that use satellite data to check whether a field was actually damaged, without an inspector visiting every farm.
- ISRO's Bhuvan portal, which gives the public free access to Indian satellite imagery.
An honest warning
Free satellite imagery is not instant or perfect. Clouds block the ground below them, so a single pass over a monsoon-season field can be useless. Most real workflows pick the least cloudy image from several passes, or wait for a clear day.
Bands also are not interchangeable across satellites. One satellite's "band 4" can be a different wavelength from another satellite's "band 4". Always check the sensor's documentation before assuming what a band number means.
Remember this
- A satellite pixel stores one number per band, and bands often include light your eyes cannot see.
- Coverage and repeat visits are the entire point — no person could do this by walking fields.
- Clouds and mismatched band numbering are the two mistakes that catch beginners first.
What to learn next
- How images are stored — the pixel-grid idea this lesson builds on.
- NDVI and vegetation indices — turning the near-infrared band into a plant-health number.
- Detecting change from space — comparing two passes over the same ground.
Developer — Code and libraries.
Setup
pip install numpyReal satellite files arrive as GeoTIFF — a TIFF image with map coordinates attached, covered in its own lesson. Here we work with a small synthetic patch so the shape of the data is clear without downloading anything.
Minimal runnable code
import numpy as np
# A tiny synthetic satellite "patch": 4 rows x 4 cols x 3 bands
# Real satellites store one number per band per pixel, not a photograph
red = np.array([[40, 45, 200, 210],
[42, 48, 205, 208],
[220, 225, 50, 55],
[218, 222, 52, 58]])
green = np.array([[70, 75, 190, 195],
[72, 78, 192, 198],
[200, 205, 65, 68],
[198, 202, 66, 70]])
nir = np.array([[180, 175, 60, 65],
[178, 172, 58, 62],
[55, 60, 190, 185],
[58, 62, 188, 182]])
patch = np.stack([red, green, nir], axis=-1) # shape: rows, cols, bands
print("patch shape (rows, cols, bands):", patch.shape)
for band_name, band_index in [("red", 0), ("green", 1), ("near-infrared", 2)]:
band = patch[:, :, band_index]
print(f"{band_name:>14}: min={band.min():>3} max={band.max():>3} mean={band.mean():.1f}")
pixel = patch[0, 2]
print("top-right pixel, all three bands:", pixel)patch shape (rows, cols, bands): (4, 4, 3)
red: min= 40 max=225 mean=131.1
green: min= 65 max=205 mean=134.0
near-infrared: min= 55 max=190 mean=120.6
top-right pixel, all three bands: [200 190 60]What actually happened
np.stack([red, green, nir], axis=-1) glues three 2D grids into one 3D grid, with the band as the last axis. This is the layout most Python geospatial tools expect: rows, then columns, then bands.
- The shape
(4, 4, 3)reads as 4 rows, 4 columns, 3 bands — the same convention as a normal RGB image, with more bands than three being common. patch[0, 2]pulls one pixel's full band list: row 0, column 2. That pixel has high red and green but low near-infrared, unlike the vegetation pixels elsewhere in the patch.- The per-band
min/max/meanloop is worth running on any new satellite file, before any modelling. A band that is entirely one flat value usually means a mistake in the download, not real ground.
Common mistakes
Assuming the array is (bands, rows, cols). Some tools, including the popular rasterio library, load bands first. Mixing the two layouts is a common bug in satellite code — always print .shape before writing more code.
Treating pixel values as 0-255. A photo's pixels usually run 0 to 255. Satellite bands often store raw sensor counts or reflectance values on a different scale, sometimes 0 to 10,000. Always check the data's documentation before assuming a range.
Forgetting no-data pixels. Some pixels in a real file are marked "no data" — usually a very large or very negative placeholder number, not a real reading. Averaging a band without removing them quietly wrecks every statistic downstream.
Try it yourself
Add a fourth 4x4 band called swir (short-wave infrared, common on real sensors) with your own numbers, stack four bands instead of three, and print the new shape. Confirm it reads (4, 4, 4).
What to learn next
- NDVI and vegetation indices — the first real calculation done on these bands.
- GeoTIFF tiling and georeferencing — how a real file attaches these numbers to a map.
- How images are stored — the general pixel-grid concept.
Researcher — Mathematics and papers.
Radiance, reflectance and digital numbers
A sensor does not measure colour. It measures radiance — light energy arriving per unit area, per unit solid angle, per wavelength, in watts per square metre per steradian per micrometre. This is converted in stages before it becomes a usable number:
DN -> radiance -> top-of-atmosphere reflectance -> surface reflectanceDN— digital number, the raw integer the sensor's analogue-to-digital converter outputs. Vendor-specific, not physically comparable across sensors.- Radiance (
L) comes fromDNvia a per-band linear gain and offset supplied by the satellite operator:L = gain * DN + offset. - Top-of-atmosphere (TOA) reflectance normalises
Lby incoming solar irradiance and sun angle, removing the sensor's own calibration and the time of day. - Surface reflectance additionally removes atmospheric scattering and absorption — haze, water vapour, aerosols — via an atmospheric correction model such as 6S or Sen2Cor. This is the quantity comparable across dates, and the one needed for reliable vegetation indices.
Spatial, spectral, radiometric and temporal resolution
Four axes describe any sensor, and they trade off against each other for a fixed sensor cost and orbit:
| Axis | What it measures | Typical public value |
|---|---|---|
| Spatial | Ground size of one pixel | 10 m (Sentinel-2), 30 m (Landsat) |
| Spectral | Number and narrowness of bands | 13 bands (Sentinel-2), 11 (Landsat 8/9) |
| Radiometric | Bit depth per pixel | 12-16 bit, giving 4,096-65,536 possible values |
| Temporal | Revisit interval over the same ground | 5 days (Sentinel-2 combined), 16 days (single Landsat) |
Finer spatial resolution generally costs revisit time or spectral range, because a narrower ground footprint means less light energy reaches the sensor per pixel, forcing a trade against signal-to-noise ratio.
File formats and coordinate reference systems
Public multispectral data is distributed as GeoTIFF (raster values plus an affine transform and a coordinate reference system, CRS) or as Cloud-Optimized GeoTIFF (COG), which supports partial reads over HTTP range requests without downloading the full file. A CRS defines how a row/column pixel index maps to a real-world coordinate, most often UTM (Universal Transverse Mercator), a projected system chosen per 6-degree longitude zone to keep distance and area distortion small locally.
Key sources and current tooling
- Sentinel-2 (ESA, Copernicus programme) — 13 bands, 10/20/60 m, free, global, operating since 2015.
- Landsat 8/9 (NASA/USGS) — 11 bands, 30 m (15 m panchromatic), free, part of a continuous archive dating to 1972.
- Google Earth Engine and Microsoft Planetary Computer host both archives with server-side compute, avoiding local downloads of petabyte-scale collections.
rasterio(built on GDAL) is the standard Python library for reading GeoTIFF with CRS awareness.xarrayplusrioxarrayis the standard stack for multi-date, multi-band analysis at scale.
What to learn next
- NDVI and vegetation indices — the reflectance-ratio calculation this lesson sets up.
- GeoTIFF tiling and georeferencing — the affine transform and tiling in full.
- Convolutional neural networks — the architecture family most satellite classifiers are built from.