I'm strugling with the QGIS Raster Calculator, trying to get a NDVI image from a Landsat 8 scene (path 222, row 84, date 2015-11-15). The problem is, I'm consistently getting NaN values for all the resulting pixels.
As far as I can tell, everything I'm doing should be right: projections, data type, dimensions, origin, etc, are the same (which is expected from a landsat scene)(see below). The formula used is just
(B5 - B4) / (B5 + B4)
or, expressed in terms of my layers:
( "LC82220842015319LGN00_B5@1" - "LC82220842015319LGN00_B4@1" ) / ( "LC82220842015319LGN00_B5@1" + "LC82220842015319LGN00_B4@1" )
As I mentioned before, all I get is a raster layer with all pixels NaN.
A couple of observations:
I had no problems with the landsat 8 scene for row 222 path 83, for the same date.
The NaNs somehow occur because of the numerator, but not the denominator... In other words:
B5 + B4
works good, butB5 - B4
gives NaN.
So, it's really just the difference operation that works badly.
Metadata from the layers:
B5:
Driver
GDAL provider
GTiff
GeoTIFF
Dataset Description
/home/jmb/Ramsar_2016/SIG/Landsat/222_084/LC82220842015319LGN00/LC82220842015319LGN00_B5.TIF
AREA_OR_POINT=Point
Band 1
STATISTICS_MAXIMUM=31568
STATISTICS_MEAN=7466.8914366775
STATISTICS_MINIMUM=0
STATISTICS_STDDEV=7611.703054711
Dimensions
X: 7911 Y: 7981 Bands: 1
Origin
646785,-3.71428e+06
Pixel Size
30,-30
No Data Value
*NoDataValue not set*
Data Type
UInt16 - Sixteen bit unsigned integer
Pyramid overviews
Layer Spatial Reference System
+proj=utm +zone=21 +datum=WGS84 +units=m +no_defs
Layer Extent (layer original source projection)
646785.0000000000000000,-3953715.0000000000000000 : 884115.0000000000000000,-3714285.0000000000000000
Band
Band 1
Band No
1
No Stats
No stats collected yet
B4:
Driver
GDAL provider
GTiff
GeoTIFF
Dataset Description
/home/jmb/Ramsar_2016/SIG/Landsat/222_084/LC82220842015319LGN00/LC82220842015319LGN00_B4.TIF
AREA_OR_POINT=Point
Band 1
STATISTICS_MAXIMUM=24844
STATISTICS_MEAN=4926.3172446242
STATISTICS_MINIMUM=0
STATISTICS_STDDEV=3631.9117068848
Dimensions
X: 7911 Y: 7981 Bands: 1
Origin
646785,-3.71428e+06
Pixel Size
30,-30
No Data Value
*NoDataValue not set*
Data Type
UInt16 - Sixteen bit unsigned integer
Pyramid overviews
Layer Spatial Reference System
+proj=utm +zone=21 +datum=WGS84 +units=m +no_defs
Layer Extent (layer original source projection)
646785.0000000000000000,-3953715.0000000000000000 : 884115.0000000000000000,-3714285.0000000000000000
Band
Band 1
Band No
1
No Stats
No stats collected yet
Update 1: my version of QGIS when first asked this question:
QGIS version 2.8.6-Wien QGIS code revision exported
Compiled against Qt 4.8.7 Running against Qt 4.8.7
Compiled against GDAL/OGR 1.11.3 Running against GDAL/OGR 1.11.3
Compiled against GEOS 3.5.0-CAPI-1.9.0 Running against GEOS 3.5.0-CAPI-1.9.0 r4084
PostgreSQL Client Version 9.5.1 SpatiaLite Version 4.3.0a
QWT Version 6.1.2 PROJ.4 Version 492
QScintilla2 Version 2.9.1
Update 2 (SOLVED, sort of): My current version is 2.14.3-Essen
The solution somehow involves dealing with the projections, but I'm not sure what exactly it's going on. To make it short, I just started a new project in qgis, imported the landsat 8 .tiffs layers and used raster calculator to get the NDVI.
It's still intriguing what I got in my main project though. When I make the calculations, I get the correct result, but only in a small region (gray area)(note that on the sides, the region was cropped beforehand to make my layers smaller. This does not explain the southern horizontal limit though):