I am generating a plot but I have an error for generating a chart, my script is like below:
var cor = [[105.81352993964532, -5.657379634654876],
[105.81352993964532, -6.012584749422468],
[106.18706509589532, -6.012584749422468],
[106.18706509589532, -5.657379634654876]
]
var roi = ee.Geometry.Polygon(cor)
Map.centerObject(roi);
var sen1 = ee.ImageCollection("COPERNICUS/S1_GRD")
.select('VV')
.filterDate('2020','2021')
.filterBounds(roi)
.filter(ee.Filter.calendarRange(10, 10, 'month'))
.filter(ee.Filter.calendarRange(4, 4, 'day_of_month'))
.filter(ee.Filter.listContains('transmitterReceiverPolarisation','VV'))
.filter(ee.Filter.eq('instrumentMode','IW')).mosaic()
//print(sen1.aggregate_array('orbitProperties_pass'))
Map.addLayer(sen1.clip(roi),[],'sen1',false)
print(
ui.Chart.image.histogram(sen1,roi,10)
)
var despeckel = sen1.focalMean(100, 'square', 'meters');
Map.addLayer(despeckel.clip(roi),[],'sen_despeckel',false);
print(
ui.Chart.image.histogram(despeckel,roi,30)
)
var thr = despeckel.lt(-22);
Map.addLayer(thr.clip(roi),[],'oil_spill',false);
var mask = thr.updateMask(thr);
Map.addLayer(mask.clip(roi),[],'mask',false)
var area = mask.multiply(ee.Image.pixelArea().divide(1e6));
var oil_spill_area = ee.Number(area.reduceRegion({
reducer: ee.Reducer.sum(), geometry: roi, scale: 100
}).values().get(0));
print(oil_spill_area)
var oil_spill_vector = mask.reduceToVectors({
geometry: roi, scale: 100
});
Map.addLayer(oil_spill_vector)
Export.table.toDrive({
collection: oil_spill_vector, description: 'oil_spill', fileFormat: 'SHP', folder: 'oil_spill2'
})
Error generating chart: Image.reduceRegion: Too many pixels in the region. Found 16441942, but maxPixels allows only 10000000. Ensure that you are not aggregating at a higher resolution than you intended; that is a frequent cause of this error. If not, then you may set the ‘maxPixels’ argument to a limit suitable for your computation; set ‘bestEffort’ to true to aggregate at whatever scale results in ‘maxPixels’ total pixels; or both.