从时间序列图表中更改下载 CSV 的日期格式

Change date format in download CSV from Time series Chart

我使用此脚本生成 NDVi 与时间的图表。问题是当我在 CSV 上下载系列时,日期格式很难使用,而且在所有观察中都不相同。

原来的CSV是这样的:

system:time_start,NDVI
Mar 26, 2013,0.132

我需要的是将日期格式更改为 2013-03-26 (yyyy-mm-dd)

脚本

var roi = /* color: #98ff00 */ee.Geometry.Point([-72.18245324628742, -13.260203147923505]);
var l8toa = ee.ImageCollection("LANDSAT/LC08/C01/T1_RT");
// This field contains UNIX time in milliseconds.
var timeField = 'system:time_start';
// Use this function to mask clouds in Landsat 8 imagery. (See https://landsat.usgs.gov/collectionqualityband)
var maskClouds = function(image) {var quality = image.select('BQA');
var cloud01 = quality.eq(61440);
var cloud02 = quality.eq(53248);
var cloud03 = quality.eq(28672);
var mask = cloud01.or(cloud02).or(cloud03).not();
return image.updateMask(mask);};
// Use this function to add variables for NDVI, time and a constant
// to Landsat 8 imagery.
var addVariables = function(image) {
  // Compute time in fractional years since the epoch.
  var date = ee.Date(image.get(timeField));
  var years = date.difference(ee.Date('1970-01-01'), 'year');
  // Return the image with the added bands.
  return image
  // Add an NDVI band.
  .addBands(image.normalizedDifference(['B5', 'B4']).rename('NDVI')).float()
  // Add a time band.
  .addBands(ee.Image(years).rename('t').float())
  // Add a constant band.
  .addBands(ee.Image.constant(1));};
  // Remove clouds, add variables and filter to the area of interest.
  var filteredLandsat = l8toa  .filterBounds(roi)  .map(maskClouds)  .map(addVariables);
  // Plot a time series of NDVI at a single location.
  var l8Chart = ui.Chart.image.series(filteredLandsat.select('NDVI'), roi)
  .setChartType('ScatterChart')
  .setOptions({title: 'Landsat 8 NDVI time series at ROI',trendlines: {0: {color: 'CC0000'
  }},lineWidth: 1,pointSize: 3,
  });
print(l8Chart);

使用 DATE_ACQUIRED 作为 xProperty 参数:

  var l8Chart = ui.Chart.image.series({ imageCollection:filteredLandsat.select('NDVI'), 
                       region:roi, xProperty:'DATE_ACQUIRED'})
  .setChartType('ScatterChart')
  .setOptions({title: 'Landsat 8 NDVI time series at ROI',trendlines: {0: {color: 'CC0000'
  }},lineWidth: 1,pointSize: 3,
  });