I’m trying to calculate mean NDVI for the American Southwest from June through September of 2003.
[[[-114.558, 37.16155995344565],
[-107.82998424288692, 32.858],
[-107.82998424288692, 37.16155995344565]]], null, false),
countries = ee.FeatureCollection("USDOS/LSIB_SIMPLE/2017");
var L7 = ee.ImageCollection("LANDSAT/LE07/C02/T1")
.filterDate('2003-06-01', '2003-09-30')
//create a function to add an ndvi layer to the map using the NIR and RED layers (B4 and B3)
var addNDVI = function(image) {
var ndvi = image.normalizedDifference(['B4', 'B3']).rename('NDVI');
return image.addBands(ndvi);
//apply the function and add the NDVI layer
var L7_NDVI = L7.map(addNDVI)
//take an average of all ndvi
var mean_NDVI = L7_NDVI.mean();
var NDVIpalette = ['FFFFFF', 'CE7E45', 'DF923D', 'F1B555', 'FCD163', '99B718', '74A901', '66A000', '529400', '3E8601', '207401', '056201', '004C00', '023B01', '012E01', '011D01', '011301'];
Map.addLayer(mean_NDVI.select('NDVI'), {palette: NDVIpalette, min:-0.4043225049972534, max:0.42658907175064087,}, 'L7 Original')
<code>
var geometry =
/* color: #98ff00 */
/* shown: false */
/* displayProperties: [
{
"type": "rectangle"
}
] */
ee.Geometry.Polygon(
[[[-114.558, 37.16155995344565],
[-114.558
, 32.858],
[-107.82998424288692, 32.858],
[-107.82998424288692, 37.16155995344565]]], null, false),
countries = ee.FeatureCollection("USDOS/LSIB_SIMPLE/2017");
var L7 = ee.ImageCollection("LANDSAT/LE07/C02/T1")
.filterDate('2003-06-01', '2003-09-30')
.filterBounds(geometry)
;
//create a function to add an ndvi layer to the map using the NIR and RED layers (B4 and B3)
var addNDVI = function(image) {
var ndvi = image.normalizedDifference(['B4', 'B3']).rename('NDVI');
return image.addBands(ndvi);
};
//apply the function and add the NDVI layer
var L7_NDVI = L7.map(addNDVI)
//take an average of all ndvi
var mean_NDVI = L7_NDVI.mean();
//add the ndvi layer
var NDVIpalette = ['FFFFFF', 'CE7E45', 'DF923D', 'F1B555', 'FCD163', '99B718', '74A901', '66A000', '529400', '3E8601', '207401', '056201', '004C00', '023B01', '012E01', '011D01', '011301'];
//add the map layers
Map.addLayer(mean_NDVI.select('NDVI'), {palette: NDVIpalette, min:-0.4043225049972534, max:0.42658907175064087,}, 'L7 Original')
</code>
var geometry =
/* color: #98ff00 */
/* shown: false */
/* displayProperties: [
{
"type": "rectangle"
}
] */
ee.Geometry.Polygon(
[[[-114.558, 37.16155995344565],
[-114.558
, 32.858],
[-107.82998424288692, 32.858],
[-107.82998424288692, 37.16155995344565]]], null, false),
countries = ee.FeatureCollection("USDOS/LSIB_SIMPLE/2017");
var L7 = ee.ImageCollection("LANDSAT/LE07/C02/T1")
.filterDate('2003-06-01', '2003-09-30')
.filterBounds(geometry)
;
//create a function to add an ndvi layer to the map using the NIR and RED layers (B4 and B3)
var addNDVI = function(image) {
var ndvi = image.normalizedDifference(['B4', 'B3']).rename('NDVI');
return image.addBands(ndvi);
};
//apply the function and add the NDVI layer
var L7_NDVI = L7.map(addNDVI)
//take an average of all ndvi
var mean_NDVI = L7_NDVI.mean();
//add the ndvi layer
var NDVIpalette = ['FFFFFF', 'CE7E45', 'DF923D', 'F1B555', 'FCD163', '99B718', '74A901', '66A000', '529400', '3E8601', '207401', '056201', '004C00', '023B01', '012E01', '011D01', '011301'];
//add the map layers
Map.addLayer(mean_NDVI.select('NDVI'), {palette: NDVIpalette, min:-0.4043225049972534, max:0.42658907175064087,}, 'L7 Original')
The issue arises when I try to visualize my NDVI layer. There seems to be a clear division in NDVI values between the west and east sides of my raster layer.
I was wondering if this could be an issue related to landsat 7 itself, as I don’t appear to get the same issue when using landsat 5 data. I also don’t think it’s related to the line error issue associated with landsat 7, as the issue persists when I use data from 2000 before the line error became an issue, though there isn’t as much of a difference.
Does anyone have any idea where this difference could be coming from? Thanks!