This page looks best with JavaScript enabled

Romania's cities - an overiew of vegetation using NDVI

 ·  ☕ 2 min read  ·  ✍️ Alexandru Munteanu

Since the recent post, where I only included True Color Imagery using Sentinel-2 data, providing an overview of some major cities, I thought it might also be interesting to extend those examples so we can have a look at the vegetation around (and also inside) of the cities.

We can use a simple Normalized Difference Vegetation Index (NDVI) that is computed like so:

$$ NDVI = \frac{NIR - RED}{NIR + RED} $$

The only things that change from our previous example’s code would be that instead of selecting the RGB bands from the STAC Catalog using stackstac, we only select the NIR and RED bands. This corresponds to the B08 and B04 Sentinel-2 bands:

1
stack = stackstac.stack(items, epsg=32635, resolution=10, assets=["B08", "B04"], errors_as_nodata=Exception(".*"))

After that, we perform the cropping of the cube to our desired Area of Interest, we can separate the two bands using xarray.sel()

1
nir, red = aoi.sel(band="B08"), aoi.sel(band="B04")

Then, we compute NDVI:

1
2
ndvi = (nir - red) / (nir + red)
ndvi = ndvi.persist()

So, our ndvi cube ends up looking like this:

xarray-datacube
NDVI datacube.

By using dask and geogif we can create GIF’s of the vegetation presence throughout the years:

NDVI at each 10 days.
Timișoara: NDVI at each 10 days.

NDVI at each 10 days.
Cluj: NDVI at each 10 days.

NDVI at each 10 days.
Iași: NDVI at each 10 days.

NDVI at each 10 days.
București - Sector 1: NDVI at each 10 days.

NDVI at each 10 days.
București - Sector 2: NDVI at each 10 days.

NDVI at each 10 days.
București - Sector 3: NDVI at each 10 days.

NDVI at each 10 days.
București - Sector 4: NDVI at each 10 days.

NDVI at each 10 days.
București - Sector 5: NDVI at each 10 days.

NDVI at each 10 days.
București - Sector 6: NDVI at each 10 days.

NDVI at each 10 days.
Brașov: NDVI at each 10 days.

NDVI at each 10 days.
Oradea: NDVI at each 10 days.

NDVI at each 10 days.
Deva: NDVI at each 10 days.


Alexandru Munteanu
WRITTEN BY
Alexandru Munteanu
Research Assistant, PhD Student