English | Deutsch
NDVI (Landsat)¶
The same vegetation index as NDVI (Sentinel-2), calculated from the Landsat bi-monthly mosaics. They run from 1997 to 2025, so this is the data type for questions about change over decades: how did the vegetation of an area develop since 1997? The price is a coarser pixel (30 m instead of 10 m).
Download function |
|
|---|---|
Plot function |
|
Source |
Landsat bi-monthly mosaic (collection |
Pixel size |
30 m |
Result |
one band of floating-point numbers, no unit, -1 … 1 |
Clouds |
none needed: the mosaics are reconstructed and cloud-free. There are no |
Period |
1997 to 2025; mean of the mosaics inside |
Example¶
from cdec import download_landsat, plot_landsat
spatial_extent = {"west": 8.721771, "south": 53.025027, "east": 8.904419, "north": 53.114965} # Bremen
temporal_extent = ["2024-06-01", "2024-07-01"] # June 2024, the end date is not included
path = download_landsat("data/landsat_bremen.tif", spatial_extent, temporal_extent)
plot_landsat(path)
Bremen, June 2024. White: no data. Landsat data, see Data sources and credits.¶
Things to know¶
Not the same as the Sentinel-2 NDVI. Different satellites, bands, pixel size and processing give slightly different numbers. Compare Landsat with Landsat, and Sentinel-2 with Sentinel-2.
Several decades: use the same months of different years (for example June 1998, 2008, 2018 and 2024) to avoid mixing up seasons with change.
Empty pixels. In the example the river is empty; the rest is complete.
The file uses longitude and latitude (EPSG:4326), so its pixel size is given in degrees. The plot corrects the shape of the map for that (Grids and time).
The plot uses red-yellow-green colours and a fixed range of -1 to 1, like the Sentinel-2 NDVI.
See also¶
Download¶
- cdec.download_landsat_ndvi(file_path, spatial_extent, temporal_extent, *, create_cog=True, overview_resampling='average')[source]¶
Short alias:
download_landsatDownload an NDVI raster from the Landsat bi-monthly mosaic.
The source collection provides reconstructed, cloud-free Landsat mosaics at 30 metre resolution from 1997 through 2025. Red and near-infrared bands are averaged over the requested period before calculating NDVI. The mosaics are already cloud-free, so there is no cloud-cover or SCL masking here.
- Parameters:
file_path (str | Path) – Destination path of the GeoTIFF file. Missing parent directories are created automatically.
spatial_extent (SpatialExtent) – Area to download: an openEO bounding-box dictionary such as
{"west": 8.7, "south": 53.0, "east": 8.9, "north": 53.1}(degrees, WGS 84), a Shapely geometry, or the path to a GeoJSON file.temporal_extent (TemporalExtent) – Start and end of the observation period, e.g.
["2024-06-01", "2024-07-01"]. The end date itself is not included. The mosaics end on 2024-12-31, later dates find no data.create_cog (bool) – If
True, write a Cloud Optimized GeoTIFF.overview_resampling (OverviewResampling) – Resampling method used to build COG overview levels.
- Returns:
Absolute path of the GeoTIFF that was written. The file has one band of floating-point numbers (
float32): the NDVI, a number without unit between -1 and 1. Pixels without data are NaN, which the file declares as its no-data value. The coordinate system is geographic (EPSG:4326, degrees); the pixel size is 0.00025 degrees, about 30 m.- Return type:
Path
Plot¶
- cdec.plot_landsat_ndvi(file_path, *, ax=None, title=None, cmap='RdYlGn', vmin=-1.0, vmax=1.0, colorbar=True, show=None)[source]¶
Short alias:
plot_landsatDraw the NDVI of
download_landsat_ndvi.Same colour map and range as
plot_normalized_difference_vegetation_index(). Landsat pixels are larger than Sentinel-2 pixels, so the same area looks coarser.- Parameters:
file_path (str | Path) – The GeoTIFF written by
download_landsat.ax (Axes | None) – A matplotlib
Axesto draw into.Nonecreates a new figure.title (str | None) – Title of the plot. Default: “NDVI (Landsat)”. Use
""for no title.cmap (str) – Name of a matplotlib colour map.
vmin (float | None) – Values at the two ends of the colour map.
Nonetakes the smallest and largest value of the image instead.vmax (float | None) – Values at the two ends of the colour map.
Nonetakes the smallest and largest value of the image instead.colorbar (bool) – Draw a colour bar.
show (bool | None) – Call
plt.show()at the end. The default (None) shows the figure only if this function created it.
- Returns:
The axes with the plot, for further changes.
- Return type:
matplotlib.axes.Axes
- Raises:
ValueError – If the file does not have exactly one band.