Let’s talk about air quality data! Join us for Open Call on Oct. 26 to kick-off this topic and then every Tuesday until Dec. 14. Click here for call-in details!

Public Lab Wiki documentation

NDVI Calculation

This is a revision from January 26, 2011 06:56. View all revisions
1 | 5 | | #62

Plaza San Martin, visible-infrared-NDVI

Good example in GDAL/Python: http://www.gis.usu.edu/~chrisg/python/2009/lectures/ospy_slides5.pdf

Script for GDAL: http://www.jeremymsmith.us/davidson/NDVI.py

Remember, NDVI is:

Infrared - Visible / Infrared + Visible

GDAL commands

Splice out a single band and save as independent geotiff:

gdal_translate -of GTiff -b 2 morflex-freeflight-geo.tif morflex-freeflight-green.tif

On using NDVI.py, I got this error:

nautilus-2:morflex-lima-freeflight warren$ python NDVI.py Traceback (most recent call last): File "NDVI.py", line 31, in var1 = subtract(band4, band3) ValueError: shape mismatch: objects cannot be broadcast to a single shape

Perhaps we can use this GDAL crop script to make both images the same shape: http://www.enricozini.org/2010/tips/gdal-crop/