0

I am trying to extract some information from the GOES fire product in Google Earth Engine.

I have written a function that will extract the fire pixels for each image in the collection.

// OBTAIN GOES IMAGERY FOR A SINGLE DATE
var collection = ee.ImageCollection('NOAA/GOES/16/FDCC').filterDate('2018-01-04', '2018-01-05');

var GetFirePixels = function(img){
  // SELECT DATA QUALITY FLAGS
  var DQF = img.select('DQF')
  // GET ONLY FIRE PIXELS FROM DQF BAND
  var OnlyFire = DQF.eq(0)
  // RETURN THE FIRE MASK
  return OnlyFire
}

var FirePixels = collection.map(GetFirePixels)

I can reduce this new collection to obtain a singular image with all of the fire detections

var AllFirePixels = FirePixels.max()

However I am not sure how to reduce this new image collection to return the time of first detection as a pixel value? So the output would be similar to "AllFirePixels" but the pixel values would be dates (as a number) instead of 1s

Any ideas?

1 Answer 1

1

You can add an additional layer with the date. Then you reduce() your collection with a ee.Reducer.max() with numInputs set to 2. That way you get the max fire mask and it's corresponding date. Alternatively, you can use qualityMosaic(), providing the fire band name as argument.

var collection = ee.ImageCollection('NOAA/GOES/16/FDCC').filterDate('2018-01-04', '2018-01-05');

var GetFirePixels = function(img){
  // SELECT DATA QUALITY FLAGS
  var DQF = img.select('DQF')
  // GET ONLY FIRE PIXELS FROM DQF BAND
  var OnlyFire = DQF.eq(0)
  // RETURN THE FIRE MASK
  var fractionalYear = ee.Image(
    img.date().get('year').add(img.date().getFraction('year'))
  ).float().rename('fractionalYear')
  return OnlyFire
    .addBands(fractionalYear)
}

var FirePixels = collection.map(GetFirePixels)
var AllFirePixels = FirePixels.reduce(ee.Reducer.max(2))
  .rename(['fire', 'fractionalYear'])
// var AllFirePixels = FirePixels.qualityMosaic('fire')

Map.addLayer(AllFirePixels, {bands: 'fire'})

https://code.earthengine.google.com/2283c14ba61fa1326df7c4d9e0808ae3

2
  • Hi Daniel, thank you for this comment. I see what you are doing here, but I am trying to understand how you reduced the collection. Does this return the time of the earliest detected fire at each pixel location? Commented Nov 1, 2022 at 14:18
  • I never remember which is be picked up, so I had to check. max(2) returns the earliest detected and qualityMosaic('fire') the last. code.earthengine.google.com/2987b2d31bdb8ad63a9813b5c0db36a3 Commented Nov 2, 2022 at 8:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.