I am trying to grab the underlying data from a chart in GEE. It looks like there is a built in method for this: ui.Chart.getDataTable()
, however it appears to not work. I've tried on multiple charts. Here's the documentation for the function. Here is my code:
var start = '2021-01-01';
var end = '2022-12-31';
// Construct a polygon from a list of x,y coordinate pairs defining a boundary.
var roi2 = ee.Geometry.Polygon(
[-110.0, 40, -113.0, 40, -110.0, 42]
);
Map.addLayer(roi2, {}, 'roi2');
Map.centerObject(roi2)
// Snow water equivalent - daily
var dayMet = ee.ImageCollection("NASA/ORNL/DAYMET_V4")
.filterBounds(roi2)
.select('prcp', 'swe')
.filterDate(start, end)
// Save the chart as a variable
var dayMetChart = (ui.Chart.image.series(dayMet.select(['prcp', 'swe']), roi,
ee.Reducer.mean(), 4000)
.setOptions({
title: 'dayMet',
lineWidth: 1,
pointSize: 3
})
);
// Use the getDataTable function and print the data
var table = dayMetChart.getDataTable();
print(table)
The table variable is an empty object. Can someone explain why this doesn't work or how to get it to work?