I have a FeatureCollection of forest loss polygons that I am reducing (using ee.Reducer.fixedHistogram()
) over the Hansen forest loss dataset to create a histogram. This should give me a histogram of the pixel count per year. The resulting FeatureCollection has the histogram as a property (GOOD!). I am trying to find the years that have had the most forest loss and the years with the least forest loss (that is greater than zero).
My problem comes from the histogram that is part of the feature, it is an array but I can't sort it or find the index of a specific value (BAD!)(in the example I'm trying to find the min year, but I need to find the max as well).
Neither list methods nor array methods are working well (but that may come from my inexperience with GEE) and I keep getting the error:
Number (Error)
List.indexOf, argument 'list': Invalid type. Expected: List<Object>. Actual:
Float<dimensions=2>.
Here is the link to the code: https://code.earthengine.google.com/743d06e29e4d6168e074d772bb18bada
Also, additionally I can't export the features in the featurecollection
citing that it is an invalid type. I believe that this is the same issue as to why I can't sort or manipulate the arrays.
Collection.loadTable: Collection asset 'users/walteral/GB_patchesv2' not found.