Экспорт в csv «Ошибка: превышен предел пользовательской памяти» Google Earth Engine - PullRequest
0 голосов
/ 19 февраля 2020

Я довольно новичок в Google Earth Engine. По сути, я пытаюсь экспортировать среднюю температуру для каждого многоугольника в WDPA в CSV. Я могу экспортировать меньшие подразделы коллекции объектов, но если я попытаюсь сделать это для всех полигонов, экспорт завершится неудачно со следующим: Ошибка: превышен лимит памяти пользователя

Возможно ли это сделать или сделать мне нужно нарезать коллекцию функций?

Заранее спасибо !!

var wdpa = ee.FeatureCollection('WCMC/WDPA/current/polygons');

// Daily mean 2m air temperature
var dataset = ee.ImageCollection('ECMWF/ERA5/DAILY').select('mean_2m_air_temperature');

//Create a list of the years that you would like to take the mean for 
var years = ee.List.sequence(1981,2018);

//Create an image collection that calculates the mean temperature for each year
var byYear = ee.ImageCollection.fromImages(
  years.map(function (y) {
    var year = dataset.filter(ee.Filter.date(ee.Date.fromYMD(y, 01, 01), ee.Date.fromYMD(y, 12, 31)))
    .mean()
    .set('year', ee.String('Year_').cat(ee.Number(y).int()));
    return year;
  }));
print(byYear);

// extract the mean temperature for each year in each protected area
var Mean_Temp = byYear.map(function(image) {
  return image.reduceRegions({
    // collection:wdpaCentroids,
    collection: wdpa,
    reducer: ee.Reducer.mean(), 
    scale: 1000
  }).map(function(feature) {
    var empty = feature.geometry();
    return ee.Feature(null).set({
      'wdpa_pid': ee.String(feature.get('WDPA_PID')),
      'year': image.get('year'),
      'temp_mean':feature.get('mean'), 
      'name': feature.get('NAME')
    });
  });
}).flatten();
// print(Mean_Temp);

// Format the triplet to allow for a CSV to be exported
var format = function(table, rowId, colId, rowProperty, colProperty) {
  var rows = table.distinct(rowId); 
  var joined = ee.Join.saveAll('matches').apply({
    primary: rows, 
    secondary: table, 
    condition: ee.Filter.equals({
      leftField: rowId, 
      rightField: rowId
    })
  });
  return joined.map(function(row) {
      var values = ee.List(row.get('matches'))
        .map(function(feature) {
          feature = ee.Feature(feature);
          return [feature.get(colId), feature.get(colProperty)];
        }).flatten();
      return row.select([rowId, rowProperty]).set(ee.Dictionary(values));
    });
};

// Note that there's a dummy feature in there for the points ('null').
var transpose = format(Mean_Temp, 'wdpa_pid', 'year','null', 'temp_mean');
// print(transpose);

// Export the Dataset as a CSV
Export.table.toDrive({
  collection: transpose,
  description:'WDPA_Temperature',
  fileFormat: "csv"
});

1 Ответ

0 голосов
/ 20 февраля 2020

Как уже говорилось в , это делает c, попробуйте установить tileScale в ваших reduceRegion() или reduceRegions() вызовах.

...