0

My goal is export CSV table with 2 columns: system:time_start in format YYYYMMddHHmmss and LST_median. For this I try to create Chart first but xProperty wants just a string like system:time_start and not a function which change a format of the data. How can I solve this problem and have my CSV table?

var chart = ui.Chart.image.series({
imageCollection: scaledReducedl8.select('ST_B10').filterDate('2021-01-01', '2021-12-31'),
region: geometry.buffer(17),
reducer: ee.Reducer.median(),
xProperty: ee.Date('system:time_start').format('YYYYMMddHHmmss')
}).setSeriesNames(['LST_median']);

print('median LST with revisit time data', chart);

1 Answer 1

0

You can map over the collection and add a property with the formatted date. Use that property as xProperty when charting.

var scaledReducedl8 = ee.ImageCollection('LANDSAT/LC08/C02/T1_L2')
  .filterBounds(geometry)
  .filterDate('2021-01-01', '2022-01-01') // End date is exclusive
  .select('ST_B10')
  .map(function (image) {
    return image.set('formattedDate', image.date().format('YYYYMMddHHmmss'))
  })

var chart = ui.Chart.image.series({
  imageCollection: scaledReducedl8,
  region: geometry.buffer(17),
  reducer: ee.Reducer.median(),
  xProperty: 'formattedDate'
}).setSeriesNames(['LST_median']);

print(chart)

https://code.earthengine.google.com/0bbff9acefc6a80f6ba8b7119a30eb0c

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.