current position:Home>Gee synthetic cloudless landsat-8 and sentry-2 data

Gee synthetic cloudless landsat-8 and sentry-2 data

2022-04-29 10:17:26User 7093711

Google Earth Engine( Composite image )

Landsat-8(30m The resolution of the ) and sentry -2(10m The resolution of the ) They are all remote sensing image data we commonly use .

however , Remote sensing images in many cases will There are clouds. , We need to do the image De cloud processing , This will lead to the loss of image data . We can use Google earth engine Synthesize multi scene images , Get a cloudless image , And there is no lack of data ( Be similar to MODIS8 Day reflectivity products ).

Another situation is , One image of our study area can't cover , We usually use it by downloading images ENVI Mosaic cutting . While using Google earth engine, We can directly download the embedded data , Very convenient .

today , We'll take Landsat-8 and sentry -2 For example , Demonstrate how to synthesize cloudless images and download .(GEE The data download method has been mentioned in the last issue , It's no longer written in code .)

sentry -2 Data synthesis

sentry -2 The spatial resolution of the data is 10m, The time resolution is 5 God .

This time we use ee.Geometry.Rectangle Function to make a rectangular area to select our sentry -2 The data of .

The selected data is 2018-06-01 To 2018-10-30 Data between , We put the cloud cover above percent 20 Filter out the data . And through sentry -2 The quality inspection band is used for cloud removal . then , Average all the data , You can get a cloudless sentry data .

Code :

var bound=ee.Geometry.Rectangle([115.3814, 41.0928,117.5020,  39.4227]);
function maskS2clouds(image) {
  var qa = image.select('QA60');

  // Bits 10 and 11 It's cloud. , We're going to take it mask fall 
  var cloudBitMask = 1 << 10;
  var cirrusBitMask = 1 << 11;
  var mask = qa.bitwiseAnd(cloudBitMask).eq(0)
      .and(qa.bitwiseAnd(cirrusBitMask).eq(0));
// The pixel value of the sentry is the reflection 10000 times , Divide by 10000
  return image.updateMask(mask).divide(10000);
}
var dataset = ee.ImageCollection('COPERNICUS/S2')
                  .filterDate('2018-06-01', '2018-10-30')
                 .filter(ee.Filter.lt('CLOUDY_PIXEL_PERCENTAGE', 20))
                  .filterBounds(bound)
                  .map(maskS2clouds);

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

Map.setCenter(116, 40, 12);
Map.addLayer(dataset.median(), rgbVis, 'RGB');

result (GEE Show ):

Local display (ENVI):

Landsat-8 Synthesize a cloudless image

Let's talk about how to use Landsat-8 To synthesize a cloudless image , And we have to calculate Landsat-8 Of NDVI. Then on NDVI To synthesize . Finally, we chose a research area ( Take Beijing for example ), Crop the study area ( Need to be on your own Assets Upload Beijing's shp file ). Last , We will get the Beijing area in 2017-06-01 To 2017-10-01 The maximum value in the period is synthesized NDVI.

Code :

var table=ee.FeatureCollection("users/boyxiaozheng/feature/beijing");
var landsat8=ee.ImageCollection("LANDSAT/LC08/C01/T1_RT");

function cal_ndvi(image){
  var mask=ee.Algorithms.Landsat.simpleCloudScore(image).select(['cloud']).lte(20);
  var ndvi=image.normalizedDifference(['B5', 'B4']).updateMask(mask);
  return ndvi;
}
var landsat_images=landsat8.filterDate('2017-06-01', '2017-10-01')
                .filterBounds(table.geometry())
                .filter(ee.Filter.lt('CLOUD_COVER',10))
                .map(cal_ndvi);


var visParam = {
 min: 0,
 max: 1,
 palette: 'FFFFFF, CE7E45, DF923D, F1B555, FCD163, 99B718, 74A901, 66A000, 529400,' +
   '3E8601, 207401, 056201, 004C00, 023B01, 012E01, 011D01, 011301'
};

Map.setCenter(115,39);
Map.addLayer(table, {}, 'default display');
Map.addLayer(landsat_images.max().clip(table.geometry()),visParam);

Running results (GEE Show ):

This time we talked about how to use GEE Crop and synthesize the image . Next issue , We'll talk about , How to make statistics on images in an area , Welcome to pay attention .

copyright notice
author[User 7093711],Please bring the original link to reprint, thank you.
https://en.qdmana.com/2022/119/202204290854059215.html

Random recommended