I am using code from the emapr lab to learn to use LandTrendr to get mean NDVI values per year for a geometry. I am trying to export the generated list from earth engine to Drive. The list only contains Year, Original NDVI and Fitted NDVI values. The error I am getting is- "Unknown element type provided: object. Expected: ee.Image, ee.ImageCollection, ee.FeatureCollection or ee.Element." How can I convert a list in order to export it to drive as a csv?
A link to the code I am using.
The end bit of my code:
var yearSummary = getSummary(yearBandStack, aoi, summaryScale).toArray();
var rawSummary = getSummary(rawBandStack, aoi, summaryScale).toArray();
var fitSummary = getSummary(fitBandStack, aoi, summaryScale).toArray();
var chartArray = ee.Array.cat([yearSummary, rawSummary, fitSummary], 1).getInfo();
chartArray = [['Year', 'Original', 'Fitted']].concat(chartArray);
print(chartArray)
Export.table.toDrive({
collection: chartArray,
folder: 'Test_Folder',
description:'test_chartArray',
fileFormat: 'CSV'
});
Best Answer
In no way the best solution to this as it will require some formatting of the csv after download. But it was the quickest I could do without having to spend way too much time re-writing all your code.
When you want to export to a csv, what you export is the properties of a feature collection.
So I made a null geometry feature collection containing your arrays and then exported that.