I have a FeatureCollection that I am using .reduceRegions() over the Hansen Forest Loss dataset using ee.Reducer.fixedHistogram() to get the count of pixels per year/per feature.
The result is a feature which I can see the results in the 'histogram' property but can't select those results to store in another variable to do further analysis.
How can I select the results from the reducer (ex: how can I select 3.011764705882353 in the first element)?
I keep getting the following error:
ComputedObject (Error)
List.get, argument 'list': Invalid type. Expected: List<Object>. Actual:
Float<dimensions=2>.
Here is the code I have:
var forest_years = forest.select('lossyear')
var test = forest_years.reduceRegions({
collection:GB_patches,
reducer: ee.Reducer.fixedHistogram(0,18,18),
scale:30,
})
var first = ee.Feature(test.first())
var patch_years = ee.List(first.get('histogram'))
print (first)
print (patch_years)
print (patch_years.get(1))
Link to GEE code: https://code.earthengine.google.com/9ab9b35f4cc49b45f29386c70a0cb2cc