1

Change image is an array image,he stores the time node of each pixel.time1 and time2 are the first node and the second node of each pixel, respectively.I want to get the NDSI average value of each pixel in the image between time1 and time2.I don't know how to express the image between time1 and time2 of each pixel.Hope you can help me.Many thanks.Here is the code link https://code.earthengine.google.com/c9dd75397677fbc1966107b0aa21cf66

var change = ee.Image('users/wiell/CCDCExamples/segments')
var blist = change.select('tBreak')
blist = blist.arrayMask(blist.gt(0))
var region = blist.geometry()

var l5 = ee.ImageCollection('LANDSAT/LT05/C01/T1_SR')
  .select(['B2', 'B5', 'pixel_qa'], ['green', 'swir1', 'pixel_qa'])

var l8 = ee.ImageCollection('LANDSAT/LC08/C01/T1_SR')
  .select(['B3', 'B6', 'pixel_qa'], ['green', 'swir1', 'pixel_qa'])

var ndsiCollection = l5.merge(l8)
  .filterBounds(region)
  .map(function (image) {
    return image
      .select([]).addBands( // Replace bands to keep properties
        image.normalizedDifference(['green', 'swir1'])
      )
      .updateMask(landsatMask(image))
      .rename('ndsi')
  })

var segmentCount = blist.arrayLength(0)
var time1 = toUnixMillis(segmentCount.subtract(2))
var time2 = toUnixMillis(segmentCount.subtract(1))

var ndsi1 = ndsiForTime(time1)
var ndsi2 = ndsiForTime(time2)

Map.centerObject(blist)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.