0

I have 279 points (https://code.earthengine.google.com/?asset=projects/ee-zhaominyan/assets/2_29UMT), and need to get the surface reflectance of each points from Sentinel-2 for a very long period (around 1076 images in the image collection for this long periods). I found that if I use the typical approach, which control the number of elements under 5000 elements, this will make me process the same thing for 63 times. I am not pretty good at GEEngine, so does anyone know how to write a 'for-loop' to batch export the chart?

This is my code right now:

//cloud removal
function maskS2clouds(image) {
  var qa = image.select('QA60')

  var cloudBitMask = 1 << 10;
  var cirrusBitMask = 1 << 11;

  var mask = qa.bitwiseAnd(cloudBitMask).eq(0).and(
             qa.bitwiseAnd(cirrusBitMask).eq(0))

  return image.updateMask(mask)
      .select("B.*")
      .copyProperties(image, ["system:time_start"])
}
var tiles = ['29UMT'];

var shp1 = ee.FeatureCollection('projects/ee-zhaominyanpaper2/assets/2_29UMT')
Map.addLayer(shp1.draw({color: '0000FF', pointRadius: 1}),{},'29UMA')
var tiles = ['29UMT'];
// for a specific gemetry used before
var collection = ee.ImageCollection("COPERNICUS/S2_SR")
    .filterDate('2022-04-02', '2022-07-30')
    .filter(ee.Filter.inList('MGRS_TILE', tiles))
var count = collection.size();
print(count,'Count')
var collectioncloud = collection.map(maskS2clouds)
var chart =ui. Chart.image.seriesByRegion({
  imageCollection: collectioncloud,
  regions: shp1,
  reducer: ee.Reducer.mean(),
  band: 'B2',
  scale: 10,
  xProperty: 'system:time_start',
  seriesProperty:'FID_'
})

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy