1

How do I get surface temperature variation with a time series chart?

I have tried the same code on different data but it does not work with this one.

var dataset = ee.ImageCollection("JAXA/GCOM-C/L3/OCEAN/SST/V3")
            .filterDate('2023-01-24', '2023-02-03')
            // filter to daytime data only
            .filter(ee.Filter.eq("SATELLITE_DIRECTION", "D"));
print(dataset);
// Clip the dataset to the geometry
var clipped = dataset.mean().clip(geometry).select('SST_AVE').set('system:time_start', dataset.get('system:time_start'));

// Multiply with slope coefficient and add offset
var scaled = clipped.multiply(0.0012).add(-10);

// Define the visualization parameters
var vis = {
  bands: ['SST_AVE'],
  min: 0,
  max: 10,
  palette: ['000000', '005aff', '43c8c8', 'fff700', 'ff0000'],
};

Map.centerObject(geometry, 10);
Map.addLayer(scaled, vis, "Clipped and scaled SST");

var chart = ui.Chart.image.series({
  imageCollection: scaled,
  region: geometry,
  reducer: ee.Reducer.mean(),
  scale: 1000,
  xProperty: 'system:time_start',
});

1 Answer 1

0

You're passing a single image to the chart (the mean over time) where an image collection is expected. You will want to scale every image in the collection. That's done through map(). The copyProperties() call is to ensure you actually retain system:time_start after scaling. Use clip() only when needed, and as late in the processing as possible.

var imageCollection = ee.ImageCollection("JAXA/GCOM-C/L3/OCEAN/SST/V3")
  .filterDate('2023-01-24', '2023-02-03')
  .filter(ee.Filter.eq("SATELLITE_DIRECTION", "D"))
  .map(function(image) {
    return image
      .select('SST_AVE')
      .multiply(0.0012).add(-10)
      .copyProperties(image, image.propertyNames())
  })

var vis = {bands: ['SST_AVE'], min: 0, max: 10, palette: ['000000', '005aff', '43c8c8', 'fff700', 'ff0000']}
Map.addLayer(imageCollection.mean().clip(geometry), vis, "Clipped and scaled SST")
Map.centerObject(geometry, 10)

var chart = ui.Chart.image.series({
  imageCollection: imageCollection,
  region: geometry,
  reducer: ee.Reducer.mean(),
  scale: 1000
})

print(chart)

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.