2017-12-07 22 views
0

特定の地域の大きな時系列をエクスポートするにはどうすればよいですか?アイデアは、この地域の日付と平均バンド値を持つテーブルを取得することです。この場合、地域の平均NDVIになります。シングルポイントの時系列の場合Google Earth Engineで大きな時系列をエクスポートする

var collectionModNDVI = ee.ImageCollection('MODIS/006/MOD13Q1') 
     .filterDate('2002-01-01', '2017-11-17'); 

それは

var geom = ee.Geometry.Point(-1,40).buffer(250); 

print(ui.Chart.image.series(collectionModNDVI, geom, ee.Reducer.mean(), 30)); 

これがうまく機能しているだろうと、あなたは、CSVでセリエ時間をダウンロードすることができ、チャートを得ます。しかし、大規模な地域では、メモリと計算時間に問題があります。

var table2 = ee.Geometry.Rectangle(-1,40,0,41); 

chart = ui.Chart.image.seriesByRegion(collectionModNDVI,table2, 
     ee.Reducer.mean(), 'NDVI',30, 'system:time_start', 'label'); 

print(chart); 

このコードを使用すると、次のエラーが表示されます。「ユーザーメモリの上限を超えました」。

また、私はこの試みた:

Export.table.toDrive({ 
    collection: chart, 
    description:'vectorsToDriveExample', 
    fileFormat: 'csv' 
}); 

をしかし、私は同じエラーを持って、「d.ycは関数ではありません」。

答えて

0

テーブルをどのようにフォーマットするかについての詳細情報を提供する必要があります。ここでは、始めるために単一のバンドをエクスポートする2つの方法の例です:

var roi = /* color: #d63000 */ee.Geometry.Polygon(
     [[[-122.27577209472656, 37.891247253777074], 
      [-122.27577209472656, 37.86875557241152], 
      [-122.24040985107422, 37.86875557241152], 
      [-122.24040985107422, 37.891247253777074]]], null, false); 

// Load imagery. 
var l8 = ee.ImageCollection('LANDSAT/LC8_SR') 
    .filterBounds(roi) 
    .filterDate('2016-01-01', '2016-12-31') 
    .map(function(image) { 
     var qa = image.select('cfmask'); 
     var mask = qa.neq(2).and(qa.neq(4)); 
     return image.updateMask(mask).divide(10000); 
    }); 
print('Size of Landsat collection', l8.size()); // 21 

// Load an Earth Engine table. 
var blocks = ee.FeatureCollection('TIGER/2010/Blocks'); 
var subset = blocks.filterBounds(roi); 
print('Size of Census blocks subset', subset.size()); // 409 

Map.centerObject(roi, 13); 
Map.addLayer(blocks, {color: 'gray'}, 'blocks'); 
Map.addLayer(subset, {}, 'subset'); 

// Collect block, image, value triplets. 
var triplets = l8.map(function(image) { 
    return image.select('B1').reduceRegions({ 
    collection: subset.select(['blockid10']), 
    reducer: ee.Reducer.mean(), 
    scale: 30 
    }).filter(ee.Filter.neq('mean', null)) 
    .map(function(f) { 
     return f.set('imageId', image.id()); 
    }); 
}).flatten(); 
print(triplets.first()); 

// Format a table of triplets into a 2D table of rowId x colId. 
var format = function(table, rowId, colId) { 
    // Get a FeatureCollection with unique row IDs. 
    var rows = table.distinct(rowId); 
    // Join the table to the unique IDs to get a collection in which 
    // each feature stores a list of all features having a common row ID. 
    var joined = ee.Join.saveAll('matches').apply({ 
    primary: rows, 
    secondary: table, 
    condition: ee.Filter.equals({ 
     leftField: rowId, 
     rightField: rowId 
    }) 
    }); 

    return joined.map(function(row) { 
     // Get the list of all features with a unique row ID. 
     var values = ee.List(row.get('matches')) 
     // Map a function over the list of rows to return a list of 
     // column ID and value. 
     .map(function(feature) { 
      feature = ee.Feature(feature); 
      return [feature.get(colId), feature.get('mean')]; 
     }); 
     // Return the row with its ID property and properties for 
     // all matching columns IDs storing the output of the reducer. 
     // The Dictionary constructor is using a list of key, value pairs. 
     return row.select([rowId]).set(ee.Dictionary(values.flatten())); 
    }); 
}; 

var link = '78503bfa1fb76b3a9fa06b515d1e2488'; 

var table1 = format(triplets, 'imageId', 'blockid10'); 

var desc1 = 'table1_demo_' + link; 
Export.table.toDrive({ 
    collection: table1, 
    description: desc1, 
    fileNamePrefix: desc1, 
    fileFormat: 'CSV' 
}); 

var table2 = format(triplets, 'blockid10', 'imageId'); 

var desc2 = 'table2_demo_' + link; 
Export.table.toDrive({ 
    collection: table2, 
    description: desc2, 
    fileNamePrefix: desc2, 
    fileFormat: 'CSV' 
}); 

例はthis presentationから、this pageからリンクされていること。

+0

ありがとうございました!私は自分自身を正しく説明してくれなかったことを申し訳なく思う。私は何をしようとしているのかについて、より多くの情報を追加しました。 – Xeo

+0

チャートを使用することは、5000以上のものについては機能しません。また、チャートをエクスポートすることはできません。 (エクスポートするには[参考文献](https://developers.google.com/earth-engine/exporting)を参照してください)。私があなたのために作品を投稿した場合(試してみてください)、upvoteしてください。 –

関連する問題