Skip to main content
title case
Link
Vince
  • 20.3k
  • 16
  • 48
  • 65

Pixel Wise Max Class Count-wise max class count for ImageCollection in GEE

Source Link

Pixel Wise Max Class Count for ImageCollection in GEE

I am working with Dynamic World dataset. The label band gives me the pixelwise landcover class values. For any specific year, ImageCollection.mode() gives me the pixelwise most occurring landcover class. I am also interested in calculating how many times that class actually occurred in each pixel. In short, value and count of that class.

bn = ee.Geometry.Rectangle([-91, 33, -90, 34])
startDate = '2020-06-01'
endDate = '2021-09-01'
dw = ee.ImageCollection('GOOGLE/DYNAMICWORLD/V1').filterDate(startDate, endDate).filterBounds(bn)
max_occurred_class_label = dw.select('label').mode()
max_occurred_class_count = anyFunction(dw.select('label'))

Any ideas, how to achieve this?