1

我想从 Google 地球引擎中导出合成的无云 Sentinel-2 图像,该引擎编译 2017 年至今的数据。我希望为每个单独的乐队导出复合材料。

function maskS2clouds(image) {
  var qa = image.select('QA60');

  // Bits 10 and 11 are clouds and cirrus, respectively.
  var cloudBitMask = 1 << 10;
  var cirrusBitMask = 1 << 11;

  // Both flags should be set to zero, indicating clear conditions.
  var mask = qa.bitwiseAnd(cloudBitMask).eq(0)
      .and(qa.bitwiseAnd(cirrusBitMask).eq(0));

  return image.updateMask(mask).divide(10000);
}


// Filter to only include images intersecting Colorado or Utah.
var polygon = ee.Geometry.Polygon({
  coords: [[[-135.3539859086835, 64.45205192005692],
          [-135.3539859086835, 64.00063248338122],
          [-134.008160713371, 64.00063248338122],
          [-134.008160713371, 64.45205192005692]]],
  geodesic: false
});

// Map the function over one year of data and take the median.
// Load Sentinel-2 TOA reflectance data.
var dataset = ee.ImageCollection('COPERNICUS/S2')
                  .filterDate('2018-01-01', '2019-07-17')
                   .filter(ee.Filter.calendarRange(6,9,'month'))
                  .filterBounds(polygon)
                  // Pre-filter to get less cloudy granules.
                  .filter(ee.Filter.lt('CLOUDY_PIXEL_PERCENTAGE', 30))
                  .map(maskS2clouds);

var rgbVis = {
  min: 0.0,
  max: 0.3,
  bands: ['B4', 'B3', 'B2'],
};
4

0 回答 0