0

I have obtained sea surface temperature data for Ascension Island and now want to export this into a csv. I managed to export the mean SST values for a previous package I was looking at (NASA/OCEANDATA/MODIS-Aqua/L3SMI) but I am now trying to use the exact same code using a different package (JAXA/GCOM-C/L3/OCEAN/SST/V3) and it won't provide me with the SST values, it just gives me these values instead:

system:index      date                .geo

20230101A   2023-01-01  {"type":"MultiPoint","coordinates":[]}

20230101D   2023-01-01  {"type":"MultiPoint","coordinates":[]}

20230102A   2023-01-02  {"type":"MultiPoint","coordinates":[]}.

This is the code for the package that did work:

// 5.5 - Time series and marine data

// Define the region of interest (ROI) around Ascension Island
var ROI = ee.FeatureCollection([
  ee.Feature(
    ee.Geometry.Rectangle([-14.57, -8.12, -14.17, -7.75]), {label: 'Ascension Island'})
]);

Map.setCenter(-14.5, -8.1, 8);
Map.addLayer(ROI, {}, 'ROI');

// Adding names to ROI
var FeatCollectAsAList = ROI.toList(ROI.size());
print(FeatCollectAsAList, 'ROI');


// Map a function over the list to rename the IDs
var ROIEdit = ee.FeatureCollection(FeatCollectAsAList.map(function(feat){
  var id = ee.Feature(feat).get('id');
  return ee.Feature(feat).set("system:index", id);
}));

print(ROIEdit);

// Obtain SST data from NASA MODIS
var AI_SST = ee.ImageCollection('NASA/OCEANDATA/MODIS-Aqua/L3SMI').select('sst') // use OISST for EEZ_SE
    .filterDate(ee.Date('2017-01-01'), ee.Date('2018-04-01'))
    .filterBounds(ROI);


// Convert ImageCollection to FeatureCollection for export
var exportFeatures = AI_SST.map(function(image) {
  var date = image.date().format('YYYY-MM-dd');
  var mean = image.reduceRegion({
    reducer: ee.Reducer.mean(),
    geometry: ROI.geometry(),
    scale: 500,
    maxPixels: 1e9
  });

  return ee.Feature(null, mean.set('date', date));
});

// Print a sample feature to check if data is being processed correctly
print('Sample feature:', exportFeatures.first());

// Export the data to Google Drive as CSV
Export.table.toDrive({

  collection: exportFeatures,
  description: 'SST_Ascension_Island_2017_2018',
  fileFormat: 'CSV',
  folder: 'EarthEngineExports' // Optional: specify a folder in Google Drive
});

This is the code for the package that did NOT work:

// 5.5 - Time series and marine data

// Define the region of interest (ROI) around Ascension Island
var ROI = ee.FeatureCollection([
  ee.Feature(
    ee.Geometry.Rectangle([-14.57, -8.12, -14.17, -7.75]), {label: 'Ascension Island'})
]);

Map.setCenter(-14.5, -8.1, 8);
Map.addLayer(ROI, {}, 'ROI');

// Adding names to ROI
var FeatCollectAsAList = ROI.toList(ROI.size());
print(FeatCollectAsAList, 'ROI');

// Map a function over the list to rename the IDs
var ROIEdit = ee.FeatureCollection(FeatCollectAsAList.map(function(feat){
  var id = ee.Feature(feat).get('id');
  return ee.Feature(feat).set("system:index", id);
}));

print(ROIEdit);

// Obtain SST data from NASA MODIS
var AI_SST = ee.ImageCollection("JAXA/GCOM-C/L3/OCEAN/SST/V3").select('SST_AVE')
    .filterDate(ee.Date('2023-01-01'), ee.Date('2024-04-01'))
    .filterBounds(ROI);

// Convert ImageCollection to FeatureCollection for export
var exportFeatures = AI_SST.map(function(image) {
  var date = image.date().format('YYYY-MM-dd');
  var mean = image.reduceRegion({
    reducer: ee.Reducer.mean(),
    geometry: ROI.geometry(),
    scale: 500,
    maxPixels: 1e9
  });
  
  
  return ee.Feature(null, mean.set('date', date));
});

print('Sample feature:', exportFeatures.first());

// Export the data to Google Drive as CSV
Export.table.toDrive({
  collection: exportFeatures,
  description: 'SST_Ascension_Island_2023_2024_2',
  fileFormat: 'CSV',
  folder: 'EarthEngineExports' 
});

Does anyone know why the exported data is different for the different packages? I have managed to obtain the SST values I wanted by downloading the data from a chart I made, but I am just curious to know why it hasn't worked so that hopefully I know how to solve this next time I come across this problem.

1 Answer 1

0

I think the issue is that the first feature in the exportFeatures has no value for the SST_AVE attribute. This is because the first image in the JAXA/GCOM-C/L3/OCEAN/SST/V3 collection contains only masked values over the ROI. Thus, my guess is that by default, Export.table.toDrive does not export the featureCollection with the SST_AVE attribute. A workaround is to define the attributes you wish to export using selectors.

// Export the data to Google Drive as CSV
Export.table.toDrive({
  collection: exportFeatures,
  selectors: ['SST_AVE', 'date'],
  description: 'SST_Ascension_Island_2023_2024_2',
  fileFormat: 'CSV',
  folder: 'EarthEngineExports' 
});
1
  • Thank you Jonathan, that has worked. Commented Jul 18 at 10:16

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.